Why can't I specify `typeParameters` to a `CallExpression`?
I can't get the following code to add type parameters to my CallExpression in any of the parsers I've tried (flow and babylon7):
const myExpression = j.callExpression(
j.identifier('withTheme'),
[j.identifier('Thing')],
j.typeParameterInstantiation([
j.genericTypeAnnotation(j.identifier('Props'), null),
])
);
Forgive me if I've entered this issue in the wrong place, I don't yet really follow how the jscodeshift ecosystem fits together.
Here it looks like the callExpression builder function is being decorated with a third argument for type parameters, but if I just pass junk into that argument there is no type error.
Similar issue with TS parser. typeParameters are wiped out from the call expression on toSource() call.
It seems that it's an issue of recast https://github.com/benjamn/recast/issues/266
This issue is resolved in the latest versions of recast, https://github.com/benjamn/recast/pull/613. Version is even updated in jscodeshift, it's just not published to the registry.