{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2984","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2984/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2984/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2984/events","html_url":"https://github.com/Microsoft/TypeScript/issues/2984","id":72338716,"number":2984,"title":"HTMLCanvasElement.getContext('2d') incorrectly returns union type in 1.5 beta","user":{"login":"IanYates","id":1314477,"avatar_url":"https://avatars.githubusercontent.com/u/1314477?v=3","gravatar_id":"","url":"https://api.github.com/users/IanYates","html_url":"https://github.com/IanYates","followers_url":"https://api.github.com/users/IanYates/followers","following_url":"https://api.github.com/users/IanYates/following{/other_user}","gists_url":"https://api.github.com/users/IanYates/gists{/gist_id}","starred_url":"https://api.github.com/users/IanYates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanYates/subscriptions","organizations_url":"https://api.github.com/users/IanYates/orgs","repos_url":"https://api.github.com/users/IanYates/repos","events_url":"https://api.github.com/users/IanYates/events{/privacy}","received_events_url":"https://api.github.com/users/IanYates/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Fixed","name":"Fixed","color":"bfe5bf"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/lib.d.ts","name":"lib.d.ts","color":"c7def8"}],"state":"closed","locked":false,"assignee":{"login":"zhengbli","id":1171301,"avatar_url":"https://avatars.githubusercontent.com/u/1171301?v=3","gravatar_id":"","url":"https://api.github.com/users/zhengbli","html_url":"https://github.com/zhengbli","followers_url":"https://api.github.com/users/zhengbli/followers","following_url":"https://api.github.com/users/zhengbli/following{/other_user}","gists_url":"https://api.github.com/users/zhengbli/gists{/gist_id}","starred_url":"https://api.github.com/users/zhengbli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhengbli/subscriptions","organizations_url":"https://api.github.com/users/zhengbli/orgs","repos_url":"https://api.github.com/users/zhengbli/repos","events_url":"https://api.github.com/users/zhengbli/events{/privacy}","received_events_url":"https://api.github.com/users/zhengbli/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/10","html_url":"https://github.com/Microsoft/TypeScript/milestones/TypeScript%201.5.2","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/10/labels","id":1081230,"number":10,"title":"TypeScript 1.5.2","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"open_issues":26,"closed_issues":5,"state":"open","created_at":"2015-04-23T20:46:41Z","updated_at":"2015-05-02T01:00:05Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-05-01T02:43:50Z","updated_at":"2015-05-02T04:03:46Z","closed_at":"2015-05-01T22:08:21Z","body":"I've got a bunch of TypeScript code that calls `getContext('2d')` on HTML canvas elements.\r\n\r\nSince the update to 1.5 beta this morning I now get a union type of `CanvasRenderingContext2D` and `WebGLRenderingContext`.  That makes sense for the general call to getContext(...) since either could be returned.\r\n\r\nHowever if I'm specifically calling `getContext('2d')`, I know I'm getting back a `CanvasRenderingcontext2D`.\r\nI worked around it by creating this little interface in a file\r\n```\r\ninterface HTMLCanvasElement {\r\n    getContext(contextId: '2d'): CanvasRenderingContext2D;\r\n}\r\n```\r\n(using syntax from `section 3.8.2.4 - Specialized Signatures` in the TypeScript language reference)\r\n\r\nCould we get this added to lib.d.ts perhaps?\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/98299592","html_url":"https://github.com/Microsoft/TypeScript/issues/2984#issuecomment-98299592","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2984","id":98299592,"user":{"login":"Sharpiro","id":9012043,"avatar_url":"https://avatars.githubusercontent.com/u/9012043?v=3","gravatar_id":"","url":"https://api.github.com/users/Sharpiro","html_url":"https://github.com/Sharpiro","followers_url":"https://api.github.com/users/Sharpiro/followers","following_url":"https://api.github.com/users/Sharpiro/following{/other_user}","gists_url":"https://api.github.com/users/Sharpiro/gists{/gist_id}","starred_url":"https://api.github.com/users/Sharpiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sharpiro/subscriptions","organizations_url":"https://api.github.com/users/Sharpiro/orgs","repos_url":"https://api.github.com/users/Sharpiro/repos","events_url":"https://api.github.com/users/Sharpiro/events{/privacy}","received_events_url":"https://api.github.com/users/Sharpiro/received_events","type":"User","site_admin":false},"created_at":"2015-05-02T04:03:46Z","updated_at":"2015-05-02T04:03:46Z","body":"i replaced the old lib.d.ts with the one you posted.  Looks like it now successfully builds.  However, Visual Studio is still displaying it as an error, which will be too annoying to deal with."}}