You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type A is a union of the return types of every overload, or an error along the lines of "cannot infer things about an overloaded function" is generated.
Actual behavior:
Type A is object.
This also happens when inferring function params:
typeParameters<Textends(...args: any[])=>any>=Textends(...args: infer U)=>any ? U : never;typeB=Parameters<typeoffoo>;// [boolean, ...object[]]
TypeScript Version: 3.1.0-dev.20180821
Search Terms: function argument infer overload return type rest tuple
Code
Expected behavior:
Type
Ais a union of the return types of every overload, or an error along the lines of "cannot infer things about an overloaded function" is generated.Actual behavior:
Type
Aisobject.This also happens when inferring function params:
Playground Link:
http://www.typescriptlang.org/play/#src=function%20foo%20(a%3A%20string)%3A%20string%3B%0D%0Afunction%20foo%20(a%3A%20number%2C%20b%3A%20string)%3A%20boolean%3B%0D%0Afunction%20foo%20(a%3A%20boolean%2C%20...args%3A%20object%5B%5D)%3A%20object%3B%0D%0Afunction%20foo%20(...args%3A%20any%5B%5D)%3A%20any%20%7B%0D%0A%7D%0D%0A%0D%0Atype%20A%20%3D%20ReturnType%3Ctypeof%20foo%3E%3B%0D%0A%0D%0Atype%20Parameters%3CT%20extends%20(...args%3A%20any%5B%5D)%20%3D%3E%20any%3E%20%3D%20T%20extends%20(...args%3A%20infer%20U)%20%3D%3E%20any%20%3F%20U%20%3A%20never%3B%0D%0A%0D%0Atype%20B%20%3D%20Parameters%3Ctypeof%20foo%3E%3B%20%2F%2F%20%5Bboolean%2C%20...object%5B%5D%5D