mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Report error when using generic class in js file (#31723)
* Report error when using generic class in js file * Replace "ClassDeclaration | ClassExpression" to ClassLikeDeclaration Co-Authored-By: Klaus Meinhardt <klaus.meinhardt1@gmail.com> * add noEmit:true
This commit is contained in:
committed by
Ryan Cavanaugh
parent
334b8590e9
commit
dcb763f624
@@ -1833,6 +1833,7 @@ namespace ts {
|
||||
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
@@ -1842,7 +1843,7 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
// Check type parameters
|
||||
if (nodes === (<ClassDeclaration | FunctionLikeDeclaration>parent).typeParameters) {
|
||||
if (nodes === (<ClassLikeDeclaration | FunctionLikeDeclaration>parent).typeParameters) {
|
||||
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user