fix: migrate `$$slots.default` correctly (#13238)

Mentioned in https://github.com/sveltejs/kit/pull/12519#issuecomment-2344826143
pull/13243/head
Simon H 6 months ago committed by GitHub
parent 04df7b07ab
commit 47918328d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -927,6 +927,9 @@ function handle_identifier(node, state, path) {
} else if (node.name === '$$slots' && state.analysis.uses_slots) {
if (parent?.type === 'MemberExpression') {
state.str.update(/** @type {number} */ (node.start), parent.property.start, '');
if (parent.property.name === 'default') {
state.str.update(parent.property.start, parent.property.end, 'children');
}
}
// else passed as identifier, we don't know what to do here, so let it error
}

@ -9,4 +9,6 @@
<slot name="bar" />
{/if}
{#if $$slots.default}foo{/if}
<slot name="dashed-name" />

@ -19,4 +19,6 @@
{@render bar?.()}
{/if}
{#if children}foo{/if}
{@render dashed_name?.()}
Loading…
Cancel
Save