Skip to content

Commit

Permalink
Fix TypeScript plugin compat with @babel/types versions (#14566)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed May 19, 2022
1 parent 44362f4 commit e7fc577
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/babel-plugin-transform-typescript/src/index.ts
Expand Up @@ -573,7 +573,12 @@ export default declare((api, opts: Options) => {
path.replaceWith(node);
},

"TSNonNullExpression|TSInstantiationExpression"(
[process.env.BABEL_8_BREAKING
? "TSNonNullExpression|TSInstantiationExpression"
: // This has been introduced in Babel 7.18.0
t.tsInstantiationExpression
? "TSNonNullExpression|TSInstantiationExpression"
: "TSNonNullExpression"](
path: NodePath<t.TSNonNullExpression | t.TSExpressionWithTypeArguments>,
) {
path.replaceWith(path.node.expression);
Expand Down

0 comments on commit e7fc577

Please sign in to comment.