Ich habe folgendes TyposkriptKnoten nicht in der Lage zu laufen kompiliert Typoskript
var foo = (...myParams) => {
for (var i = 0; i < myParams.length; i++){
console.log(myParams[i] + " ");
}
};
foo('a', 'b', 'c');
jedoch, wenn es kompiliert von WebStorm Fehler im kompilierten Code findet:
und wenn es Rune von Knoten , Knoten erkennt den Restausdruck nicht.
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
http://kangax.github.io/compat-table/es6/ –
@squint Coole Verbindung. Node unterstützt sie einfach nicht. C'est la vive. – BanksySan
@BanksySan, wenn Sie Typoskript in [Ziel ES5] ändern (https://www.typescriptlang.org/docs/handbook/compiler-options.html) wird es funktionieren –