-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Add a way to get a typed AST #16692
Comments
You can access the AST, including all the types, via the language services, and you can then in theory emit whatever you wanted. |
Now, that's interesting. Can you think of any online source that to recommend on accessing the AST through the language services? |
This has the best official examples, but yes, the documentation is not overly strong. Taking a look at vscode's integration can be helpful as well as tslint has integration to the language services as well. |
Thanks! |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
I understand that TypeScript is not intented to be compiled to eg. asm.js or C/C++, but the ability to export a language like Flow or TypeScript to typed AST in some way or another would allow another team of developers to use that as a basis for "TypeScript to C/C++", "TypeScript to asm.js" or "TypeScript to whatever" conversions, as suggested in this issue for Flow.
The short term benefit would obviously be small, but the large term benefit would be quite significant, as it would basically provide a pluggable interface that allows (subsets of?) TypeScript to be converted to any language that is sufficiently compatible. In theory, it would allow TypeScript - when combined with third party plug-ins" - to be used as some kind of "convert to anything" kind of language, which is what many people are trying to use JavaScript for but for which JavaScript (due to the lack of static typing) happens to be less suitable than TypeScript or Flow. And this, with - I imagine - little effort from the TypeScript core devs, as exporting the typed AST that is used internally would be all they would have to do to make this possible.
Is there any chance you might consider exporting the typed AST?
The text was updated successfully, but these errors were encountered: