so let me dive into an example:
type NodeOrMethod<T> =
| {
node?: Array<Filter<T>>;
method: Condition<T>;
}
| {
node: Array<Filter<T>>;
method?: Condition<T>;
};
interface BaseFilter {
label: string;
value?: string;
}
export type Filter<T> = BaseFilter & NodeOrMethod<T>;
Basically what I want to do is make it so the dev has to either include node
or method
- which this currently works; however, I want to take it a step further and say IF one of these is present the other CANNOT be. So if they try to include both node
and method
in the same object it would complain. Has anyone done something like this before?