Bug Report
๐ Search Terms
noUncheckedIndexedAccess
๐ Version & Regression Information
4.2.0-dev.20210124
โฏ Playground Link
https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&ts=4.2.0-dev.20210124#code/CYUwxgNghgTiAEYD2A7AzgF3gMyUgXPCgK4C2ARiDANoC6AsAFBMYCeADggGJ7wC88NpyTYceagEZa8APQySFKkybJ0WcrEI8k-MUknS5AFQ4IA5Asox4AH3jEUobAEsUIYGfjO0RJFihoaM4A5ihQ5BAIGDpC5pZUZkA
Playground link with relevant code
๐ป Code
declare const foo: number[]
type Foo = typeof foo[1] //number
const bar: Foo = foo[1] //Type 'number | undefined' is not assignable to type 'number'
๐ Actual behavior
typeof foo[1] returns number, but the actual type is number|undefined
๐ Expected behavior
typeof foo[1] should return number | undefined when noUncheckedIndexedAccess is enabled