π Search Terms
"noUncheckedIndexedAccess" "undefined"
π Version & Regression Information
5.4.2
β― Playground Link
https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&exactOptionalPropertyTypes=false&noPropertyAccessFromIndexSignature=false#code/C4TwDgpgBAggTnKBeKBnYcCWA7A5gbQF0AoY0SKAFQEZlYF8AGEgehag4D0B+UgEwgBjADYBDONEEB7bOiji4ALnpxS02cCjBaKBU1bsOUHsSA
π» Code
typeArr=string[]typeT1=Arr[0]// ^? type T1 = stringdeclareconstarr: Arrconstt1=arr[0]// ^? const t1: string | undefined
π Actual behavior
behavior of noUncheckedIndexedAccess is inconsistent.
π Expected behavior
The type obtained from type T1 = Arr[0] should be string | undefined.
Additional information about the issue
No response
π Search Terms
"noUncheckedIndexedAccess" "undefined"
π Version & Regression Information
5.4.2
β― Playground Link
https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&exactOptionalPropertyTypes=false&noPropertyAccessFromIndexSignature=false#code/C4TwDgpgBAggTnKBeKBnYcCWA7A5gbQF0AoY0SKAFQEZlYF8AGEgehag4D0B+UgEwgBjADYBDONEEB7bOiji4ALnpxS02cCjBaKBU1bsOUHsSA
π» Code
π Actual behavior
behavior of
noUncheckedIndexedAccessis inconsistent.π Expected behavior
The type obtained from
type T1 = Arr[0]should bestring | undefined.Additional information about the issue
No response