-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support TSESTree input and TypeScript output #707
Comments
Hi @bjornharrtell, TypeScript support would indeed be interesting. Could you provide more insights regarding the TSESTree spec? |
I'm unable to find a formal spec extension to estree. The basis of the extensions seems to live at https://github.com/typescript-eslint/typescript-eslint/blob/8f08ee54d1389666b3f582853a8b6809d34d70f8/packages/ast-spec/src/ast-node-types.ts#L94-L171, which enumerates all the added node types. At https://typescript-eslint.io/play you can supply TypeScript code and generate TSESTree, but not the other way round. I asked about a year ago and it was clarified that implementation to do TSESTree to TypeScript doesn't exist (yet), see typescript-eslint/typescript-eslint#7228. |
I see now that the code is very spec like fx. https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/ast-spec/src/special/TSTypeParameter/spec.ts |
see also https://github.com/TyrealHu/acorn-typescript btw |
Motivation
My own motivation is that I have a translation from a typed language (Java) to ESTree and generate JavaScript from that with astring, but would like to preseve some of the type information and target TypeScript instead.
Apparently eslint has made exensions to ESTree called TSESTree but AFAICT they only use it to transform TypeScript into AST not the other way round.
Expected behavior
A flag to output TypeScript.
The text was updated successfully, but these errors were encountered: