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
{{ message }}
Repository navigation
Strange type narrowing with Discriminated union types #9254
Anders Hejlsberg (@ahejlsberg) how do the conditions of #8548 come up with this example? The control flow type is (or should be?) narrowed to never after the two type guards in the if/else if block. But then there is no third type guard that conflicts with that narrowed type, so why should #8548 apply?
Activity
ahejlsberg commentedon Jun 19, 2016
Duplicate of #9246. This is working as intended because of #8548, but it is obviously causing some confusion.
yortus commentedon Jun 20, 2016
Anders Hejlsberg (@ahejlsberg) how do the conditions of #8548 come up with this example? The control flow type is (or should be?) narrowed to
neverafter the two type guards in theif/else ifblock. But then there is no third type guard that conflicts with that narrowed type, so why should #8548 apply?ahejlsberg commentedon Aug 3, 2016
Fixed in #10118.