From 27be5142cc09fcfcf0fba7543bd4069368bd3f02 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Wed, 8 May 2024 10:13:07 +0100 Subject: [PATCH 1/2] fix: add typeArguments to CallExpression Adds type parameters to `CallExpression` such that `visit` is able to visit them. --- src/def/typescript.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/def/typescript.ts b/src/def/typescript.ts index c050529e..97bc8877 100644 --- a/src/def/typescript.ts +++ b/src/def/typescript.ts @@ -519,6 +519,9 @@ export default function (fork: Fork) { def("TSDeclareMethod"), TSTypeMember )]); + + def("CallExpression") + .bases("TSHasOptionalTypeParameterInstantiation"); }; maybeSetModuleExports(() => module); From ab74ce2f7f656c6ce00293ef4c728a3f5d736cb0 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:51:49 +0100 Subject: [PATCH 2/2] test: add test for callexpression type params --- src/test/typescript.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/test/typescript.ts b/src/test/typescript.ts index a9c2b4c4..31f168cd 100644 --- a/src/test/typescript.ts +++ b/src/test/typescript.ts @@ -407,5 +407,19 @@ glob("**/*.ts", { } }); }); + + it("visits type parameters of call expressions", function () { + const program = babelParse([ + "fn(808)", + ].join("\n"), { + plugins: ["typescript"] + }); + + assertVisited(program, { + visitTSTypeParameterInstantiation(path) { + this.traverse(path); + } + }); + }); }); -}); \ No newline at end of file +});