最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why is ts-node not compiling typescript file? - Stack Overflow

programmeradmin1浏览0评论

Why is ts-node not piling and executing typescript file? It is used in terminal like "ts-node scriptfile" It just returns a blank line. What is wrong? Thanks for the help.

Why is ts-node not piling and executing typescript file? It is used in terminal like "ts-node scriptfile" It just returns a blank line. What is wrong? Thanks for the help.

Share Improve this question edited Jun 27, 2019 at 23:11 Pyjs asked Jun 27, 2019 at 22:47 PyjsPyjs 1092 silver badges4 bronze badges 4
  • I'm assuming you are using this so you should run ts-node <script> – EDToaster Commented Jun 27, 2019 at 22:52
  • That is exactly the way I'm using ts-node <script> – Pyjs Commented Jun 27, 2019 at 23:10
  • Do you have a tsconfig file setup? – LJD Commented Jun 27, 2019 at 23:13
  • No tsconfig file, where and how do I set it up? But when input files are specified on the mand line, tsconfig.json files are ignored anyway. – Pyjs Commented Jun 27, 2019 at 23:18
Add a ment  | 

1 Answer 1

Reset to default 8

ts-node is a typescript executor, not a piler. If you run npx ts-node script.ts it will execute as typescript, without piling.

To generate a piled js file, try tsc script.ts.

发布评论

评论列表(0)

  1. 暂无评论