TypeScript/tests/cases/fourslash/extract-method2.ts
2017-08-04 16:10:33 -07:00

29 lines
750 B
TypeScript

/// <reference path='fourslash.ts' />
//// namespace NS {
//// class Q {
//// foo() {
//// console.log('100');
//// const m = 10, j = "hello", k = {x: "what"};
//// const q = /*start*/m + j + k/*end*/;
//// }
//// }
//// }
goTo.select('start', 'end')
verify.refactorAvailable('Extract Method');
edit.applyRefactor('Extract Method', "scope_2");
verify.currentFileContentIs(
`namespace NS {
class Q {
foo() {
console.log('100');
const m = 10, j = "hello", k = {x: "what"};
const q = newFunction(m, j, k);
}
}
}
function newFunction(m: number, j: string, k: { x: string; }) {
return m + j + k;
}
`);