Back to Browse

TypeScript Plugged In: Compiler Flags: noUncheckedIndexAccess

71 views
Premiered Apr 23, 2024
4:23

https://ducin.dev, #typescript playground: https://tsplay.dev/mLOBVN When using array index access in #typescript, watch out for non-existent elements, as default compiler options will make the compiler infer that all elements of arrays, no matter how big the index is, would exist. Which sometimes is not only true, but could even be illogical. This is where noUncheckedIndexAccess compiler flag come into play. 00:00 intro 00:34 non-existent elements appear to exist 01:36 use type guards when indexing elements 02:05 noUncheckedIndexAccess compiler flag 03:25 obviously existing elements also need to be checked

Download

0 formats

No download links available.

TypeScript Plugged In: Compiler Flags: noUncheckedIndexAccess | NatokHD