I am interested in developing a unique svelte component that necessitates at least one prop to be provided.
Consider a component with two exposed props, a
and b
:
export let a: number | undefined;
export let b: number | undefined;
It should be permissible to pass either just a
or just b
:
<Component a={1} />
<Component b={1} />
However, passing neither should not be allowed:
<Component />
The overall type would resemble something along these lines:
type Component = {
a: number
} | {
b: number
}
Unfortunately, I am unsure of how to communicate this type information to Svelte.