{#each { length }, index} generates invalid TypeScriptThe Svelte-documented {#each { length: N }, index} comma syntax for rendering N items generates invalid TypeScript. The transformer treats the comma as a JavaScript variable declaration list instead of Svelte's index parameter.
Errors produced:
src/lib/Skeleton.svelte:5:27
Error: 'const' declarations must be initialized. (ts(TS1155))
src/lib/Skeleton.svelte:5:27
Error: Variable 'i' implicitly has an 'any' type. (ts(TS7005))
src/routes/+page.svelte:7:23
Error: 'const' declarations must be initialized. (ts(TS1155))
Native svelte-check handles this syntax correctly.
{#each { length: 4 }, i}
<div>placeholder {i}</div>
{/each}
--emit-ts)// What svelte-check-rs generates (broken):
const __each_1 = { length: 4 }, i; // comma parsed as variable declaration list
for (const of __each_1) { // empty iterator variable
i;
}
// What it should generate:
for (const [i, _] of __svelte_each_indexed({ length: 4 })) {
// ...
}
pnpm install
npx svelte-check-rs