Skip to content

Unable to use return in reactive expression #2828

Closed
@taylorzane

Description

@taylorzane

When using a return statement in a reactive expression/block an error is thrown:

'return' outside of function (L:C)

Since the reactive expression contents is wrapper in a function at compile time, this shouldn't cause any syntax errors at runtime.

I imagine this will require changes to the svelte compiler and also the eslint plugin rules.

See a simple repro here:

https://svelte.dev/repl/8ca16f5088c34dd89574a064868d9b4d?version=3.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions