{"action":"created","issue":{"url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/15","labels_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/15/comments","events_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/15/events","html_url":"https://github.com/codemix/babel-plugin-typecheck/issues/15","id":102642764,"number":15,"title":"Invalid Syntax When using Default Values for Paramters","user":{"login":"killercup","id":20063,"avatar_url":"https://avatars.githubusercontent.com/u/20063?v=3","gravatar_id":"","url":"https://api.github.com/users/killercup","html_url":"https://github.com/killercup","followers_url":"https://api.github.com/users/killercup/followers","following_url":"https://api.github.com/users/killercup/following{/other_user}","gists_url":"https://api.github.com/users/killercup/gists{/gist_id}","starred_url":"https://api.github.com/users/killercup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killercup/subscriptions","organizations_url":"https://api.github.com/users/killercup/orgs","repos_url":"https://api.github.com/users/killercup/repos","events_url":"https://api.github.com/users/killercup/events{/privacy}","received_events_url":"https://api.github.com/users/killercup/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-23T18:07:36Z","updated_at":"2015-08-23T21:18:42Z","closed_at":null,"body":"I guess I just found a weird corner case. Using [default parameter values](http://babeljs.io/docs/learn-es2015/#default-rest-spread) with types generates invalid syntax.\r\n\r\n```js\r\nfunction lol(settings={}: Object) {}\r\nlol({x: 1})\r\n```\r\n\r\nbecomes:\r\n\r\n```js\r\n\"use strict\";\r\n\r\nfunction lol() {\r\n  var settings = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\r\n  if (typeof settings = {} !== \"object\") throw new TypeError(\"Value of argument 'undefined' violates contract, expected object got \" + (settings = {} === null ? \"null\" : settings = {} instanceof Object && settings = {}.constructor ? settings = {}.constructor.name : typeof settings = {}));\r\n}\r\nlol({ x: 1 });\r\n```\r\n\r\nwhich doesn't work because:\r\n\r\n```text\r\n/…/stack.es5.js:5\r\n  if (typeof settings = {} !== \"object\") throw new TypeError(\"Value of argumen\r\n  ^\r\nReferenceError: Invalid left-hand side in assignment\r\n    at lol (/…/stack.es5.js:5:3)\r\n    at Object.<anonymous> (/…/stack.es5.js:7:1)\r\n    at Module._compile (module.js:456:26)\r\n    at Object.Module._extensions..js (module.js:474:10)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:312:12)\r\n    at Function.Module.runMain (module.js:497:10)\r\n    at startup (node.js:119:16)\r\n    at node.js:935:3\r\n```"},"comment":{"url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/comments/133938835","html_url":"https://github.com/codemix/babel-plugin-typecheck/issues/15#issuecomment-133938835","issue_url":"https://api.github.com/repos/codemix/babel-plugin-typecheck/issues/15","id":133938835,"user":{"login":"phpnode","id":363611,"avatar_url":"https://avatars.githubusercontent.com/u/363611?v=3","gravatar_id":"","url":"https://api.github.com/users/phpnode","html_url":"https://github.com/phpnode","followers_url":"https://api.github.com/users/phpnode/followers","following_url":"https://api.github.com/users/phpnode/following{/other_user}","gists_url":"https://api.github.com/users/phpnode/gists{/gist_id}","starred_url":"https://api.github.com/users/phpnode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpnode/subscriptions","organizations_url":"https://api.github.com/users/phpnode/orgs","repos_url":"https://api.github.com/users/phpnode/repos","events_url":"https://api.github.com/users/phpnode/events{/privacy}","received_events_url":"https://api.github.com/users/phpnode/received_events","type":"User","site_admin":false},"created_at":"2015-08-23T21:18:42Z","updated_at":"2015-08-23T21:18:42Z","body":"hmm that's weird, I've actually not seen that syntax, I've been using:\r\n```js\r\nfunction lol (settings: Object = {}) {}\r\n```"}}