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
TS fails to remember the overloaded types and picks the last one by default, breaking the overload usability (in practice) when using callbacks. Let's take a simple example to make this more clear:
EDIT: Which seems to be a limitation of the typeof operator.
TS fails to remember the overloaded types and picks the last one by default, breaking the overload usability (in practice) when using callbacks. Let's take a simple example to make this more clear:
EDIT: Which seems to be a limitation of the
typeof
operator.TypeScript Version: 3.7.0-dev.20190905
Search Terms: callback, inference, overloads
Code
Expected behavior:
There shouldn't be any error. Maybe we could treat overloads as unions?
Actual behavior:
TypeScript picks that last overload only
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: