diff --git a/src/transformation/visitors/typescript.ts b/src/transformation/visitors/typescript.ts index ab6c940f6..ddd319381 100644 --- a/src/transformation/visitors/typescript.ts +++ b/src/transformation/visitors/typescript.ts @@ -20,6 +20,7 @@ export const typescriptVisitors: Visitors = { [ts.SyntaxKind.InterfaceDeclaration]: () => undefined, [ts.SyntaxKind.NonNullExpression]: (node, context) => context.transformExpression(node.expression), + [ts.SyntaxKind.ExpressionWithTypeArguments]: (node, context) => context.transformExpression(node.expression), [ts.SyntaxKind.AsExpression]: transformAssertionExpression, [ts.SyntaxKind.TypeAssertionExpression]: transformAssertionExpression, [ts.SyntaxKind.NotEmittedStatement]: () => undefined, diff --git a/test/unit/expressions.spec.ts b/test/unit/expressions.spec.ts index 71c014fda..329b6317e 100644 --- a/test/unit/expressions.spec.ts +++ b/test/unit/expressions.spec.ts @@ -153,6 +153,14 @@ test("Non-null expression", () => { `.expectToMatchJsResult(); }); +test("Typescript 4.7 instantiation expression", () => { + util.testFunction` + function foo(x: T): T { return x; } + const bar = foo; + return bar(3); + `.expectToMatchJsResult(); +}); + test.each([ '"foobar"', "17",