-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Description
Describe the bug
Given component (notice how footer is optional)
<script lang="ts">
type Props = {
children: Snippet
footer?: Snippet
}
const { children, footer } = $props()
</script>
<div>
{@render children()}
{#if footer}
{@render footer()}
{/if}
</div>
This is allowed
<script lang="ts">
import Bug from './Bug.svelte'
</script>
<Bug>
{#snippet children()}
children
{/snippet}
{#snippet footer()}
footer
{/snippet}
</Bug>
<script lang="ts">
import Bug from './Bug.svelte'
</script>
<Bug>
{#snippet children()}
children
{/snippet}
</Bug>
While this gives an error Cannot use explicit children snippet at the same time as implicit children content. Remove either the non-whitespace content or the children snippet block
<script lang="ts">
import Bug from './Bug.svelte'
</script>
<Bug>
{#snippet children()}
children
{/snippet}
{#if true}
{#snippet footer()}
footer
{/snippet}
{/if}
</Bug>
Not sure if this is a limitation or bug. If latter in my opinion this should just work.
Reproduction
Logs
No response
System Info
irrelevant
Severity
annoyance
camdencheek
Metadata
Metadata
Assignees
Labels
No labels