Skip to content

Commit 653f4ac

Browse files
fix: migration script messing with attributes (#14260)
1 parent ae9f53a commit 653f4ac

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

.changeset/afraid-donuts-whisper.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: migration script messing with attributes

packages/svelte/src/compiler/migrate/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ const template = {
13091309
parent.type === 'RegularElement' ||
13101310
parent.type === 'SvelteElement' ||
13111311
parent.type === 'SvelteFragment') &&
1312-
parent.attributes.some((attr) => (attr.type = 'LetDirective'))
1312+
parent.attributes.some((attr) => attr.type === 'LetDirective')
13131313
)
13141314
) {
13151315
aliased_slot_name = `${name}_render`;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<MyComponent
2+
variant="outlined"
3+
>
4+
<slot />
5+
</MyComponent>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script>
2+
/**
3+
* @typedef {Object} Props
4+
* @property {import('svelte').Snippet} [children]
5+
*/
6+
7+
/** @type {Props} */
8+
let { children } = $props();
9+
</script>
10+
11+
<MyComponent
12+
variant="outlined"
13+
>
14+
{@render children?.()}
15+
</MyComponent>

0 commit comments

Comments
 (0)