Skip to content
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

Closed
arciisine opened this issue Nov 15, 2019 · 11 comments
Closed

Typescript Custom Transformers Support #3354

arciisine opened this issue Nov 15, 2019 · 11 comments
Labels
declined thank you, but respectfully declined

Comments

@arciisine
Copy link

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.

@ry
Copy link
Member

ry commented Nov 15, 2019

Sadly, it's actually not possible to use the TypeScript compiler from Deno currently.

denoland/std#428
#2927

@jakajancar
Copy link

Now that the compiler is exposed, any plans to support transformers or getting the AST?

@kitsonk
Copy link
Contributor

kitsonk commented Mar 24, 2020

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.

@jakajancar
Copy link

jakajancar commented Mar 24, 2020

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).

@kitsonk
Copy link
Contributor

kitsonk commented Mar 24, 2020

We will be exposing the swc AST as a userland API. It is compatible with the likes of buntis (last time I checked I couldn't get buntis to run under Deno, but I didn't try too hard), but it will be significantly faster.

@stale
Copy link

stale bot commented Jan 6, 2021

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.

@stale stale bot added the stale label Jan 6, 2021
@andykais
Copy link

andykais commented Jan 6, 2021

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

@stale stale bot removed the stale label Jan 6, 2021
@kitsonk kitsonk added the declined thank you, but respectfully declined label Jan 6, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Jan 6, 2021

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.

@kitsonk kitsonk closed this as completed Jan 6, 2021
@andykais
Copy link

andykais commented Jan 7, 2021

got it thanks. If there is an issue tracking the custom compiler work can you link it?

@kitsonk
Copy link
Contributor

kitsonk commented Jan 7, 2021

@andykais #1739

@kuchta
Copy link

kuchta commented Nov 26, 2023

TS will probably soon be getting custom transformer support: microsoft/TypeScript#54278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
declined thank you, but respectfully declined
Projects
None yet
Development

No branches or pull requests

6 participants