I am working with an interface that looks like this:
export interface IButton {
label: string;
withIcon?: boolean;
underlined?: boolean;
selected?: boolean;
iconName?: string;
isLink?: boolean;
href?: string;
onCLick?: () => void;
}
My question is, can I conditionally use the iconName property based on whether withIcon is used?
For instance:
<Button label='test' />
---> This should not throw an error.
<Button withIcon />
---> This should throw an error alerting me that the iconName is missing.