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
type Combined = | "AA" | false;
const x: Combined = "AA"; // ok
const y: Combined = false; // ok
type OO = {foo?: Combined};
const o1: OO = {foo: "AA"}; // ok
const o2: OO = {foo: false}; // ok
o1.foo = o2.foo; // ok
const o3 = {foo: false, ...o1}; //error: This type is incompatible with boolean
const o4 = {foo: "AA", ...o1}; //error: This type is incompatible with boolean
const o5 = {...o1, ...o2}; // ok
In this case, the disjoint enum works fine on individual variables, and fine when assigned normally to an object.
However, when using the spread operator it can't figure out how to combine them, but only if you have explicitly set a value (o3 & o4). If you combine two objects using the spread operator without explicitly adding the value, it does work (o5)
The text was updated successfully, but these errors were encountered:
Here is an example.
In this case, the disjoint enum works fine on individual variables, and fine when assigned normally to an object.
However, when using the spread operator it can't figure out how to combine them, but only if you have explicitly set a value (
o3
&o4
). If you combine two objects using the spread operator without explicitly adding the value, it does work (o5
)The text was updated successfully, but these errors were encountered: