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
Narrowing discriminated union via type predicate and type assertion results in different behavior.Β #45770
Type assertion does the correct thing, but the equivalent type predicate results in an odd scenario where the property is correctly narrowed, but the union object is not narrowed.
π Expected behavior
Type assertion and type predicate have the same narrowing behavior, and only differ on whether the code branches or throws.
I would also expect the type predicate to either narrow neither the property nor the object or both the property and the object (like the type assertion does).
changed the title [-]Narrowing discriminated union via type predicate and type assertion expresses different behavior.[/-][+]Narrowing discriminated union via type predicate and type assertion results in different behavior.[/+]on Sep 7, 2021
Activity
[-]Narrowing discriminated union via type predicate and type assertion expresses different behavior.[/-][+]Narrowing discriminated union via type predicate and type assertion results in different behavior.[/+]