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
declarefunctiona<T>(f: (x: T)=>((y: T)=>T)): T;a<number>(x=>y=>1);// worksa(x=>y=>1);// infers T as { }a<string>(x=>y=>1);// error, as expected
Expected behavior:
In a(x => y => 1), T is inferred as number based on nested callback return type.
As shows a<string>(x => y => 1) example, the just cannot be anything else.
Actual behavior:
In a(x => y => 1), T is inferred as { }.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 1.8.10
Code
Expected behavior:
In
a(x => y => 1)
,T
is inferred asnumber
based on nested callback return type.As shows
a<string>(x => y => 1)
example, the just cannot be anything else.Actual behavior:
In
a(x => y => 1)
,T
is inferred as{ }
.The text was updated successfully, but these errors were encountered: