mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Merge remote-tracking branch 'choz/master'
This commit is contained in:
@@ -19559,7 +19559,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkClassLikeDeclaration(node: ClassLikeDeclaration) {
|
||||
checkGrammarClassDeclarationHeritageClauses(node);
|
||||
checkGrammarClassLikeDeclaration(node);
|
||||
checkDecorators(node);
|
||||
if (node.name) {
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0);
|
||||
@@ -22520,6 +22520,11 @@ namespace ts {
|
||||
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
|
||||
}
|
||||
|
||||
function checkGrammarClassLikeDeclaration(node: ClassLikeDeclaration): boolean {
|
||||
const file = getSourceFileOfNode(node);
|
||||
return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file);
|
||||
}
|
||||
|
||||
function checkGrammarArrowFunction(node: FunctionLikeDeclaration, file: SourceFile): boolean {
|
||||
if (node.kind === SyntaxKind.ArrowFunction) {
|
||||
const arrowFunction = <ArrowFunction>node;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/compiler/classWithEmptyTypeParameter.ts(1,8): error TS1098: Type parameter list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classWithEmptyTypeParameter.ts (1 errors) ====
|
||||
class C<> {
|
||||
~~
|
||||
!!! error TS1098: Type parameter list cannot be empty.
|
||||
}
|
||||
10
tests/baselines/reference/classWithEmptyTypeParameter.js
Normal file
10
tests/baselines/reference/classWithEmptyTypeParameter.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//// [classWithEmptyTypeParameter.ts]
|
||||
class C<> {
|
||||
}
|
||||
|
||||
//// [classWithEmptyTypeParameter.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/compiler/typeParameterListWithTrailingComma1.ts(1,10): error TS1009: Trailing comma not allowed.
|
||||
|
||||
|
||||
==== tests/cases/compiler/typeParameterListWithTrailingComma1.ts (1 errors) ====
|
||||
class C<T,> {
|
||||
~
|
||||
!!! error TS1009: Trailing comma not allowed.
|
||||
}
|
||||
2
tests/cases/compiler/classWithEmptyTypeParameter.ts
Normal file
2
tests/cases/compiler/classWithEmptyTypeParameter.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
class C<> {
|
||||
}
|
||||
Reference in New Issue
Block a user