benjamn / recast

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: did not recognize object of type "TSInstantiationExpression"

Arooba-git opened this issue Β· comments

Hi πŸ‘‹
I'm using recast with babel parser, and getting this error when trying to parse any file containing TSInstantiationExpression. Is recast missing TSInstantiationExpression support or am I missing something? πŸ€”

Screen Shot 2022-11-22 at 6 15 55 AM

Is there any workaround or a temporary fix for that? I'd be happy to ignore these, just not to die.

My jscodeshift-based auto-refactoring script fails to work on real-life files because of that. Even though it doesn't need to refactor any TSInstantiationExpressions.

Does it fail on every file? Or only files with TSInstantiationExpressions? You could comment them out for now.

I have a large codebase, 100+ files have TSInstantiationExpressions. The refactoring script fails on them.

Without any type of pressure, may I kindly wonder, is this going to be fixed soon?

I saw a commit has landed, but not sure how much work is ahead.

Thank you for what you do!

The remaining work in #1232 is worthwhile for completeness but not necessarily relevant unless you're using ClassAccessorProperty (a very new AST node type).

@iliakan If you want to test the current changes locally, you should be able to run this command to install recast@0.23.0-pr1232.0:

npm i recast@pr-1232

If this is useful, let me know. I might try to automate it for any PR, so it's easier for folks to test/use any proposed changes.

I've updated the pr-1232 tag with the latest from #1232. Working for you, @iliakan?

Last time it worked without errors (but I did not check the outcome). I'll retest again after I rewrite some stuff ;)

Alright folks, please try running npm i recast@next to get version 0.23.1, which includes support for TSInstantiationExpression and some other AST types that were lagging behind Babel.

Since I have not tagged this version as latest on npm yet, we can still fix bugs relatively easily, if you encounter anything strange after updating.