Skip to content

Commit 09be537

Browse files
committed
Also check TypeAlias for unused type parameters
Fixes #15208
1 parent f1fb1b9 commit 09be537

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19426,6 +19426,9 @@ namespace ts {
1942619426
case SyntaxKind.ConstructorType:
1942719427
checkUnusedTypeParameters(<FunctionLikeDeclaration>node);
1942819428
break;
19429+
case SyntaxKind.TypeAliasDeclaration:
19430+
checkUnusedTypeParameters(<TypeAliasDeclaration>node);
19431+
break;
1942919432
}
1943019433
}
1943119434
}
@@ -19503,7 +19506,7 @@ namespace ts {
1950319506
}
1950419507
}
1950519508

19506-
function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration) {
19509+
function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration | TypeAliasDeclaration) {
1950719510
if (compilerOptions.noUnusedLocals && !isInAmbientContext(node)) {
1950819511
if (node.typeParameters) {
1950919512
// Only report errors on the last declaration for the type parameter container;
@@ -21208,6 +21211,7 @@ namespace ts {
2120821211
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
2120921212
checkTypeParameters(node.typeParameters);
2121021213
checkSourceElement(node.type);
21214+
registerForUnusedIdentifiersCheck(node);
2121121215
}
2121221216

2121321217
function computeEnumMemberValues(node: EnumDeclaration) {

0 commit comments

Comments
 (0)