fix: throw expect jsx plugin error when an idStart or > is seen (#11774)
* fix: throw expect jsx plugin error when an idStart or > is seen * fix: avoid throwing undefined * add test case
This commit is contained in:
@@ -1179,7 +1179,13 @@ export default class ExpressionParser extends LValParser {
|
||||
// fall through
|
||||
case tt.relational: {
|
||||
if (this.state.value === "<") {
|
||||
throw this.expectOnePlugin(["jsx", "flow", "typescript"]);
|
||||
const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
||||
if (
|
||||
isIdentifierStart(lookaheadCh) || // Element/Type Parameter <foo>
|
||||
lookaheadCh === charCodes.greaterThan // Fragment <>
|
||||
) {
|
||||
this.expectOnePlugin(["jsx", "flow", "typescript"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// fall through
|
||||
|
||||
Reference in New Issue
Block a user