diff --git a/src/services/refactors/convertParamsToDestructuredObject.ts b/src/services/refactors/convertParamsToDestructuredObject.ts index 784cefda23b49..5fcd96a801870 100644 --- a/src/services/refactors/convertParamsToDestructuredObject.ts +++ b/src/services/refactors/convertParamsToDestructuredObject.ts @@ -1,7 +1,7 @@ /* @internal */ namespace ts.refactor.convertParamsToDestructuredObject { const refactorName = "Convert parameters to destructured object"; - const minimumParameterLength = 2; + const minimumParameterLength = 1; const refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object); const toDestructuredAction = { diff --git a/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunctionWithSingleParameter.ts b/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunctionWithSingleParameter.ts new file mode 100644 index 0000000000000..5c130b3b0e9da --- /dev/null +++ b/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_arrowFunctionWithSingleParameter.ts @@ -0,0 +1,13 @@ +/// + +////const foo = /*a*/(a: number)/*b*/ => { }; +////foo(1); + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Convert parameters to destructured object", + actionName: "Convert parameters to destructured object", + actionDescription: "Convert parameters to destructured object", + newContent: `const foo = ({ a }: { a: number; }) => { }; +foo({ a: 1 });`, +});