mirror of https://github.com/sveltejs/svelte
fix: correctly migrate `$$slots` with bracket member expressions & slots 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 #13472pull/13499/head
parent
785779ac54
commit
49a09081f0
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: correctly migrate `$$slots` with bracket member expressions & slots with static props
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
/** @type {{Record<string, any>}} */
|
||||
/** @type {Record<string, any>} */
|
||||
let { foo, ...rest } = $props();
|
||||
</script>
|
||||
|
||||
|
@ -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} />
|
@ -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, })}
|
Loading…
Reference in new issue