Narrowing of indexed access type only allows apparent type access; don't allow assignability #32502
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Domain: Indexed Access Types
The issue relates to accessing subtypes via index access
Duplicate
An existing issue was already created
Milestone
TypeScript Version: 3.6.0-dev.20190720
Search Terms: type narrowing undefined generics early return
Code
Expected behavior: Compiles without errors.
Actual behavior: Several errors relating to arr not narrowing out the
undefined
portion of the argument:Playground Link
Related Issues:
#1726 (closed by design, this is different because we can assume any array is not undefined)
#31456 (this example has a constraint)
The text was updated successfully, but these errors were encountered: