You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I posted in the discord server, and we landed on this type:
<scriptlang="ts">importtype{ Component }from'svelte';interfaceProps{// only components that have at most the "prop"// property required can be passedDynamicComponent: Component<{prop: string}>;}let{ DynamicComponent }: Props=$props();letdynamicComponent: ReturnType<DynamicComponent>;</script><DynamicComponentbind:this={dynamicComponent}prop="foo"/>
Is this the intended way to type a dynamic component 's bound variable? The docs should be updated with an example of whichever type is intended.
Reproduction
The svelte playground completely ignores type annotations :(
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
The typescript section of the docs shows how to make a dynamic component, but doesn't show how to bind the instance. Migrating from svelte 4 to 5 has been confusing, because my compiler keeps giving me errors and hover hints in terms of the old SvelteComponent.
I posted in the discord server, and we landed on this type:
Is this the intended way to type a dynamic component 's bound variable? The docs should be updated with an example of whichever type is intended.
Reproduction
The svelte playground completely ignores type annotations :(
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: