mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Enhancement new expression with type arguments without parenthesized argument list error message (#37576)
* Enhancement new expression with type arguments without parenthesized argument list error message Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> * add baselines Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> * use parseErrorAt Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> * refine code Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> * Space before paren Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
This commit is contained in:
@@ -1147,6 +1147,10 @@
|
||||
"category": "Error",
|
||||
"code": 1383
|
||||
},
|
||||
"A 'new' expression with type arguments must always be followed by a parenthesized argument list.": {
|
||||
"category": "Error",
|
||||
"code": 1384
|
||||
},
|
||||
|
||||
"The types of '{0}' are incompatible between these types.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -5199,9 +5199,12 @@ namespace ts {
|
||||
const node = <NewExpression>createNode(SyntaxKind.NewExpression, fullStart);
|
||||
node.expression = expression;
|
||||
node.typeArguments = typeArguments;
|
||||
if (node.typeArguments || token() === SyntaxKind.OpenParenToken) {
|
||||
if (token() === SyntaxKind.OpenParenToken) {
|
||||
node.arguments = parseArgumentList();
|
||||
}
|
||||
else if (node.typeArguments) {
|
||||
parseErrorAt(fullStart, scanner.getStartPos(), Diagnostics.A_new_expression_with_type_arguments_must_always_be_followed_by_a_parenthesized_argument_list);
|
||||
}
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user