mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Bug fix for issue #14696, things changed are;
- Empty class type will now throw an error, - Trailing comma in class type will also throw an error, - Added tests for empty class type parameter, - Updated tests for class type parameters with trailing comma This behavior is consistently following function or method like when its type parameter is either empty or has trailing comma.
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;
|
||||
|
||||
Reference in New Issue
Block a user