Get the latest tech news

N-Params vs. Single Param


When writing functions in TypeScript (and, truthfully, any language that does not support named parameters), you either pass arguments individually ( n params) or group them into a single object. While both are valid, I am yet to find a case were object parameters aren't the better choice.

When writing functions in TypeScript (and, truthfully, any language that does not support named parameters), you either pass arguments individually ( n params) or group them into a single object. While both are valid, I am yet to find a case were object parameters aren't the better choice. Plus, TypeScript gives you full autocompletion and type safety.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of N-Params

N-Params

Photo of Single Param

Single Param