Closed
Description
TypeScript Version: nightly (2.4.0-dev.20170612)
Code
interface X {
type: 'x';
value: string;
}
interface Y {
type: 'y';
value: 'none' | 'done';
}
function foo(bar: X | Y) { }
foo({
type: 'y',
value: 'done',
});
Expected behavior:
No error.
Actual behavior:
Argument of type '{ type: "y"; value: string; }' is not assignable to parameter of type 'X | Y'.
Type '{ type: "y"; value: string; }' is not assignable to type 'Y'.
Types of property 'value' are incompatible.
Type 'string' is not assignable to type '"none" | "done"'.