简体   繁体   中英

At what stage does Typescript actually do compilation?

I'm reading that Typescript code is compiled in order to check types etc. Whenever I've written Typescript code, it seems to operate exactly like Javascript except that it checks types as you type code. I know that Javascript is not compiled. So my question is:

Does Typescript do continuous compilation as you type code, where Javascript does not do compilation at all? If not, where/when/how does Typescript code get compiled?

Thanks!

Typescript is not compiled. It is transpiled into Javascript.

Does Typescript do continuous compilation as you type code, where Javascript does not do compilation at all?

No, and no.

If not, where/when/how does Typescript code get compiled?

When you run the tsc command in the console (or if you run your buildsystem, eg Webpack) it compiles (well, strictly speaking transpiles ) Typescript into JS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM