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
declareconstx: {tag: 'foo'|'bar'};constfoobar: {tag: 'foo'}|{tag: 'bar'}=x// ^^^^^^ Type '{ tag: "foo" | "bar"; }' is not assignable to type '{ tag: "foo"; } | { tag: "bar"; }'.// Type '{ tag: "foo" | "bar"; }' is not assignable to type '{ tag: "bar"; }'.// Types of property 'tag' are incompatible.// Type '"foo" | "bar"' is not assignable to type '"bar"'.// Type '"foo"' is not assignable to type '"bar"'.
Of course this is only the case if there aren't additional fields with differing types for tag to discriminate, so this is admittedly perhaps a niche use case.
The text was updated successfully, but these errors were encountered:
Logically it seems like this should work:
Of course this is only the case if there aren't additional fields with differing types for
tag
to discriminate, so this is admittedly perhaps a niche use case.The text was updated successfully, but these errors were encountered: