I have made a component MyComponent
with react. I would like to define the props for this component.
Usually i do it like
type Props = {
foo: string
}
const MyComponent = (props: Props) => ...
Here are the props i would like to always be available
selected: string <-- required
onSelect(): void <-- required
margin?: string <-- optional
And the following are two sets that are non-compatible, ie. only one of them can be used.
Set one:
compact?: boolean <-- optional
minWidth?: number <-- optional
maxWidth?: number <-- optional
Set two:
width?: number <-- optional
What is the best way to define these props so that it makes the most sense to the developer using the component? I.e, what gives the best intellisense experience?