mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-02 14:48:32 -05:00
"Convert parameters to destructured object": enable for functions with just one parameter (#46945)
* "Convert parameters to destructured object": enable for functions with just one parameter Fixes https://github.com/microsoft/TypeScript/issues/41753 * Add test
This commit is contained in:
committed by
GitHub
parent
9b0f01a13f
commit
b7d011777e
@@ -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 = {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////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 });`,
|
||||
});
|
||||
Reference in New Issue
Block a user