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
functiononlyIdentity(id: <T>(x: T)=>T){}onlyIdentity((x)=>x);// okay, as expectedonlyIdentity(<S>(x): S=>x);// x gets inferred type "any"
It would be nice if the argument got the correct inferred type (S) from it's context as an argument to onlyIdentity.
In my use case, the return type is small and needs to be narrowed, so I want to specify it, but the argument types are very complex, so I'd prefer that they were inferred.
The text was updated successfully, but these errors were encountered:
RyanCavanaugh
added
Won't Fix
The severity and priority of this issue do not warrant the time or complexity needed to fix it
and removed
Needs Investigation
This issue needs a team member to investigate its status.
labels
Jul 23, 2019
Functions with type arguments aren't subject to contextual typing; this doesn't seem to be a problem in general and would complicate type inference quite a bit to try to solve that.
It would be nice if the argument got the correct inferred type (
S
) from it's context as an argument toonlyIdentity
.In my use case, the return type is small and needs to be narrowed, so I want to specify it, but the argument types are very complex, so I'd prefer that they were inferred.
The text was updated successfully, but these errors were encountered: