You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project, which I write for NodeJS. I use async/await so there is need to set tartget: es6. But when I wrote function(or lamba) with default parameter value, compiler work well, but NodeJS gave me an error.
Run this code with NodeJS (v5.7.0) and get the error:
function foo(bar = 1) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:141:18)
at node.js:933:3
Assumption:
It would be great to set default parameters values via if for NodeJS, in case that problem occurs on NodeJS LTS.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 1.8.10
NodeJS LTS Version: 4.4.7
I have a project, which I write for NodeJS. I use
async/await
so there is need to set tartget: es6. But when I wrote function(or lamba) with default parameter value, compiler work well, but NodeJS gave me an error.TSConfig
Code
Expected behavior:
Output JS:
Display 1 as output.
Actual behavior:
Output JS:
Run this code with NodeJS (v5.7.0) and get the error:
Assumption:
It would be great to set default parameters values via
if
for NodeJS, in case that problem occurs on NodeJS LTS.The text was updated successfully, but these errors were encountered: