X Tutup
Skip to content

Commit e1a1fa6

Browse files
authored
Support typescript 4.7 instantiation expressions (#1340)
1 parent c3dd228 commit e1a1fa6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/transformation/visitors/typescript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const typescriptVisitors: Visitors = {
2020
[ts.SyntaxKind.InterfaceDeclaration]: () => undefined,
2121

2222
[ts.SyntaxKind.NonNullExpression]: (node, context) => context.transformExpression(node.expression),
23+
[ts.SyntaxKind.ExpressionWithTypeArguments]: (node, context) => context.transformExpression(node.expression),
2324
[ts.SyntaxKind.AsExpression]: transformAssertionExpression,
2425
[ts.SyntaxKind.TypeAssertionExpression]: transformAssertionExpression,
2526
[ts.SyntaxKind.NotEmittedStatement]: () => undefined,

test/unit/expressions.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ test("Non-null expression", () => {
153153
`.expectToMatchJsResult();
154154
});
155155

156+
test("Typescript 4.7 instantiation expression", () => {
157+
util.testFunction`
158+
function foo<T>(x: T): T { return x; }
159+
const bar = foo<number>;
160+
return bar(3);
161+
`.expectToMatchJsResult();
162+
});
163+
156164
test.each([
157165
'"foobar"',
158166
"17",

0 commit comments

Comments
 (0)
X Tutup