Skip to content

Commit c4bf21b

Browse files
author
Andy
authored
Improvements to checkUnusedIdentifiers (microsoft#19607)
1 parent b5f4a83 commit c4bf21b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/compiler/checker.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20430,21 +20430,20 @@ namespace ts {
2043020430
case SyntaxKind.MethodSignature:
2043120431
case SyntaxKind.CallSignature:
2043220432
case SyntaxKind.ConstructSignature:
20433-
case SyntaxKind.IndexSignature:
2043420433
case SyntaxKind.FunctionType:
2043520434
case SyntaxKind.ConstructorType:
20436-
checkUnusedTypeParameters(<FunctionLikeDeclaration>node);
20437-
break;
2043820435
case SyntaxKind.TypeAliasDeclaration:
20439-
checkUnusedTypeParameters(<TypeAliasDeclaration>node);
20436+
checkUnusedTypeParameters(<MethodSignature | CallSignatureDeclaration | ConstructSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | TypeAliasDeclaration>node);
2044020437
break;
20438+
default:
20439+
Debug.fail("Node should not have been registered for unused identifiers check");
2044120440
}
2044220441
}
2044320442
}
2044420443
}
2044520444

2044620445
function checkUnusedLocalsAndParameters(node: Node): void {
20447-
if (node.parent.kind !== SyntaxKind.InterfaceDeclaration && noUnusedIdentifiers && !(node.flags & NodeFlags.Ambient)) {
20446+
if (noUnusedIdentifiers && !(node.flags & NodeFlags.Ambient)) {
2044820447
node.locals.forEach(local => {
2044920448
if (!local.isReferenced) {
2045020449
if (local.valueDeclaration && getRootDeclaration(local.valueDeclaration).kind === SyntaxKind.Parameter) {

0 commit comments

Comments
 (0)