'in' does not remove undefined from indexed value (with noUncheckedIndexedAccess) #61389
Labels
Help Wanted
You can do this
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
π Search Terms
in operator, noUncheckedIndexedAccess
π Version & Regression Information
Tested 5.8.2 and 5.9.0-dev.20250310
β― Playground Link
https://www.typescriptlang.org/play/?noUncheckedIndexedAccess=true&ts=5.8.2#code/MYewdgzgLgBAhgJwQLhmArgWwEYFMEDaAujALwwECMANDAEy0DMRA3AFCiSwCWAJgB6oMOfGXrtuAMxgAKPvxjcw8JAEoYAbzYwdMTtBiC0WPAjGJC81tt36QAG1wA6eyADmM-qvYBfNkA
π» Code
With an array:
With a map/object:
π Actual behavior
π Expected behavior
Expected 'in' operator to guarantee that the result of indexing is not
undefined
in this branch.Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: