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
// I can conveniently annotate a function express with a type// This is good because the types don't litter the implementation{typeadd=(a: number)=>(b: number)=>number;constadd: add=a=>b=>a+b;// a and b are type number}// However, if I try to do the same where the function type has a generic…{typefn=<A>(a: A)=>A;constfn: fn=a=>a;// a is inferred as any, but expected A}
Is there any way to annotate the function expression fn with the type fn without breaking inference for the parameters?
The text was updated successfully, but these errors were encountered:
#TypeScript Version: 2.3.4
Code
Is there any way to annotate the function expression
fn
with the typefn
without breaking inference for the parameters?The text was updated successfully, but these errors were encountered: