How to run TypeScript files from command line?

前端 未结 13 1494
死守一世寂寞
死守一世寂寞 2020-11-27 10:13

I\'m having a surprisingly hard time finding an answer to this. With plain Node.JS, you can run any js file with node path/to/file.js, with CoffeeScript it\'s <

13条回答
  •  没有蜡笔的小新
    2020-11-27 10:35

    To add to @Aamod answer above, If you want to use one command line to compile and run your code, you can use the following:

    Windows:

    tsc main.ts | node main.js
    

    Linux / macOS:

    tsc main.ts && node main.js
    

提交回复
热议问题