简体   繁体   English

有没有办法在命令行上运行 TypeScript?

[英]Is there a way to run TypeScript on the command line?

I know that I can run JavaScript by running node through the command line, but is there a way to play around with TypeScript on the command line?我知道我可以通过命令行运行节点来运行 JavaScript,但是有没有办法在命令行上使用 TypeScript? Or must I use a text editor?还是我必须使用文本编辑器?

If you install ts-node for a project, you can then run it directly by typing in npx ts-node .如果为项目安装 ts-node,则可以通过键入npx ts-node直接运行它。 It works similarly to Node's REPL.它的工作方式类似于 Node 的 REPL。

在此处输入图像描述

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

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