diff --git a/packages/babel-plugin-transform-typescript/src/index.js b/packages/babel-plugin-transform-typescript/src/index.js index 95cb76b166ea..82839fa05831 100644 --- a/packages/babel-plugin-transform-typescript/src/index.js +++ b/packages/babel-plugin-transform-typescript/src/index.js @@ -419,6 +419,10 @@ export default declare( path.node.typeParameters = null; }, + OptionalCallExpression(path) { + path.node.typeParameters = null; + }, + NewExpression(path) { path.node.typeParameters = null; }, diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/type-arguments/optional-call/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/type-arguments/optional-call/input.ts new file mode 100644 index 000000000000..362521c1ed9e --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/type-arguments/optional-call/input.ts @@ -0,0 +1 @@ +x?.f(); \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/type-arguments/optional-call/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/type-arguments/optional-call/output.js new file mode 100644 index 000000000000..720f644dbc3a --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/type-arguments/optional-call/output.js @@ -0,0 +1 @@ +x?.f(); \ No newline at end of file