David Blass @ssalbdivad.dev · Jan 9

I didn't know about this behavior, but in what sense do you mean it is correct? I see why it doesn't work in TypeScript's type system, but you could safely narrow to string here, right?

4 likes 1 replies

?

Replies

David Blass · Jan 9

As expected, redeclaring `isArray` with the safer + more accurate `readonly unknown[]` as a type predicate would allow narrowing here. I realize the ship has probably set sail on that kind of breaking change, but I still don't see how that makes it "correct."