Returns whether x is an array.
We have this because Array.isArray(x) returns x is any[], which means
that this code compiles without error, for example:
function thisShouldNotCompile(x: string | readonly string[]) {
if (Array.isArray(x)) {
const s = x[0];
s.thisIsAnAny("but it's actually a string");
}
}
Returns whether
xis an array.We have this because
Array.isArray(x)returnsx is any[], which means that this code compiles without error, for example: