@babel/preset-typescript: fix tsx assigment issue (#12599)

This commit is contained in:
Zen
2021-01-10 23:21:39 +08:00
committed by GitHub
parent fce3e7124a
commit 6c9a481e83
5 changed files with 173 additions and 2 deletions

View File

@@ -2450,7 +2450,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
let jsx;
let typeCast;
if (this.match(tt.jsxTagStart)) {
if (
this.hasPlugin("jsx") &&
(this.match(tt.jsxTagStart) || this.isRelational("<"))
) {
// Prefer to parse JSX if possible. But may be an arrow fn.
state = this.state.clone();