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.
This doesn't work — the
foodeclaration isn't correctly transformed inside thebardeclaration:{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/constisn't tolerated, and maybe it should be.