benjamn / ast-types

Esprima-compatible implementation of the Mozilla JS Parser API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript support

Pajn opened this issue · comments

Hello!
There is an ongoing effort to add TypeScript support to prettier. To do this, typescript-eslint-parser is used to convert the AST from TypeScript into an estree compatible format. Due to some additional syntax, additional node types is required. It would be awesome to collect those here.

I have started defining some of them here. So I opened this issue to check with you first, if you are interested in integrating this at all and secondly, how to handle the development process.
To not create to big PRs and ease collaboration it would be great to integrate often which mean that these types will be extended and may see some churn until things stabilize. Should I hold off sending these to you now and instead include them in the prettier PR so that they can move from there at a later point in time or do you prefer to keep the development here?

Please feel free to open a WIP pull request with these changes, and push to it as you add more types. Thanks for working on this!

I would love to support the full un-converted TypeScript AST at some point, but that's obviously a lot more work.

Disclaimer: I am fairly far out of my knowledge zone here - but I am trying to add Typescript support to the feathers-cli whihc is dependant on this and in turn dependant on recast.

However, two thoughts,

  1. Can we not use the TypeScript's compiler API which has AST support, or at least see the sourcecode for the API?

  2. How about using he tscodeshift project as a startign point for AST definitons for TypeScript?

Appologies if I have missunderstood what is required here.