In this scenario, I am working with a component that includes a list of constructors for Svelte components, known as items
:
<script lang="ts">
// ...other script data
export let items: ConstructorOfATypedSvelteComponent[];
</script>
<!-- ...some other html code -->
{#each items as item}
<!-- ...even more html code -->
<svelte:component this={item}></svelte:component>
{/each}
This is just a basic example, but it can be cumbersome to integrate additional features like named slots
due to the use of
ConstructorOfATypedSvelteComponent
.
However, in
's JSDocs:ConstructorOfATypedSvelteComponent
/**
* Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT
*/
declare type ConstructorOfATypedSvelteComponent = new (args: {target: any, props?: any}) => ATypedSvelteComponent
Given this cautionary note, I'm uncertain about the recommended approach for defining typed Svelte components. Is there a preferred method or alternative solution I should consider?