[英]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 个(
tsc
和node
)
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.