{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2160","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2160/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2160/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2160/events","html_url":"https://github.com/Microsoft/TypeScript/issues/2160","id":59167938,"number":2160,"title":"Union Type With Function Return of Sub-Union Type Gives Error","user":{"login":"EToreo","id":1248716,"avatar_url":"https://avatars.githubusercontent.com/u/1248716?v=3","gravatar_id":"","url":"https://api.github.com/users/EToreo","html_url":"https://github.com/EToreo","followers_url":"https://api.github.com/users/EToreo/followers","following_url":"https://api.github.com/users/EToreo/following{/other_user}","gists_url":"https://api.github.com/users/EToreo/gists{/gist_id}","starred_url":"https://api.github.com/users/EToreo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EToreo/subscriptions","organizations_url":"https://api.github.com/users/EToreo/orgs","repos_url":"https://api.github.com/users/EToreo/repos","events_url":"https://api.github.com/users/EToreo/events{/privacy}","received_events_url":"https://api.github.com/users/EToreo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-27T00:21:23Z","updated_at":"2015-02-27T04:54:32Z","closed_at":null,"body":"I honestly don't have the vocabulary to explain this correctly, so please bear with me...\r\n\r\nThe example provided is giving me an \"error TS2349: Cannot invoke an expression whose type lacks a call signature.\" error. \r\n\r\nIt is my understanding that the `TInstance` from `find(): PromiseT<TInstance>;` should be a union of A.Instance, B.Instance, and C.Instance... but does not appear to be - and therefor an error is being issued.  Is the error incorrect, or am I somehow violating the rules of Unions?\r\n\r\nAny help is greatly appreciated,\r\n-Eric\r\n\r\n[Playground Example](http://www.typescriptlang.org/Playground#src=%0Amodule%20def%20%7B%0A%0A%20%20%20interface%20PromiseT%3CT%3E%7B%0A%20%20%20%20%20%20then(onFulfilled%3F%3A%20(result%3F%3A%20T)%20%3D%3E%20void)%3B%0A%20%20%20%7D%0A%0A%20%20%20export%20interface%20Model%3CTInstance%2C%20TPojo%3E%7B%0A%20%20%20%20%20%20find()%3A%20PromiseT%3CTInstance%3E%3B%0A%20%20%20%7D%0A%0A%20%20%20export%20interface%20Instance%3CTInstance%2C%20TPojo%3E%20%7B%0A%20%20%20%20%20%20Model%3A%20Model%3CTInstance%2C%20TPojo%3E%3B%0A%20%20%20%7D%0A%7D%0A%0Amodule%20A%0A%7B%0A%20%20%20export%20interface%20Pojo%0A%20%20%20%7B%0A%20%20%20%20%20%20Id%3F%3Anumber%3B%0A%09%20%20Word%3F%3A%20string%3B%0A%20%20%20%7D%0A%0A%20%20%20export%20interface%20Instance%20extends%20def.Instance%3CInstance%2C%20Pojo%3E%2C%20Pojo%20%7B%20%7D%0A%0A%20%20%20export%20interface%20Model%20extends%20def.Model%3CInstance%2C%20Pojo%3E%7B%0A%09%20%20%20customFunction()%20%3A%20void%3B%0A%20%20%20%7D%0A%7D%0A%0Amodule%20B%0A%7B%0A%20%20%20export%20interface%20Pojo%0A%20%20%20%7B%0A%20%20%20%20%20%20Id%3F%3Anumber%3B%0A%20%20%20%20%20%20%2F%2FClassId%3F%3Anumber%3B%0A%20%20%20%20%20%20AttributeId%3F%3Anumber%3B%0A%20%20%20%7D%0A%0A%20%20%20export%20interface%20Instance%20extends%20def.Instance%3CInstance%2C%20Pojo%3E%2C%20Pojo%20%7B%20%7D%0A%0A%20%20%20export%20interface%20Model%20extends%20def.Model%3CInstance%2C%20Pojo%3E%7B%0A%20%20%20%7D%0A%7D%0A%0Amodule%20C%0A%7B%0A%20%20%20export%20interface%20Pojo%0A%20%20%20%7B%0A%20%20%20%20%20%20Id%3F%3Anumber%3B%0A%20%20%20%20%20%20%2F%2FRangeMin%3F%3Anumber%3B%0A%20%20%20%20%20%20%2F%2FRangeMax%3F%3Anumber%3B%0A%20%20%20%20%20%20Overwritable%3F%3Aboolean%3B%0A%20%20%20%7D%0A%0A%20%20%20export%20interface%20Instance%20extends%20def.Instance%3CInstance%2C%20Pojo%3E%2C%20Pojo%20%7B%20%7D%0A%0A%20%20%20export%20interface%20Model%20extends%20def.Model%3CInstance%2C%20Pojo%3E%7B%0A%20%20%20%7D%0A%7D%0A%0Atype%20Union%20%3D%20A.Model%20%7C%20B.Model%20%7C%20C.Model%3B%0A%0Afunction%20breakIt(model%3A%20Union)%0A%7B%0A%20%20%20model.find().then((myModel)%20%3D%3E%0A%20%20%20%7B%0A%20%20%20%7D)%3B%0A%7D%0A%0Avar%20models%3A%20Array%3CUnion%3E%20%3D%20%5B%5D%3B%0A%0Amodels.forEach((model)%20%3D%3E%0A%7B%0A%20%20%20breakIt(model)%3B%0A%7D)%3B%0A)"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/76332594","html_url":"https://github.com/Microsoft/TypeScript/issues/2160#issuecomment-76332594","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2160","id":76332594,"user":{"login":"EToreo","id":1248716,"avatar_url":"https://avatars.githubusercontent.com/u/1248716?v=3","gravatar_id":"","url":"https://api.github.com/users/EToreo","html_url":"https://github.com/EToreo","followers_url":"https://api.github.com/users/EToreo/followers","following_url":"https://api.github.com/users/EToreo/following{/other_user}","gists_url":"https://api.github.com/users/EToreo/gists{/gist_id}","starred_url":"https://api.github.com/users/EToreo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EToreo/subscriptions","organizations_url":"https://api.github.com/users/EToreo/orgs","repos_url":"https://api.github.com/users/EToreo/repos","events_url":"https://api.github.com/users/EToreo/events{/privacy}","received_events_url":"https://api.github.com/users/EToreo/received_events","type":"User","site_admin":false},"created_at":"2015-02-27T04:54:32Z","updated_at":"2015-02-27T04:54:32Z","body":"The `def` module is an extremely simplified version of sequelize.d.ts from https://github.com/borisyankov/DefinitelyTyped/blob/master/sequelize/sequelize.d.ts\r\n\r\nSo I can't take it away.  Even if I could, I am pretty sure it is vital to the typing of the returned objects from sequelize."}}