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
thing.type at the end should have type B, because it can never be CorD.
This may well be considered a feature that hasn't been implemented yet.
For context, here's the type I'm trying to remove. This is an AST for SQL expressions. I've parsed an expression using this library, which gives me an Expr, but I'm only expecting to handle simpler kinds of SQL expressions, and I'd like to throw on more complex ones and narrow the type. Currently, it's harder than I'd like to kick SelectFromUnion out of the large Expr union, because its type is 'union' | 'union all'. Probably my best bet at this point would be a custom type guard, but it sure would be nice if TS could figure out the narrowing for me.
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
discriminated union, discriminator, narrowing
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
thing.type
at the end has typeB | CorD
.π Expected behavior
thing.type
at the end should have typeB
, because it can never beCorD
.This may well be considered a feature that hasn't been implemented yet.
For context, here's the type I'm trying to remove. This is an AST for SQL expressions. I've parsed an expression using this library, which gives me an
Expr
, but I'm only expecting to handle simpler kinds of SQL expressions, and I'd like to throw on more complex ones and narrow the type. Currently, it's harder than I'd like to kickSelectFromUnion
out of the largeExpr
union, because itstype
is'union' | 'union all'
. Probably my best bet at this point would be a custom type guard, but it sure would be nice if TS could figure out the narrowing for me.The text was updated successfully, but these errors were encountered: