2019-05-07 17:26:54 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
2019-06-06 19:28:42 +02:00
|
|
|
//// namespace A { export const b = 1; }
|
|
|
|
//// function a(b: string): /*a*/typeof A.b/*b*/ { return 1; }
|
2019-05-07 17:26:54 +02:00
|
|
|
|
|
|
|
goTo.select("a", "b");
|
|
|
|
edit.applyRefactor({
|
|
|
|
refactorName: "Extract type",
|
|
|
|
actionName: "Extract to type alias",
|
|
|
|
actionDescription: "Extract to type alias",
|
2019-06-06 19:28:42 +02:00
|
|
|
newContent: `namespace A { export const b = 1; }
|
2019-05-07 17:26:54 +02:00
|
|
|
type /*RENAME*/NewType = typeof A.b;
|
|
|
|
|
2019-06-06 19:28:42 +02:00
|
|
|
function a(b: string): NewType { return 1; }`,
|
2019-05-07 17:26:54 +02:00
|
|
|
});
|