svelte
svelte copied to clipboard
docs: clarify svelte:component migration, avoids common gotcha
Clarify docs to specify that, while svelte:component
is no longer needed and deprecated, capitalizing the component variable name is required to avoid mismatching types.
Avoids users doing the same gotcha that I stumbled upon, it will be a common oversight when refactoring existing codebases: #13795
As evidenced in these docs themselves (corrected):
...
let component: Component<{ foo: string }> = $state(
Math.random() ? ComponentA : ComponentB
);
</script>
<svelte:component this={component} foo="bar" />