clausreinke / typescript-tools

(repo no longer active) Tools related to the TypeScript language
Apache License 2.0
266 stars 29 forks source link

add support for getEmitOutput #43

Open clausreinke opened 9 years ago

clausreinke commented 9 years ago

moved from #39, suggested by @Phaiax:

Hey. I just looked at the last example here: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API

The LanguageService Object has a function called getEmitOutput. One could use the already parsed code tree to compile (hopefully) faster. This would need a new command for tss.js and the ability to configure the CompilerOptions via tss.js. (settings source maps, ecma target, ...).

I've looked at the TypeScript source and at your changes and I think I could even implement it by myself, if you think this is a good idea and you do not want to do the work.

What do you think?

clausreinke commented 9 years ago

Adding support for single-file getEmitOutput itself should be simple, but adding full tsc project functionality to typescript-tools would be more involved, and more than I'm willing to commit to at this point (needs to be supported later, not just implemented once; also, running the compiler once I'm happy with the code hasn't been a problem for me, so far - I usually want to run tests right after, so I need a separate build setup anyway, and the compile itself hasn't been a time blocker).

I've thought about adding emit support from time to time, to check how advanced features are compiled to JS, or to see whether comments make it through as expected. Mostly, it has been made redundant by TS progress/bug fixes, but if others think it will be more than a curiosity, I'll add it.

Configuration support is a different matter, and something I will definitely need to address - after TSv1.4 support is live and fixed. I'll open a separate ticket.