I'm not sure if the title is correct.
But is there a way to not allow the union type, but make it more specific to only allow a specific interface?
See the following example:
interface Buz {
buz: string;
}
interface Qux {
qux: boolean;
}
export interface FooBar {
content?: Buz | Qux;
}
const somethingBuz: FooBar = {
content: {
buz: 'yay!',
qux: true // <- this should not be allowed
}
}
const somethingQux: FooBar = {
content: {
buz: 'yay', // <- this should not be allowed
qux: true
}
}