有没有办法在命令行上运行 TypeScript?
我知道我可以通过命令行运行 Node 来运行 JavaScript,但是有没有办法在命令行上使用 TypeScript 呢?或者我必须使用文本编辑器?
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? Or must I use a text editor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您为项目安装了 ts-node,则可以通过输入
npx ts-node
直接运行它。它的工作原理与 Node 的 REPL 类似。If you install ts-node for a project, you can then run it directly by typing in
npx ts-node
. It works similarly to Node's REPL.