TypeScript · Middle · Question 30 of 75
What does the noUncheckedIndexedAccess flag give you?
- ✓Correct answer: Index access gets a type with
| undefined - 2It forbids index signatures in object types entirely
- 3It disables out-of-bounds checks for tuples and arrays
Explanation
Without the flag, const x = arr[10] is typed as T, even though it's undefined at runtime. With the flag, the compiler makes you check the value. The flag isn't part of strict, but it's often recommended.