I have the following TypeScript
var foo = (...myParams) => {
for (var i = 0; i < myParams.length; i++){
console.log(myParams[i] + " ");
}
};
foo('a', 'b', 'c');
However, when it's compiled by WebStorm finds errors in the compiled code:
and when it's rune by Node, Node doesn't recognise the rest 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

"target": "ES5"under"compilerOptions". WebStorm should support that.