ast-types icon indicating copy to clipboard operation
ast-types copied to clipboard

Does `TSTypeParameter.name` need to be all of `IdentifierKind` types?

Open smurzin opened this issue 2 years ago • 1 comments

It seems that in recent version TSTypeParameter.name has been extended to be string | K.IdentifierKind.

This results in a weird type cycle, where a name can be any identifier including TSTypeParameter again. Causing client code to deal with it somehow. It seems that babel-parser tests do not have any examples of generating anything apart from plain Identifier (or string) for TStypeParameter.name.

Should this be constrained a bit more?

smurzin avatar Jun 08 '23 08:06 smurzin

Bumping this problem as I have also encountered it when looking to upgrade jscodeshift, which uses recast, which uses updated ast-types. The diff between the types on 0.14.2 and 0.16.1 can be seen on L1242 here.

Image

Because of this, we are kind of forced to stick with forcing a 0.14.2 version. 🤔

LukasTy avatar Jun 12 '25 15:06 LukasTy