-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Guide for writing AST transformers #218
Comments
No. There is no API like that on master yet. 🌹❤ |
Thanks for clearing that out! I thought microsoft/TypeScript#5595 means now it's possible to write AST transformers using TS API. Do you know the ticket that tracks that issue? |
For new syntax one needs additions to the parser + checker + emitter. The transformer only exist in the emitter.
Nope :( 🌹 |
I think this is the issue: microsoft/TypeScript#10786 |
@mohsen1 thanks. I've subscribed. But it is just pretty printing the AST, not rewriting it. You can get the AST today as well but then you have the write the complete emitter. That issues doesn't change that fact. You still can't plugin to the transformers 🌹 |
If my transformer output standard typescript ast then I should be able to use existing emitter. No? |
Yes. there is an |
Language service host to get custom transformer support : microsoft/TypeScript#13940 🌹 |
Here there are three working examples of using transformation API among other things: https://typescript-api-playground.glitch.me/. BTW you can modify the code and run it again, have intellisense, etc. ...like a TypeScript Compiler API Playground. I'm planning to put examples of different APis and libraries around TS compiler there hope it help newcomers - wouldn't be great to have similar tool to "describe" the API ? I've been inspired by monaco-editor playground which provided fast learning curve with its playground: https://microsoft.github.io/monaco-editor/playground.html |
Now that microsoft/TypeScript#5595 is done, I'm assuming there is new API in LS that allows writing TypeScript to TypeScrtipt syntax transformers. Right now I'm trying to figure out how to write an TS to TS transformer function
The text was updated successfully, but these errors were encountered: