Search Terms
Suggestion
Back when this refactor was added in #30089, it was decided that the refactor would not be available for functions with less than 2 parameters.
The refactor will not be available on:
- functions with less than 2 parameters
#30089 (comment)
I would like to suggest that this refactor should be available for functions with just one parameter.
Use Cases
The reason is because I often use this refactoring to make a function into a React component (which always receive their parameters aka props as an object), and it's not infrequent that I need to do this for a function that receives just one parameter.
Furthermore, it would be useful to run this refactoring if you plan to add more parameters immediately afterwards—as opposed to adding more parameters and then converting to an object.
Examples
declare const add: (n1: number, n2: number) => number;
const fn = (a: number) => add(a, 1);
should convert to
declare const add: (n1: number, n2: number) => number;
const fn = ({ a }: { a: number }) => add(a, 1);
Checklist
My suggestion meets these guidelines:
Search Terms
Suggestion
Back when this refactor was added in #30089, it was decided that the refactor would not be available for functions with less than 2 parameters.
#30089 (comment)
I would like to suggest that this refactor should be available for functions with just one parameter.
Use Cases
The reason is because I often use this refactoring to make a function into a React component (which always receive their parameters aka props as an object), and it's not infrequent that I need to do this for a function that receives just one parameter.
Furthermore, it would be useful to run this refactoring if you plan to add more parameters immediately afterwards—as opposed to adding more parameters and then converting to an object.
Examples
should convert to
Checklist
My suggestion meets these guidelines: