Closed philipsens closed 4 days ago
Goed idee!
At what point / amount of parameters would you say its better to switch to an object parameter? I'm thinking of starting it at 3 or 4, I'm pretty sure most functions use about 1-2 parameters unless a function is very state dependent.
method(options: {option1: string }): void {
// example
}
method(options: methodOptions): void {
// example
}
This should be done with 3 or more parameters
Edit:
We chose to convert from 4
This means that you could also have options as second parameter. When transforming an object it could be nice to have:
compare(object, object, {option: true})
Add max param rule to eslint config
Explanation (JS): https://www.codereadability.com/what-are-javascript-options-objects/ Article (TS): https://medium.com/@bchadwickfrance/the-options-object-pattern-with-typescript-a14f33306ec8