You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type of wha is string | number, completely ignoring the possibility that it might be undefined, even though --noUncheckedIndexedAccess is enabled. Looks like unions of types with index signatures and known keys lose the --noUncheckedIndexedAccess behavior.
π Expected behavior
wha should be of type string | number | undefined, just like hmm, since indexed access into a union should look like a union of indexed accesses.
Additional information about the issue
This is related to #50474. Itβs also related to #47531, which had specifically to do with never[] and so the focus was on avoiding never[] as opposed to investigating what happened to the indexed access. ( #47531 (comment) )
π Search Terms
noUncheckedIndexedAccess, union, undefined
π Version & Regression Information
--noUncheckedIndexedAccess
β― Playground Link
Playground link
π» Code
π Actual behavior
The type of
wha
isstring | number
, completely ignoring the possibility that it might beundefined
, even though--noUncheckedIndexedAccess
is enabled. Looks like unions of types with index signatures and known keys lose the--noUncheckedIndexedAccess
behavior.π Expected behavior
wha
should be of typestring | number | undefined
, just likehmm
, since indexed access into a union should look like a union of indexed accesses.Additional information about the issue
This is related to #50474. Itβs also related to #47531, which had specifically to do with
never[]
and so the focus was on avoidingnever[]
as opposed to investigating what happened to the indexed access. ( #47531 (comment) )Ran into this when looking at a Stack Overflow question
The text was updated successfully, but these errors were encountered: