Typescript 4.8.4: Different type inference on two if
branches with (fundamentally) identical input
#52917
Labels
Duplicate
An existing issue was already created
Bug Report
π Search Terms
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The two
if
branches give different TS output (type inference & errors) with the same input (fundamentally same input; if identical input was used, the branching would not make sense. Demonstrating withMath.random()
).This behavior first appears in the TS playground in version 4.8.4. My project, where I ran into this issue, is also on v4.8.4. It seems to work as expected in earlier version 4.7.4.
π Expected behavior
The inferred types and errors will be identical in both branches with (fundamentally) identical input.
The text was updated successfully, but these errors were encountered: