I've designed a customized Button
component.
interface Button {
href?: string;
action(): void;
}
I'm looking to ensure that when a consumer uses this Button, they can only pass either href
or action
as a prop, not both.
I want TypeScript to validate this requirement during compilation. Can you suggest how I could achieve this?