节点无法运行编译TypeScript

我有以下TypeScript

var foo = (...myParams) => { for (var i = 0; i < myParams.length; i++){ console.log(myParams[i] + " "); } }; foo('a', 'b', 'c'); 

但是,当编译的WebStorm在编译代码中发现错误时:

WebStorm错误

而当它由节点符文时,节点不会识别其余的expression式。

 C:\PluralSight\TypeScript>node rest-parameter.js C:\PluralSight\TypeScript\rest-parameter.js:5 var foo = (...myParams) => { ^^^ SyntaxError: Unexpected token ... at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:414:25) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12) at Function.Module.runMain (module.js:467:10) at startup (node.js:136:18) at node.js:963:3 

作为关于节点的附注。

它支持5.x版本中的其余参数。 它们不是默认启用的,除此之外还有很多其他的es6好东西。

要使它们能够使用--harmony参数运行节点,或者如果某些function仍在工作中,请使用相应的标志明确启用它们。 例如:

 node --harmony --harmony_default_parameters app.js 

使用以下命令查看所有这些“进行中”的:

 node --v8-options | grep 'in progress'