From 09be5377869041412a222d10be5ddb60ed7d4d29 Mon Sep 17 00:00:00 2001 From: Dick van den Brink Date: Thu, 22 Jun 2017 16:41:40 +0200 Subject: [PATCH] Also check TypeAlias for unused type parameters Fixes #15208 --- src/compiler/checker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 05c20ffb11a..e5c63cbd50c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19426,6 +19426,9 @@ namespace ts { case SyntaxKind.ConstructorType: checkUnusedTypeParameters(node); break; + case SyntaxKind.TypeAliasDeclaration: + checkUnusedTypeParameters(node); + break; } } } @@ -19503,7 +19506,7 @@ namespace ts { } } - function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration) { + function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration | TypeAliasDeclaration) { if (compilerOptions.noUnusedLocals && !isInAmbientContext(node)) { if (node.typeParameters) { // Only report errors on the last declaration for the type parameter container; @@ -21208,6 +21211,7 @@ namespace ts { checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); checkTypeParameters(node.typeParameters); checkSourceElement(node.type); + registerForUnusedIdentifiersCheck(node); } function computeEnumMemberValues(node: EnumDeclaration) {