Skip to content

Declaration tag bugs #18334

Description

@Rich-Harris

This doesn't work — the foo declaration isn't correctly transformed inside the bar declaration:

{let foo = $state(0), bar = $derived(foo * 2)}

<input type="range" bind:value={foo} />

<p>foo: {foo}</p>
<p>bar: {bar}</p>

Either we should make this work, or prohibit declarations with multiple declarators.

You can put them in separate declarations and it works, but there's an erroneous compiler warning:

{let foo = $state(0)}
{let bar = $derived(foo * 2)}

<input type="range" bind:value={foo} />

<p>foo: {foo}</p>
<p>bar: {bar}</p>

Whitespace before the let/const isn't tolerated, and maybe it should be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions