Svelte 5: Cannot reassign or bind to each block argument in runes mode.
What should I use instead?
#11431
Unanswered
frederikhors
asked this question in
Q&A
Replies: 2 comments 5 replies
-
@Conduitry docs update is a issue I think. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes you should use {#each players || [] as player, i}
<FormPlayer index={i} bind:player={players[i]} />
{/each} the warning is probably coming from eslint, a usual fix is prepending (or even substituting) {#each players || [] as _, i}
<FormPlayer index={i} bind:player={players[i]} />
{/each} but it depends on how your eslint is configured The last error is probably fine to shut up with a ts-ignore since there's never a moment when you would access {#if players}
{#each players as _, i}
<FormPlayer index={i} bind:player={players[i]} />
{/each}
{/if} |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
In Svelte 4 app I was using:
Now with Svelte 5 it errors with:
Why?
Should I use the below instead?
Also if I use the latter one player is unused and I get the ts warning:
Plus, with the latter one I get another typscript warning:
even if I'm already inside an
{#each players
.There is no docs on this on https://svelte-5-preview.vercel.app/docs, right?
System Info
`"svelte": "5.0.0-next.120"`
Severity
blocking an upgrade
Beta Was this translation helpful? Give feedback.
All reactions