Hacker News new | ask | show | jobs
by lshevtsov 1332 days ago
It's because it is not proven that element with the index 1 exists. Even TypeScript enforces bounds checking these days.

As for the first one - as i understand, this will spoil the original array, as it is assigned by reference; so by writing the string into `numbersOrStrings`, you also write it into `numbers`, thus violating the type.