News for hackers. Stuff that matters.
Re:I’m porting the TypeScript type checker tsc to Go by armchairhacker on Tuesday January 25, 2022 @04:25PM (#30078288)
foo[1] is undefined (literally the undefined symbol), in JavaScript index-out-of-bounds is ok.

Although i don’t know if TypeScript asserts that x[i] is T | undefined if x is T[] and the length is non-trivial. In strict mode this would be really useful as you can just do x[i]!, but it requires you to think a bit about index-out-of-bounds or at least throw on the undefined case.

Re:I’m porting the TypeScript type checker tsc to Go by matt_kantor on Tuesday January 25, 2022 @10:56PM (#30081499)
> i don’t know if TypeScript asserts that x[i] is T | undefined if x is T[] and the length is non-trivial

There's a flag for that: https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAc...