Improve error message for JSXExpressions that are comma expressions

This commit is contained in:
Andrew Branch
2019-05-21 14:21:44 -07:00
parent 77a76c157b
commit feaef9c829
7 changed files with 46 additions and 1 deletions

View File

@@ -4430,7 +4430,10 @@ namespace ts {
if (token() !== SyntaxKind.CloseBraceToken) {
node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken);
node.expression = parseAssignmentExpressionOrHigher();
// Only an AssignmentExpression is valid here per the JSX spec,
// but we can unambiguously parse a comma sequence and provide
// a better error message in grammar checking.
node.expression = parseExpression();
}
if (inExpressionContext) {
parseExpected(SyntaxKind.CloseBraceToken);