Use TypeScript compiler from node

后端 未结 6 1699
既然无缘
既然无缘 2021-02-02 17:30

It\'s pretty easy to do this with coffee-script.

var coffee = require(\'coffee-script\');
coffee.compile(\"a = 1\");
//=> \'(function() {\\n  var a;\\n\\n  a          


        
6条回答
  •  面向向阳花
    2021-02-02 17:51

    Not answering the question directly, but since Googling for "run TypeScript from node directly" brings up this StackOverflow page, I figure I should add that you're able to do this with ts-node: https://github.com/TypeStrong/ts-node

提交回复
热议问题