{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9497","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9497/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9497/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9497/events","html_url":"https://github.com/Microsoft/TypeScript/issues/9497","id":163556866,"number":9497,"title":"Implement default parameters for NodeJS","user":{"login":"aleksey-pastuhov","id":11784219,"avatar_url":"https://avatars.githubusercontent.com/u/11784219?v=3","gravatar_id":"","url":"https://api.github.com/users/aleksey-pastuhov","html_url":"https://github.com/aleksey-pastuhov","followers_url":"https://api.github.com/users/aleksey-pastuhov/followers","following_url":"https://api.github.com/users/aleksey-pastuhov/following{/other_user}","gists_url":"https://api.github.com/users/aleksey-pastuhov/gists{/gist_id}","starred_url":"https://api.github.com/users/aleksey-pastuhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aleksey-pastuhov/subscriptions","organizations_url":"https://api.github.com/users/aleksey-pastuhov/orgs","repos_url":"https://api.github.com/users/aleksey-pastuhov/repos","events_url":"https://api.github.com/users/aleksey-pastuhov/events{/privacy}","received_events_url":"https://api.github.com/users/aleksey-pastuhov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-03T10:45:51Z","updated_at":"2016-07-03T19:22:10Z","closed_at":"2016-07-03T19:22:10Z","body":"**TypeScript Version:**  1.8.10\r\n**NodeJS LTS Version:**  4.4.7\r\n\r\nI 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.\r\n\r\n**TSConfig**\r\n\r\n```json\r\n{\r\n    \"compilerOptions\": {\r\n        \"target\": \"es6\",\r\n        \"module\": \"commonjs\"\r\n    }\r\n}\r\n```\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction foo(bar = 1) {\r\n    console.log(bar);\r\n}\r\nfoo();\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nOutput JS:\r\n```js\r\nfunction foo(bar) {\r\n    if (bar === void 0) { bar = 1; }\r\n    console.log(bar);\r\n}\r\nfoo();\r\n```\r\n\r\nDisplay **1** as output.\r\n\r\n**Actual behavior:** \r\n\r\nOutput JS:\r\n```js\r\nfunction foo(bar = 1) {\r\n    console.log(bar);\r\n}\r\nfoo();\r\n```\r\n\r\nRun this code with NodeJS (v5.7.0) and get the error:\r\n\r\n```\r\nfunction foo(bar = 1) {\r\n                          ^\r\n\r\nSyntaxError: Unexpected token =\r\n    at exports.runInThisContext (vm.js:53:16)\r\n    at Module._compile (module.js:387:25)\r\n    at Object.Module._extensions..js (module.js:422:10)\r\n    at Module.load (module.js:357:32)\r\n    at Function.Module._load (module.js:314:12)\r\n    at Function.Module.runMain (module.js:447:10)\r\n    at startup (node.js:141:18)\r\n    at node.js:933:3\r\n```\r\n\r\n**Assumption:**\r\n\r\nIt would be great to set default parameters values via `if` for NodeJS, in case that problem occurs on NodeJS LTS."}}
{"actor":{"display_login":"DanielRosenwasser"}}