[babel 8] Don't create TSParenthesizedType nodes by default (#12608)

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Sergey Melyukov <s.melukov@gmail.com>
This commit is contained in:
Huáng Jùnliàng
2021-01-12 19:13:09 -05:00
committed by GitHub
parent 2338b052ad
commit 62290aa1ba
19 changed files with 140 additions and 19 deletions

View File

@@ -842,6 +842,18 @@ export default (superClass: Class<Parser>): Class<Parser> =>
case tt.bracketL:
return this.tsParseTupleType();
case tt.parenL:
if (process.env.BABEL_8_BREAKING) {
if (!this.options.createParenthesizedExpressions) {
const startPos = this.state.start;
this.next();
const type = this.tsParseType();
this.expect(tt.parenR);
this.addExtra(type, "parenthesized", true);
this.addExtra(type, "parenStart", startPos);
return type;
}
}
return this.tsParseParenthesizedType();
case tt.backQuote:
return this.tsParseTemplateLiteralType();