Skip to content

Commit 56e7a0c

Browse files
committed
Try doing this instead in the parser
1 parent 728c9b4 commit 56e7a0c

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28912,14 +28912,7 @@ namespace ts {
2891228912
return nonNullType;
2891328913
}
2891428914

28915-
function checkGrammarPropertyAccessExpression(node: PropertyAccessExpression) {
28916-
if (node.expression.kind === SyntaxKind.ExpressionWithTypeArguments) {
28917-
grammarErrorOnNode(node.name, Diagnostics.Instantiation_expression_cannot_be_followed_by_property_access);
28918-
}
28919-
}
28920-
2892128915
function checkPropertyAccessExpression(node: PropertyAccessExpression, checkMode: CheckMode | undefined) {
28922-
checkGrammarPropertyAccessExpression(node);
2892328916
return node.flags & NodeFlags.OptionalChain ? checkPropertyAccessChain(node as PropertyAccessChain, checkMode) :
2892428917
checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode);
2892528918
}

src/compiler/parser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5646,6 +5646,9 @@ namespace ts {
56465646
if (isOptionalChain && isPrivateIdentifier(propertyAccess.name)) {
56475647
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
56485648
}
5649+
else if (isExpressionWithTypeArguments(expression)) {
5650+
parseErrorAtRange(propertyAccess.name, Diagnostics.Instantiation_expression_cannot_be_followed_by_property_access);
5651+
}
56495652
return finishNode(propertyAccess, pos);
56505653
}
56515654

0 commit comments

Comments
 (0)