|
|
|
|
|
by yoklov
3347 days ago
|
|
This isn't the issue I'm describing at all. E.g. if I missed a bounds check, and access past the end of a `Foo[]`, it would be typed as `Foo` (and not `Foo | undefined`), but really be `undefined. Consider this code. var foos: Foo[] = [new Foo()];
foos[1].bar();
foos[1] will be undefined (since it's past the end of the array) but will typecheck as a Foo.Obviously it's bad if I forget a bounds check, but it's similarly bad if I forgot a null check. Of course, I understand why this issue exists, but it is an issue. |
|