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
Proceeding from left to right, each argument expression e is inferentially typed
...
When a function expression is inferentially typed (section 4.9.3) and a type assigned to a
parameter in that expression references type parameters for which inferences are being made, the
corresponding inferred type arguments to become fixed and no further candidate inferences are
made for them.
But it works differently in compiler. For example:
functionf<T,U>(y: T,f: (x: T)=>U,x: T): [T,U]{return[y,f(x)];}interfaceA{a: A;}interfaceBextendsA{b;}vara: A,b: B;vard=f(b,x=>x.a,a);// type [A, A]vard2=f(b,x=>x.a,null);// type [B, A]
If "no further candidate inferences were made", then types of d and d2 would be the same. But they are different.
4.12.2 spec says:
But it works differently in compiler. For example:
If "no further candidate inferences were made", then types of d and d2 would be the same. But they are different.