-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
Svelte-check, or maybe TS, seem to be broken when using let: variables with named slots. If I do this, then the code explodes at runtime but there are no svelte-check errors:
<Wrapper let:foo>
<div class:foo slot="title">title2</div>
<div class:foo>{foo}</div>
</Wrapper>(^error: foo is not defined in <unknown> in __wrapper.svelte)
while if I do this, the code works at runtime, but svelte-check fails
<Wrapper let:foo>
<div class:foo slot="title" let:foo>title2</div>
<div class:foo>{foo}</div>
</Wrapper>Please let me know if I'm doing something wrong 😅 currently my poor app is broken and I don't know how to fix it!
Reproduction
See https://github.com/tyler-boyd/svelte-ts-bug-repro. I just ran npm create vite@latest and created App.svelte and Wrapper.svelte to show this minimal reproduction. If you run npm run check, you'll see it fails, plus errors are shown in VS code.
> [email protected] check
> svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json
Loading svelte-check in workspace: /Users/Tyler.Boyd/work/svelte-check-bug-repro
Getting Svelte diagnostics...
/Users/Tyler.Boyd/work/svelte-check-bug-repro/src/App.svelte:6:35
Error: Property 'foo' does not exist on type '{}'. (js)
<Wrapper let:foo>
<div class:foo slot="title" let:foo>title2</div>
<div class:foo>{foo}</div>
====================================
svelte-check found 1 error and 0 warnings in 1 file
Logs
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Pro
Memory: 650.94 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.2 - ~/.asdf/installs/nodejs/20.12.2/bin/node
npm: 10.5.0 - ~/.asdf/installs/nodejs/20.12.2/bin/npm
bun: 1.1.15 - ~/.bun/bin/bun
Browsers:
Chrome: 138.0.7204.169
Safari: 18.5
npmPackages:
svelte: ^5.35.5 => 5.36.16Severity
blocking an upgrade
Metadata
Metadata
Assignees
Labels
No labels