{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5529","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5529/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5529/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5529/events","html_url":"https://github.com/Microsoft/TypeScript/issues/5529","id":115120606,"number":5529,"title":"union with type parameters.","user":{"login":"co-dh","id":860977,"avatar_url":"https://avatars.githubusercontent.com/u/860977?v=3","gravatar_id":"","url":"https://api.github.com/users/co-dh","html_url":"https://github.com/co-dh","followers_url":"https://api.github.com/users/co-dh/followers","following_url":"https://api.github.com/users/co-dh/following{/other_user}","gists_url":"https://api.github.com/users/co-dh/gists{/gist_id}","starred_url":"https://api.github.com/users/co-dh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/co-dh/subscriptions","organizations_url":"https://api.github.com/users/co-dh/orgs","repos_url":"https://api.github.com/users/co-dh/repos","events_url":"https://api.github.com/users/co-dh/events{/privacy}","received_events_url":"https://api.github.com/users/co-dh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-04T18:45:03Z","updated_at":"2015-11-04T22:38:26Z","closed_at":null,"body":"I noticed that union with type parameters resolved type variable too agressively.\r\n```\r\nvar csv: Dsv;\r\ntype Dict<T> = { [key: string]: T };\r\ntype S= Dict<string>;\r\ntype DsvAccessor<T> = (rows: S[], index?: number)=> T ;\r\ninterface DsvCallback<T>{\r\n    (rows: T[]): void;\r\n    (error: any, rows: T[]): void;\r\n}\r\ninterface Dsv {\r\n       (url: string, accessor?: DsvAccessor<S|void>, callback?: DsvCallback<S>): DsvXhr<S>;\r\n    <T>(url: string, accessor?: DsvAccessor<T|void>, callback?: DsvCallback<T>): DsvXhr<T>;\r\n\r\n}\r\n\r\ninterface DsvXhr<T> {\r\n}\r\n\r\ninterface Data{\r\n    a: number;\r\n}\r\nfunction f1(d, i){ }\r\nfunction f2(d, i){ return {a:'a'} }\r\n\r\ncsv('', f1, function(a){})\r\ncsv('', f2, function(a){})\r\n\r\nfunction f3(d: S[]){}\r\nfunction f4(d: S[]){ return {a: 0}}\r\ncsv('', f3, function(a:S[]){})\r\ncsv('', f4, function(a:S[]){})\r\n```\r\nThe non generic version types fine, while the generic version gives the following error:\r\n```\r\ntest.tsx(31,13): error TS2345: Argument of type '(a: { [key: string]: string; }[]) => void' is not assignable to parameter of type 'DsvCallback<{ a: number; }>'.\r\n  Types of parameters 'a' and 'rows' are incompatible.\r\n    Type '{ [key: string]: string; }[]' is not assignable to type '{ a: number; }[]'.\r\n      Type '{ [key: string]: string; }' is not assignable to type '{ a: number; }'.\r\n        Property 'a' is missing in type '{ [key: string]: string; }'.\r\nmessage TS6042: Compilation complete. Watching for file changes.\r\n```\r\nand I have to change to overload to make it pass\r\n```\r\n   <T>(url: string, accessor?: DsvAccessor<void>, callback?: DsvCallback<T>): DsvXhr<T>;\r\n   <T>(url: string, accessor?: DsvAccessor<T>,    callback?: DsvCallback<T>): DsvXhr<T>;\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/153892173","html_url":"https://github.com/Microsoft/TypeScript/issues/5529#issuecomment-153892173","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/5529","id":153892173,"user":{"login":"co-dh","id":860977,"avatar_url":"https://avatars.githubusercontent.com/u/860977?v=3","gravatar_id":"","url":"https://api.github.com/users/co-dh","html_url":"https://github.com/co-dh","followers_url":"https://api.github.com/users/co-dh/followers","following_url":"https://api.github.com/users/co-dh/following{/other_user}","gists_url":"https://api.github.com/users/co-dh/gists{/gist_id}","starred_url":"https://api.github.com/users/co-dh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/co-dh/subscriptions","organizations_url":"https://api.github.com/users/co-dh/orgs","repos_url":"https://api.github.com/users/co-dh/repos","events_url":"https://api.github.com/users/co-dh/events{/privacy}","received_events_url":"https://api.github.com/users/co-dh/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T22:38:26Z","updated_at":"2015-11-04T22:38:26Z","body":"sorry, please close this ticket.\r\nI made a mistake in the last line, it should be:\r\ncsv('', f4, function(a:Data[]){})\r\n\r\n"}}