Partially overlapping union discriminators are not assignable from a union of discriminating values #45230
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
🔎 Search Terms
tagged, discriminated, union, partially, overlapping, infinite, types, not, assignable
🕗 Version & Regression Information
I tried versions from v3.3.3 to v4.3.5, as those were available in the Playground at this time.
Note that between v3.3.3 and v3.5.1 something changed that affects type
C
from my example below. In v3.3.3 the assignment toconst c: C
is an error, from v3.5.1 its okay.⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
The assignments to
const a: A
,const b: B
, andconst d3: D
raise an error.🙂 Expected behavior
As demonstrated in the assignments to
const d1: D
andconst d2: D
, my partially discriminating propertydprop
can be either of the two discriminating values. So It should be possible to assign todprop
a value that is either of them, as in the assignment toconst d3: D
.The text was updated successfully, but these errors were encountered: