{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6589","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6589/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6589/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6589/events","html_url":"https://github.com/Microsoft/TypeScript/issues/6589","id":128324946,"number":6589,"title":"Narrowing does not work with `instanceof` operator and type parameters","user":{"login":"falsandtru","id":3143368,"avatar_url":"https://avatars.githubusercontent.com/u/3143368?v=3","gravatar_id":"","url":"https://api.github.com/users/falsandtru","html_url":"https://github.com/falsandtru","followers_url":"https://api.github.com/users/falsandtru/followers","following_url":"https://api.github.com/users/falsandtru/following{/other_user}","gists_url":"https://api.github.com/users/falsandtru/gists{/gist_id}","starred_url":"https://api.github.com/users/falsandtru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falsandtru/subscriptions","organizations_url":"https://api.github.com/users/falsandtru/orgs","repos_url":"https://api.github.com/users/falsandtru/repos","events_url":"https://api.github.com/users/falsandtru/events{/privacy}","received_events_url":"https://api.github.com/users/falsandtru/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/By%20Design","name":"By Design","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-01-23T12:13:30Z","updated_at":"2016-01-25T05:17:49Z","closed_at":null,"body":"```ts\r\nclass A<T> {\r\n\tprivate x: number;\r\n\tpublic m(p: T): T {\r\n\t\treturn p;\r\n\t}\r\n}\r\nclass B extends A<string> {\r\n\tprivate y: number;\r\n}\r\nvar a: A<number> | B;\r\nif (a instanceof B) {\r\n\ta.m(''); // `a` is `B`\r\n}\r\nif (a instanceof A) {\r\n\ta.m(1); // `a` is `A<number> | B`, should be `A<number>`\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/174406263","html_url":"https://github.com/Microsoft/TypeScript/issues/6589#issuecomment-174406263","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6589","id":174406263,"user":{"login":"falsandtru","id":3143368,"avatar_url":"https://avatars.githubusercontent.com/u/3143368?v=3","gravatar_id":"","url":"https://api.github.com/users/falsandtru","html_url":"https://github.com/falsandtru","followers_url":"https://api.github.com/users/falsandtru/followers","following_url":"https://api.github.com/users/falsandtru/following{/other_user}","gists_url":"https://api.github.com/users/falsandtru/gists{/gist_id}","starred_url":"https://api.github.com/users/falsandtru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falsandtru/subscriptions","organizations_url":"https://api.github.com/users/falsandtru/orgs","repos_url":"https://api.github.com/users/falsandtru/repos","events_url":"https://api.github.com/users/falsandtru/events{/privacy}","received_events_url":"https://api.github.com/users/falsandtru/received_events","type":"User","site_admin":false},"created_at":"2016-01-25T05:17:49Z","updated_at":"2016-01-25T05:17:49Z","body":"At least,\r\n\r\n```ts\r\nclass A<T> {\r\n    prop: T;\r\n}\r\n\r\nclass B<T> extends A<T> {\r\n}\r\n\r\nclass C extends A<any> {\r\n}\r\n\r\nvar x: A<string> | B<string> | C;\r\nif (x instanceof A) {\r\n    x; // x is C, not A\r\n}\r\n```\r\n\r\nThis type resolving is very odd."}}