diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index b024d1f94d03a..c578c38cbc117 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -351,7 +351,10 @@ namespace ts.formatting { getListIfStartEndIsInListRange((node.parent).parameters, start, end); } case SyntaxKind.ClassDeclaration: - return getListIfStartEndIsInListRange((node.parent).typeParameters, node.getStart(sourceFile), end); + case SyntaxKind.ClassExpression: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + return getListIfStartEndIsInListRange((node.parent).typeParameters, node.getStart(sourceFile), end); case SyntaxKind.NewExpression: case SyntaxKind.CallExpression: { const start = node.getStart(sourceFile); diff --git a/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts index 5800fbcb1293b..4b485fd403e0a 100644 --- a/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts +++ b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts @@ -37,6 +37,10 @@ ////for (let i = 0, j = 0; ;) {} ////for (const x of []) {} ////for (const y in {}) {} +//// +////export type First = T; +////export interface ISecond { u: U; } +////export const cls = class { u: U; }; verify.codeFixAll({ fixId: "unusedIdentifier_delete", @@ -70,5 +74,9 @@ takesCb((x, y) => { y; }); } for (; ;) {} for (const {} of []) {} -for (const {} in {}) {}`, +for (const {} in {}) {} + +export type First = T; +export interface ISecond { u: U; } +export const cls = class { u: U; };`, });