#18428·svelte

Issue `state_referenced_locally` warnings for declaration tags

Author: Rich-HarrisCreated Jun 12, 2026Updated Sep 7, 2026

Describe the problem

Prompted by https://bsky.app/profile/antleth.fr/post/3mo4o7hrzn223

If you reference state locally (not inside a child function or $derived) you get a warning for declarations in the <script>, but not in the markup, even though they behave the same:

Describe the proposed solution

Make things apply consistently. We might want to treat each block values as static if they're keyed, though. Same for await block values and maybe some other stuff

Importance

nice to have