I would like to use a dynamic component to select a view depending on the value of an enum:
<svelte:component
this={components[enumValue]}
{...props}
/>
But I don't get a compile error if I don't pass all the necessary parameters:
<svelte:component
this={components[enumValue]}
/>
How to correctly specify the typing of dynamic components?
UPD: map example with React
const props: Props = {...}
const components: Record<EnumType, React.FC<Props>> = {
[EnumType.variant_1]: Component1,
[EnumType.variant_2]: Component2,
}