sveltejs / svelte · Issue No. 18451
When exporting snippets referencing the type of a value from the regular <script> block, the TypeScript error:
Cannot find name '<exportedSnippetName>'. (ts 2304)
is thrown instead of the expected error:
An exported snippet can only reference things declared in a `<script module>`, or other exportable snippets
https://svelte.dev/e/snippet_invalid_export
Note: I don't know if type references should error at all; it's not a blocking issue as actual object references can be, if type references are ever a problem. Nonetheless, it should emit the same error message as object references instead of this generic TS error.
Side idea: if possible, problematic object references within the snippet could be underlined as well, allowing for instantaneous identification of the precise cause; this would be awesome!
System:
OS: macOS 26.5.1
CPU: (10) arm64 Apple M1 Pro
Memory: 328.67 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 26.1.0 - /Users/antoine/.local/state/fnm_multishells/69485_1782078220196/bin/node
npm: 11.17.0 - /Users/antoine/.local/state/fnm_multishells/69485_1782078220196/bin/npm
pnpm: 11.7.0 - /opt/homebrew/bin/pnpm
bun: 1.3.14 - /Users/antoine/.bun/bin/bun
Deno: 2.8.3 - /opt/homebrew/bin/deno
Browsers:
Chrome: 149.0.7827.156
Firefox: 152.0.1
Safari: 26.5
Safari Technology Preview: 26.0
npmPackages:
@sveltejs/kit: ^2.65.1 => 2.65.1
runed: ^0.37.1 => 0.37.1
svelte: ^5.56.3 => 5.56.3
annoyance
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.