cf.completefrontend

Predict the typesMedium

With noUncheckedIndexedAccess on, what are these types, what does TypeScript report, and what does it log?

The project turns on noUncheckedIndexedAccess, a strictness option that strict doesn't include. Name the type each ^? line points at, every error TypeScript reports, and what the code logs when you run it anyway, with its types removed.

What does TypeScript report here?
const scores: Record<string, number> = { ada: 3 };const list = [10, 20]; const ada = scores["ada"];//    ^?const third = list[2];//    ^?const first = list.at(0);//    ^? console.log(ada, third, first);console.log(scores.grace.toFixed(1));

Compiler options: noUncheckedIndexedAccess: true

Work it out first: the compiler shows every error and type.

The answer

Work out every error TypeScript reports and every type it shows, line by line. Then check.

Checking your sign-in…