Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,7 @@ namespace ts {
writeLine();
decreaseIndent();
}
emitList(node, node.members, ListFormat.PreserveLines);
writePunctuation("}");
}

Expand Down
17 changes: 17 additions & 0 deletions tests/cases/fourslash/refactorExtractType76.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// <reference path='fourslash.ts' />

// @Filename: a.ts
////type Deep<T> = /*a*/{ [K in keyof T]: Deep<T[K]> }/*b*/

goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent:
`type /*RENAME*/NewType<T> = {
[K in keyof T]: Deep<T[K]>;
};

type Deep<T> = NewType<T>`,
});
21 changes: 21 additions & 0 deletions tests/cases/fourslash/refactorExtractType77.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// <reference path='fourslash.ts' />

// @Filename: a.ts
////type Expand<T> = T extends any
//// ? /*a*/{ [K in keyof T]: Expand<T[K]> }/*b*/
//// : never;

goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent:
`type /*RENAME*/NewType<T> = {
[K in keyof T]: Expand<T[K]>;
};

type Expand<T> = T extends any
? NewType<T>
: never;`,
});