I have a type union composed of A | (A & B)
I need to check for a property that only belongs to B but typescript doesn't allow me to:
interface A {
a: number;
b: number;
c: number;
}
type B = A & {
d: number;
}
type Detail = A | B
declare const test: Detail
// Why can't I check for property d ?
if (test.d) {
}
If B is in the union why is this an error ?