let's imagine a have an object that either have properties A and B or C, e.g.:
const temp = {
A: 1,
B: 2,
}
or
const temp = {
C: 3,
}
And intuitively I see this type as:
type T = {A: number, B: number} | {C: number};
const valid: T = {A: 1, B: 2};
const alsoValid: T = {C: 3};
// Should complain but it does not
const invalid: T = {A: 1, B: 2, C: 3};
// Also should complain
const alsoInvalid: T = {A:1, C: 3};
But TS treats such type as {A?: number, B?: number, C?: number} and basically | makes fields optional but I want TS to complain about inconsistent type when I add C property to A and B
How can I archive the desirable type?