Skip to content

Commit

Permalink
fix: migration script messing with attributes (#14260)
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloricciuti authored Nov 11, 2024
1 parent ae9f53a commit 653f4ac
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/afraid-donuts-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: migration script messing with attributes
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/migrate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ const template = {
parent.type === 'RegularElement' ||
parent.type === 'SvelteElement' ||
parent.type === 'SvelteFragment') &&
parent.attributes.some((attr) => (attr.type = 'LetDirective'))
parent.attributes.some((attr) => attr.type === 'LetDirective')
)
) {
aliased_slot_name = `${name}_render`;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<MyComponent
variant="outlined"
>
<slot />
</MyComponent>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script>
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
*/
/** @type {Props} */
let { children } = $props();
</script>

<MyComponent
variant="outlined"
>
{@render children?.()}
</MyComponent>

0 comments on commit 653f4ac

Please sign in to comment.