Throw syntax error for } and > in JSX text (#36636)

* Throw syntax error for `}` and `>` in JSX text

Fixes #36341

* Add codefix for error
This commit is contained in:
Brad Zacher
2020-02-11 08:44:17 -08:00
committed by GitHub
parent ad8c209fc2
commit 348c4dddc6
19 changed files with 487 additions and 6 deletions

View File

@@ -1135,6 +1135,14 @@
"category": "Error",
"code": 1380
},
"Unexpected token. Did you mean `{'}'}` or `}`?": {
"category": "Error",
"code": 1381
},
"Unexpected token. Did you mean `{'>'}` or `>`?": {
"category": "Error",
"code": 1382
},
"The types of '{0}' are incompatible between these types.": {
"category": "Error",
@@ -5457,6 +5465,14 @@
"category": "Message",
"code": 95099
},
"Convert invalid character to its html entity code": {
"category": "Message",
"code": 95100
},
"Wrap invalid character in an expression container": {
"category": "Message",
"code": 95101
},
"No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": {
"category": "Error",

View File

@@ -2156,6 +2156,12 @@ namespace ts {
}
break;
}
if (char === CharacterCodes.greaterThan) {
error(Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1);
}
if (char === CharacterCodes.closeBrace) {
error(Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1);
}
if (lastNonWhitespace > 0) lastNonWhitespace++;