How to run TypeScript files from command line?

前端 未结 13 1497
死守一世寂寞
死守一世寂寞 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:44

    1. Install ts-node node module globally.
    2. Create node runtime configuration (for IDE) or use node in command line to run below file js file (The path is for windows, but you can do it for linux as well) ~\AppData\Roaming\npm\node_modules\ts-node\dist\bin.js
    3. Give your ts file path as a command line argument.
    4. Run Or Debug as you like.

提交回复
热议问题