If I type the following:
interface A {
x: number
}
interface B {
y: number
}
type Z = A | B;
// here it allows me to create a variable of type Z with both members of type A and B.
let z: Z = {
x: 5,
y: 6,
}
I'm not able to ensure that object of type Z does contain all members of A but does not contain members of B (or the opposite). Is it possible at all with TypeScript? After much research I'm leaning to the "no" answer but I'm not sure.