Control Flow Analysis for Destructured Discriminated Unions doesn't work for let variables #48071
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
Bug Report
π Search Terms
Control flow analysis destructuring assignment
π Version & Regression Information
This was already there, but I thought it might have been fixed with the introduction of this feature in 4.6.
β― Playground Link
Playground link with relevant code
π» Code
Note that if you don't upcast
iter.next()
, you won't get errors, but not for good reasons:A smaller repo would be:
π Actual behavior
value
above in the last example is inferred asnumber | string
, it should benumber
π Expected behavior
I expect the same inference as without destructuring:
The text was updated successfully, but these errors were encountered: