6 ms·
Interesting, though it does flag the push() as an error if you use "Array<string> | Array<number>" as the argument type. It almost seems like some sort of co/c
by negativegate 7y ago
Interesting, though it does flag the push() as an error if you use "Array<string> | Array<number>" as the argument type.
It almost seems like some sort of co/contravariance issue?
A function that reads from an Array<string | number> should be able to accept either an Array<string> or an Array<number> (or Array<string | number>), but a function that mutates it should only be able to accept Array<string | number>?