denoland / deno_emit

Transpile and bundle JavaScript and TypeScript under Deno and Deno Deploy
https://jsr.io/@deno/emit
MIT License
222 stars 23 forks source link

Option to type check TypeScript? #130

Open jflatow opened 1 year ago

jflatow commented 1 year ago

How difficult would it be to add a compiler option to check TypeScript input code? If reasonable, I wouldn't mind taking a stab at adding it myself.

jflatow commented 1 year ago

Ok interesting, I took a peek and it looks like swc which is used in this module doesn't support type-checking, so it would have to go through an alternate path of either trying to use deno::tsc (not sure if this is exposed) or potentially stc. I expect it would only make sense to use the same method that deno uses itself, which is through the deno::tsc (https://github.com/denoland/deno/blob/main/cli/tools/check.rs#L136).

yacinehmito commented 1 year ago

In any case, a programmatic API to perform type-checking with Deno probably wouldn't be part of deno_emit.

And if you need to do it right now as a replacement for deno bundle, then deno check works.

jflatow commented 1 year ago

😞 The compiler runtime API was nice. I thought the idea was to move that out of core into a separate library and that was deno_emit. It seems the natural place for such an option, and indeed Deno.emit used to support it...