svelte: Svelte 5: unable to name a variable with the "same name" as a rune
Describe the bug
When naming a variable with the same name as a rune, without the $, like state or derived or others, the compiler considers them as the same, thus leading to errors like Cannot access 'state' before initialization or errors relating to rune re-affectation.
Even if it’s not a bug, runes re-affectation should be prohibited.
Reproduction
Logs
No response
System Info
REPL, Svelte 5 next 175
Severity
annoyance
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 23 (13 by maintainers)
This works as expected. We decided to give stores precedence over runes in this situation. We can revisit this decision in Svelte 6.
There is already a warning for this problem, as you can see in the REPL.