-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Typescript Custom Transformers Support #3354
Comments
Sadly, it's actually not possible to use the TypeScript compiler from Deno currently. |
Now that the compiler is exposed, any plans to support transformers or getting the AST? |
The TypeScript team have resisted making a public API for custom transformers. Though there are a few established patterns for using custom transformers. The biggest "fear" is people doing things they later regret. There have been quite a few early stage TC39 proposals that people have built Babel plugins for, but the syntax ends up going another direction (e.g. pipeline operator) and then people have loads of code that they have to plug holes in. So for me I would really like to understand the use case before we did something that the TypeScript compiler doesn't officially support. I real don't want to arm people to shoot themselves in the foot. As far as the AST, the TypeScript AST is really hard to expose. We plan to expose it in a different way, via swc, which is an estree type of AST, and much easier to work with. See #3983 and #2355. |
Thank you @kitsonk, appreciate the very informative response. (FYI, my motivation is runtime input validation based on TypeScript interfaces, for which either transformers or AST would suffice. Right now I'm using Runtypes but that doesn't work with vanilla TS interfaces. But likely I can just use some other parser such as buntis even if Deno does not have one built-in). |
We will be exposing the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
any chance we can move this to a github discussion? I think its still an important topic. It is likely going to be a long-lived topic though, as the upstream typescript team hasnt come up with a final answer on this yet either |
GitHub has disabled the transfer of issues to discussions be cause it is buggy. It will be reintroduced soon. I still doubt this is going to be actionable any time soon, and even if there was pluggable transform support for TypeScript, I doubt we would incorporate it into Deno, as we have moved emitting over mostly to swc and will eventually move all of it, and we want consistency and predictability in how Deno emits TypeScript. There is the long term roadmap of custom compilers, which maybe the way of this. So while I appreciate the thoughts, I am going to respectfully close this as declined, at least for the foreseeable future. |
got it thanks. If there is an issue tracking the custom compiler work can you link it? |
TS will probably soon be getting custom transformer support: microsoft/TypeScript#54278 |
I've been looking through issues and I've not seen anything to this affect.
Will there be support for Typescript's Custom Transformers? I generally make heavy use of them as a framework/library author.
The text was updated successfully, but these errors were encountered: