{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10311","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10311/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10311/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10311/events","html_url":"https://github.com/Microsoft/TypeScript/issues/10311","id":170982063,"number":10311,"title":"Union types behaviour bug?","user":{"login":"bartq","id":211570,"avatar_url":"https://avatars.githubusercontent.com/u/211570?v=3","gravatar_id":"","url":"https://api.github.com/users/bartq","html_url":"https://github.com/bartq","followers_url":"https://api.github.com/users/bartq/followers","following_url":"https://api.github.com/users/bartq/following{/other_user}","gists_url":"https://api.github.com/users/bartq/gists{/gist_id}","starred_url":"https://api.github.com/users/bartq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartq/subscriptions","organizations_url":"https://api.github.com/users/bartq/orgs","repos_url":"https://api.github.com/users/bartq/repos","events_url":"https://api.github.com/users/bartq/events{/privacy}","received_events_url":"https://api.github.com/users/bartq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-13T00:18:08Z","updated_at":"2016-08-13T00:42:07Z","closed_at":null,"body":"**TypeScript Version:**   2.1.0-dev.20160723\r\n\r\n**Code**\r\n\r\n```ts\r\n// A *self-contained* demonstration of the problem follows...\r\nexport type WebSocketMessage = {type: 'userInfo'} | {type: 'chat'};\r\nexport let WSSend = (ws: WebSocket, message: WebSocketMessage) => {\r\n};\r\n\r\nlet ws = new WebSocket('');\r\nlet message = {type: 'chat'};\r\nWSSend(ws, message);\r\n```\r\n\r\n**Expected behavior:**\r\nNo error. Noticed though that it passes:\r\n```ts\r\nexport type WebSocketMessage = {type: 'userInfo'} | {type: 'chat'};\r\nexport let WSSend = (ws: WebSocket, message: WebSocketMessage) => {\r\n};\r\n\r\nlet ws = new WebSocket('');\r\n//let message = {type: 'chat'};\r\nWSSend(ws, {type: 'chat'});\r\n```\r\n\r\n**Actual behavior:** \r\n```\r\nError:(13, 12) TS2345:Argument of type '{ type: string; }' is not assignable to parameter of type '{ type: \"userInfo\"; } | { type: \"chat\"; }'.\r\n  Type '{ type: string; }' is not assignable to type '{ type: \"chat\"; }'.\r\n    Types of property 'type' are incompatible.\r\n      Type 'string' is not assignable to type '\"chat\"'.\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/239590826","html_url":"https://github.com/Microsoft/TypeScript/issues/10311#issuecomment-239590826","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10311","id":239590826,"user":{"login":"bartq","id":211570,"avatar_url":"https://avatars.githubusercontent.com/u/211570?v=3","gravatar_id":"","url":"https://api.github.com/users/bartq","html_url":"https://github.com/bartq","followers_url":"https://api.github.com/users/bartq/followers","following_url":"https://api.github.com/users/bartq/following{/other_user}","gists_url":"https://api.github.com/users/bartq/gists{/gist_id}","starred_url":"https://api.github.com/users/bartq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartq/subscriptions","organizations_url":"https://api.github.com/users/bartq/orgs","repos_url":"https://api.github.com/users/bartq/repos","events_url":"https://api.github.com/users/bartq/events{/privacy}","received_events_url":"https://api.github.com/users/bartq/received_events","type":"User","site_admin":false},"created_at":"2016-08-13T00:42:06Z","updated_at":"2016-08-13T00:42:06Z","body":"yeah, but IMO it should work as users would expect, which is no error without additional syntax. If it's not planned to be implemented at all, let's close the issue."}}
{"actor":{"display_login":"bartq"}}