svelte-check reports error when using {#await} inside a snippet
Closed this issue · 0 comments
felix-roehrich commented
Describe the bug
If a snippet contains an {#await}
block, then the following error will be reported by svelte-check: "Cannot find name 'await'. Did you mean to write this in an async function? (js)".
The code works even though an error is reported, so I am not sure if this is only a problem of svelte-check or points to some wonky code generated for snippets.
Reproduction
Use pnpm create svelte@latest
with JS type checking and Svelte 5 option.
Then modify the generated src/rotues/+page.svelte
by adding
{#await ok}{/await}
{#snippet foo()}{#await bar}{/await}{/snippet}
Running pnpm run check
will now report this error (and also the cannot find name for 'ok' and 'foo' which is irrelevant).
Logs
No response
System Info
System:
OS: macOS 14.4.1
CPU: (8) x64 Intel(R) Core(TM) i7-8557U CPU @ 1.70GHz
Memory: 34.11 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.7.1 - /usr/local/bin/node
npm: 10.5.0 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
Browsers:
Safari: 17.4.1
npmPackages:
svelte: ^5.0.0-next.1 => 5.0.0-next.108
Severity
annoyance