{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5523","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5523/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5523/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5523/events","html_url":"https://github.com/Microsoft/TypeScript/issues/5523","id":115040037,"number":5523,"title":"type checking after instainceOf condition in else block is working incorrectly","user":{"login":"stepancar","id":2854910,"avatar_url":"https://avatars.githubusercontent.com/u/2854910?v=3","gravatar_id":"","url":"https://api.github.com/users/stepancar","html_url":"https://github.com/stepancar","followers_url":"https://api.github.com/users/stepancar/followers","following_url":"https://api.github.com/users/stepancar/following{/other_user}","gists_url":"https://api.github.com/users/stepancar/gists{/gist_id}","starred_url":"https://api.github.com/users/stepancar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stepancar/subscriptions","organizations_url":"https://api.github.com/users/stepancar/orgs","repos_url":"https://api.github.com/users/stepancar/repos","events_url":"https://api.github.com/users/stepancar/events{/privacy}","received_events_url":"https://api.github.com/users/stepancar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-04T12:14:27Z","updated_at":"2015-11-04T17:28:08Z","closed_at":null,"body":"[see example in playground](http://www.typescriptlang.org/Playground#src=interface%20IFoo%20%7B%0D%0A%09value%3A%20string%5B%5D%7Cstring%3B%0D%0A%7D%0D%0A%0D%0Afunction%20bar(options%3A%20IFoo)%20%7B%0D%0A%09var%20val%20%3D%20options.value%3B%0D%0A%09var%20result%3A%20string%3B%0D%0A%09if%20(val%20instanceof%20Array)%20%7B%0D%0A%09%09result%20%3D%20val.join('')%0D%0A%09%7D%20else%20%7B%0D%0A%09%09result%20%3D%20val%3B%0D%0A%09%7D%0D%0A%7D)\r\n``` javascript\r\ninterface IFoo {\r\n\tvalue: string[]|string;\r\n}\r\n\r\nfunction bar(options: IFoo) {\r\n\tvar val = options.value;\r\n\tvar result: string;\r\n\tif (val instanceof Array) {\r\n\t\tresult = val.join('')\r\n\t} else {\r\n\t\tresult = val;\r\n\t}\r\n}\r\n```\r\nval has one of two types strting[] or string\r\nin 'if' condition checked instanceofArray\r\nin else statement compiler should know that val has string type\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/153800436","html_url":"https://github.com/Microsoft/TypeScript/issues/5523#issuecomment-153800436","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5523","id":153800436,"user":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T17:28:08Z","updated_at":"2015-11-04T17:28:08Z","body":"#5442 should fix this, I think."}}