TypeScript · Middle · Question 30 of 75

What does the noUncheckedIndexedAccess flag give you?

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.

Further reading

Problem with a question

TypeScript · Middle · question 30

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz