-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly migrate
$$slots
with bracket member expressions & sl…
…ots with static props (#13468) - fix: correctly migrate `$$slots` with bracket member expressions - fix: wrong type for JSDoc `$$restProps` - fix: correctly migrate slots with static props - fix: `$$props` messing with `$$slots` Fixes #13467, fixes #13466, fixes #13472
- Loading branch information
1 parent
785779a
commit 49a0908
Showing
10 changed files
with
141 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: correctly migrate `$$slots` with bracket member expressions & slots with static props |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/svelte/tests/migrate/samples/props-rest-props/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/svelte/tests/migrate/samples/slots-with-$$props/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<button><slot /></button> | ||
|
||
{#if foo} | ||
<slot name="foo" {foo} /> | ||
{/if} | ||
|
||
{#if $$slots.bar} | ||
{$$slots} | ||
<slot name="bar" /> | ||
{/if} | ||
|
||
{#if $$slots.default}foo{/if} | ||
|
||
{#if $$slots['default']}foo{/if} | ||
|
||
{#if $$slots['dashed-name']}foo{/if} | ||
|
||
<slot name="dashed-name" /> | ||
|
||
<slot header="something" title={$$props.cool} {id} /> |
27 changes: 27 additions & 0 deletions
27
packages/svelte/tests/migrate/samples/slots-with-$$props/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script> | ||
/** @type {Record<string, any>} */ | ||
let { | ||
...props | ||
} = $props(); | ||
</script> | ||
|
||
<button>{@render props.children?.()}</button> | ||
|
||
{#if foo} | ||
{@render props.foo_1?.({ foo, })} | ||
{/if} | ||
|
||
{#if props.bar} | ||
{$$slots} | ||
{@render props.bar?.()} | ||
{/if} | ||
|
||
{#if props.children}foo{/if} | ||
|
||
{#if props.children}foo{/if} | ||
|
||
{#if props.dashed_name}foo{/if} | ||
|
||
{@render props.dashed_name?.()} | ||
|
||
{@render props.children?.({ header: "something", title: props.cool, id, })} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/svelte/tests/migrate/samples/svelte-component/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters