mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 11:43:18 -05:00
Improvements to checkUnusedIdentifiers (#19607)
This commit is contained in:
@@ -20430,21 +20430,20 @@ namespace ts {
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
checkUnusedTypeParameters(<FunctionLikeDeclaration>node);
|
||||
break;
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
checkUnusedTypeParameters(<TypeAliasDeclaration>node);
|
||||
checkUnusedTypeParameters(<MethodSignature | CallSignatureDeclaration | ConstructSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | TypeAliasDeclaration>node);
|
||||
break;
|
||||
default:
|
||||
Debug.fail("Node should not have been registered for unused identifiers check");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkUnusedLocalsAndParameters(node: Node): void {
|
||||
if (node.parent.kind !== SyntaxKind.InterfaceDeclaration && noUnusedIdentifiers && !(node.flags & NodeFlags.Ambient)) {
|
||||
if (noUnusedIdentifiers && !(node.flags & NodeFlags.Ambient)) {
|
||||
node.locals.forEach(local => {
|
||||
if (!local.isReferenced) {
|
||||
if (local.valueDeclaration && getRootDeclaration(local.valueDeclaration).kind === SyntaxKind.Parameter) {
|
||||
|
||||
Reference in New Issue
Block a user