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
After #42149, which usually preserves the type aliases of unions as written, some type aliases end up de-aliased in control flow:
(example based on @types/amap-js-api)
typeDirection='up'|'down'|'left'|'right'interfaceInput{direction?: Direction}declareletinput: Inputif(input.direction){input.direction/*should be Direction*/}
This occurs because control flow narrowing uses filterType, which doesn't understand type aliases or attempt to preserve them. Previously the union-interning behaviour preserved the alias, but that's no longer the case.
The text was updated successfully, but these errors were encountered:
@ahejlsberg, I'm assigning you for the 4.2 milestone so that @RyanCavanaugh and @DanielRosenwasser are aware of the regression, but feel free to close this when you've had a chance to decide whether it's worth fixing.
After #42149, which usually preserves the type aliases of unions as written, some type aliases end up de-aliased in control flow:
(example based on
@types/amap-js-api
)Expected: The inner
input.direction: Direction
Actual: The inner
input.direction: 'up' | 'down' | 'left' | 'right'
This occurs because control flow narrowing uses
filterType
, which doesn't understand type aliases or attempt to preserve them. Previously the union-interning behaviour preserved the alias, but that's no longer the case.The text was updated successfully, but these errors were encountered: