Closed
Description
Bug Report
π Search Terms
noUncheckedIndexedAccess
π Version & Regression Information
4.2.0-dev.20210124
β― Playground Link
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