Skip to content

Svelte 5 does not allow let bindings on forwarded slots, but Svelte 4 does #10382

Closed
@dimfeld

Description

@dimfeld

Describe the bug

Code such as <slot name="a" slot="a" let:abc abc={abc}> throws a compiler error in Svelte 5 that "slot can only receive attributes, not directives". This works fine on Svelte 4.

This is mostly a problem when using old code or libraries that contain this syntax.

Reproduction

Svelte 5 REPL

See Component2.svelte for where the error occurs

Svelte 4 Equivalent REPL that works

Logs

No response

System Info

Svelte REPL

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions