Skip to content

#snippet rest args and @render spread? #11178

Open
@brunnerh

Description

@brunnerh

Describe the problem

Rest args and spreads are not supported, the latter of which has a specific error message:

cannot use spread arguments in {@render ...} tags

Is there a reason why these patterns are not supported?

{#snippet test(...items)}
	{#each items as item}
		<p>{item}</p>
	{/each}
{/snippet}

{@render test(1, 2, 3)}

REPL

<script>
	const args = [1, 2, 3];
</script>

{#snippet test(a, b, c)}
	{a} {b} {c}
{/snippet}

{@render test(...args)}

REPL

Describe the proposed solution

Support rest/spread analogous to how they work with functions.

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions