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...
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.