Closed
Description
Describe the bug
Svelte-check (and vscode extension) incorrectly reports variables defined with @const
in different blocks as redeclared. For the following block it reports "Error: Cannot redeclare block-scoped variable 'name'. (js)" twice, tho the Svelte compiler has no issues with compiling or rendering it.
This behavior seems to be incorrect because @const
is scoped.
Reproduction
Simple reproduction repository: https://github.com/shadow-identity/block-scoped-repro
{#key "wrld"}
{@const name = "World"}
<p>Hello {name}</p>
{/key}
{#key "pvlk"}
{@const name = "Pavlik"}
<p>Hello {name}</p>
{/key}
Expected behaviour
Neither svelte-check nor vscode extension should report any error within the code block.
System Info
macos 15.4.1 (24E263)
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response