Closed
Description
Bug Report
π Search Terms
Discriminated Unions with a common partially optional property
π Version & Regression Information
- I tried different versions of 3 and 4.
β― Playground Link
Playground link with relevant code
π» Code
interface B {
a: true;
b: number;
}
interface C {
a?: false;
c: number;
}
type Union = B | C;
const test1: Union = {
a: false,
c: 5,
};
const test2: Union = {
c: 4,
};
const test3: Union = {
a: true,
b: 4,
};
const test4: Union = {
b: 4,
c: 4,
};
π Actual behavior
test4
is displayed as valid.
π Expected behavior
test4
should not be valid.
Metadata
Metadata
Assignees
Labels
No labels