Skip to content

Commit ba0d895

Browse files
committed
Merge remote-tracking branch 'choz/master'
2 parents 9e8b3d9 + 6b5330f commit ba0d895

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19559,7 +19559,7 @@ namespace ts {
1955919559
}
1956019560

1956119561
function checkClassLikeDeclaration(node: ClassLikeDeclaration) {
19562-
checkGrammarClassDeclarationHeritageClauses(node);
19562+
checkGrammarClassLikeDeclaration(node);
1956319563
checkDecorators(node);
1956419564
if (node.name) {
1956519565
checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0);
@@ -22520,6 +22520,11 @@ namespace ts {
2252022520
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
2252122521
}
2252222522

22523+
function checkGrammarClassLikeDeclaration(node: ClassLikeDeclaration): boolean {
22524+
const file = getSourceFileOfNode(node);
22525+
return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file);
22526+
}
22527+
2252322528
function checkGrammarArrowFunction(node: FunctionLikeDeclaration, file: SourceFile): boolean {
2252422529
if (node.kind === SyntaxKind.ArrowFunction) {
2252522530
const arrowFunction = <ArrowFunction>node;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tests/cases/compiler/classWithEmptyTypeParameter.ts(1,8): error TS1098: Type parameter list cannot be empty.
2+
3+
4+
==== tests/cases/compiler/classWithEmptyTypeParameter.ts (1 errors) ====
5+
class C<> {
6+
~~
7+
!!! error TS1098: Type parameter list cannot be empty.
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//// [classWithEmptyTypeParameter.ts]
2+
class C<> {
3+
}
4+
5+
//// [classWithEmptyTypeParameter.js]
6+
var C = (function () {
7+
function C() {
8+
}
9+
return C;
10+
}());
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tests/cases/compiler/typeParameterListWithTrailingComma1.ts(1,10): error TS1009: Trailing comma not allowed.
2+
3+
4+
==== tests/cases/compiler/typeParameterListWithTrailingComma1.ts (1 errors) ====
5+
class C<T,> {
6+
~
7+
!!! error TS1009: Trailing comma not allowed.
8+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class C<> {
2+
}

0 commit comments

Comments
 (0)