2019-02-11 21:03:09 +01:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
////function /*a*/foo/*b*/(a: number, b: number, ...rest: number[]) {
|
|
|
|
//// return a + b;
|
|
|
|
////}
|
|
|
|
////foo(/**a*/ 1 /**b*/, /**c*/ 2 /**d*/, /**e*/ 3 /**f*/, /**g*/ 4 /**h*/);
|
|
|
|
|
|
|
|
goTo.select("a", "b");
|
|
|
|
edit.applyRefactor({
|
2019-03-14 21:41:29 +01:00
|
|
|
refactorName: "Convert parameters to destructured object",
|
|
|
|
actionName: "Convert parameters to destructured object",
|
|
|
|
actionDescription: "Convert parameters to destructured object",
|
2019-02-11 21:03:09 +01:00
|
|
|
newContent: `function foo({ a, b, rest = [] }: { a: number; b: number; rest?: number[]; }) {
|
|
|
|
return a + b;
|
|
|
|
}
|
2019-02-16 01:48:54 +01:00
|
|
|
foo({ /**a*/ a: 1 /**b*/, /**c*/ b: 2 /**d*/, rest: [/**e*/ 3 /**f*/, /**g*/ 4 /**h*/] });`
|
2019-02-11 21:03:09 +01:00
|
|
|
});
|