简体   繁体   English

如何仅使用 1 个命令编译和执行打字稿文件?

[英]How to compile and execute typescript files using 1 command only?

I know that TS is converted to JS using tsc我知道 TS 使用tsc转换为 JS

Then after we get .js , we execute the .js file using node .然后在我们得到.js之后,我们使用node执行.js文件。

These are 2 steps in order to execute a .ts file这些是执行.ts文件的 2 个步骤

My question is, how to do it in 1 step?我的问题是,如何一步完成? (like one command instead of 2( tsc and node ) (就像一个命令而不是 2 个( tscnode

You can use ts-node which will run ts files.您可以使用ts-node来运行 ts 文件。

https://www.npmjs.com/package/ts-node https://www.npmjs.com/package/ts-node

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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