3 ms·
It appears that function parameter bivariance is still a thing? [1] Although there seems to now be a flag to make this one use of variance correct. I would ass
by nikitaga 6y ago
It appears that function parameter bivariance is still a thing? [1] Although there seems to now be a flag to make this one use of variance correct.
I would assume even Array<T> is still bivariant as well...
Both of those are horribly unsound, just for convenience. Sure convenience and compatibility are Typescript's ultimate goals, but to actually praise it for its generics? That's very strange.
> TypeScript absolutely does allow you to express these relationships
How would you express a class with covariant or contravariant type params in Typescript?
[1] https://www.typescriptlang.org/docs/handbook/type-compatibility.html#function-parameter-bivariance https://www.typescriptlang.org/docs/handbook/type-compatibil...