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
Problem: in the current state of affairs although convenient to certain audiences the bivariance is a gaping hole in the type system
Solution:
allow optional but explicit in and out modifiers like in C# for those who wants to take advantage of stricter typechecking
keep bivariant typechecking for anyone who doesn't care:
Array<a>{map: <b>(map: (value: a)=>b)=>b[];)declarevaranimals: Array<Animal>;declarevarcopyCat: (cat: Cat)=>Catanimals.map(copyCat);// expected not to typecheck, currently allowed no problem// but if we goArray<ina>{map: <b>(map: (value: a)=>b)=>b[];)// thenanimals.map(copyCat);// doesn't typecheck anymore as expected