{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12847","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12847/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12847/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12847/events","html_url":"https://github.com/Microsoft/TypeScript/issues/12847","id":194933496,"number":12847,"title":"Generic function does not determine type with strictNullChecks ","user":{"login":"anvish","id":1114090,"avatar_url":"https://avatars.githubusercontent.com/u/1114090?v=3","gravatar_id":"","url":"https://api.github.com/users/anvish","html_url":"https://github.com/anvish","followers_url":"https://api.github.com/users/anvish/followers","following_url":"https://api.github.com/users/anvish/following{/other_user}","gists_url":"https://api.github.com/users/anvish/gists{/gist_id}","starred_url":"https://api.github.com/users/anvish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anvish/subscriptions","organizations_url":"https://api.github.com/users/anvish/orgs","repos_url":"https://api.github.com/users/anvish/repos","events_url":"https://api.github.com/users/anvish/events{/privacy}","received_events_url":"https://api.github.com/users/anvish/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-12T10:04:25Z","updated_at":"2016-12-12T10:04:25Z","closed_at":null,"body":"<!-- BUGS: Please use this template. -->\r\n<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:**  2.1.4\r\n\r\n**Code**\r\n```ts\r\ntype I = { kind: 'I1' }\r\n\r\ntype A<T> = [undefined, I] | [T, I]\r\n\r\nfunction works<T>(): A<T> {\r\n    return [undefined, { kind: 'I1' }]\r\n}\r\n\r\nfunction doesNotWork<T>(): A<T> {\r\n    const i = { kind: 'I1' }\r\n    return [undefined, i]\r\n    // [ts] Type '[undefined, { kind: string; }]' is not assignable to type 'A<T>'.\r\n    //     Type '[undefined, { kind: string; }]' is not assignable to type '[T, I]'.\r\n    //         Type 'undefined' is not assignable to type 'T'.\r\n}\r\n```\r\n**Expected behavior:**\r\nBoth functions compile\r\n**Actual behavior:**\r\nExtracting variable breaks type detection"}}
{"actor":{"display_login":"anvish"}}