TypeScript/tests/cases/fourslash/extract-method-formatting-objectliteral.ts
2018-03-29 15:40:23 -07:00

51 lines
1,006 B
TypeScript

/// <reference path='fourslash.ts' />
////
//// namespace M {
//// class C {
//// foo() {
//// /*a*/let x = {a:1};
//// let y = {
//// b: 2
//// };
//// let z =
//// {
//// c: 3
//// };/*b*/
//// return x.a + y.b + z.c;
//// }
//// }
//// }
////
goTo.select('a', 'b');
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to method in class 'C'",
newContent:
`
namespace M {
class C {
foo() {
let { x, y, z } = this./*RENAME*/newMethod();
return x.a + y.b + z.c;
}
private newMethod() {
let x = { a: 1 };
let y = {
b: 2
};
let z = {
c: 3
};
return { x, y, z };
}
}
}
`
});