2019-02-11 21:03:09 +01:00
/// <reference path='fourslash.ts' />
////foo(1, 2); /**a*/
/////**b*/ function /*a*/foo/*b*/(/**this1*/ this /**this2*/: /**void1*/ void /**void2*/, /**c*/ a /**d*/: /**e*/ number /**f*/, /**g*/ b /**h*/: /**i*/ number /**j*/ = /**k*/ 1 /**l*/) {
//// // m
//// /**n*/ return a + b; // o
//// // p
////} // q
/////**r*/ foo(1);
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 : ` foo({ a: 1, b: 2 }); /**a*/
/**b*/ function foo ( /**this1*/ this /**this2*/ : /**void1*/ void /**void2*/ , { a , b = /**k*/ 1 /**l*/ } : { /**c*/ a /**d*/ : /**e*/ number /**f*/ ; /**g*/ b /**h*/ ? : /**i*/ number /**j*/ ; } ) {
// m
/**n*/ return a + b ; // o
// p
} // q
/**r*/ foo ( { a : 1 } ) ; `
} ) ;