docs: make Svelte examples compatible with strict Twoslash checking
Enabling strict Svelte Twoslash tooltips for Svelte documentation tooltip tracking issue rejects 50 of 89 fenced Svelte snippet instances in this repository's synced documentation (14 Markdown files). The complete failing-block inventory is below.
What needs updating
Give partial examples hidden setup, companion-file context, or appropriate types. Handle intentional type/compiler errors explicitly without changing their teaching intent or suppressing diagnostics globally. Update original sources, not generated site copies.
These are integration compatibility failures, not a claim that every example is intrinsically wrong.
Audit method, versions, and source locations- Extracted actual
sveltecode tokens using the site's Markdown tokenizer, then checked each throughrender_content. Fences appearing as literal text inside Markdown examples are excluded. - Versions:
@twinkleplop/[email protected],[email protected],[email protected], adapter TypeScript5.9.3. Strict diagnostics; the site's ambient Svelte/Kit/environment and synthetic route declarations are included. - Each snippet is checked independently. Diagnostics come from its first failing JS/TS variant; missing surrounding context can account for failures.
- Upstream source links are pinned to
c6f9a786e1ccd3b6dc91d97637299ffe8283fc2fand matched to the exact snippets, including message/type sources behind generated documentation. - Each block distinguishes upstream and synced-page lines. Fence numbers count only actual Svelte code tokens within the synced page.
- Identical diagnostics within a block are deduplicated. Generated
index.tsxoffsets are omitted; compiler/parser error codes are included.
Failing blocks
Renderer support gap: the two blocks in 98-reference/54-types.md use valid generated ActionData imports. Their missing-export diagnostics are caused by the site integration's incomplete synthetic $types declarations, not invalid Kit documentation. They are included for inventory completeness; fix that declaration support in svelte.dev rather than removing those imports.
documentation/docs/20-core-concepts/10-routing.md
- Block 1 — L59; fence 4, synced L60:
[2307] Cannot find module '../blog.remote' or its corresponding type declarations. - Block 2 — L153; fence 5, synced L154:
[18047] 'page.error' is possibly 'null'.
documentation/docs/20-core-concepts/20-load.md
- Block 3 — L131; fence 3, synced L132:
[7006] Parameter 'post' implicitly has an 'any' type.
documentation/docs/20-core-concepts/30-form-actions.md
- Block 4 — L75; fence 2, synced L76:
[element_unclosed] `<form>` was left open - Block 5 — L80; fence 3, synced L81:
[element_unclosed] `<form>` was left open - Block 6 — L209; fence 6, synced L210:
[2304] Cannot find name 'form'. - Block 7 — L346; fence 7, synced L347:
[element_unclosed] `<form>` was left open - Block 8 — L375; fence 8, synced L376:
[element_unclosed] `<form>` was left open - Block 9 — L397; fence 9, synced L398:
[element_unclosed] `<form>` was left open - Block 10 — L433; fence 10, synced L434:
[7006] Parameter 'event' implicitly has an 'any' type.
documentation/docs/20-core-concepts/50-state-management.md
- Block 11 — L101; fence 2, synced L102:
[18046] 'user' is of type 'unknown'. - Block 12 — L164; fence 5, synced L165:
[2304] Cannot find name 'BlogPost'.; [2304] Cannot find name 'data'.
documentation/docs/20-core-concepts/60-remote-functions.md
- Block 13 — L73; fence 1, synced L74:
[2307] Cannot find module './data.remote' or its corresponding type declarations. - Block 14 — L92; fence 2, synced L93:
[2307] Cannot find module './data.remote' or its corresponding type declarations. - Block 15 — L121; fence 3, synced L122:
[2307] Cannot find module '../data.remote' or its corresponding type declarations. - Block 16 — L173; fence 4, synced L174:
[2307] Cannot find module './data.remote.js' or its corresponding type declarations. - Block 17 — L195; fence 5, synced L196:
[2304] Cannot find name 'getPosts'. - Block 18 — L232; fence 6, synced L233:
[2307] Cannot find module './weather.remote' or its corresponding type declarations. - Block 19 — L277; fence 7, synced L278:
[2307] Cannot find module './time.remote.js' or its corresponding type declarations. - Block 20 — L376; fence 8, synced L377:
[2307] Cannot find module '../data.remote' or its corresponding type declarations. - Block 21 — L399; fence 9, synced L400:
[2304] Cannot find name 'createPost'. - Block 22 — L443; fence 10, synced L444:
[2307] Cannot find module './data.remote' or its corresponding type declarations. - Block 23 — L508; fence 11, synced L509:
[2304] Cannot find name 'survey'.; [2304] Cannot find name 'operatingSystems'.; [2552] Cannot find name 'languages'. Did you mean 'language'? - Block 24 — L534; fence 12, synced L535:
[2304] Cannot find name 'survey'.; [2304] Cannot find name 'operatingSystems'.; [2552] Cannot find name 'languages'. Did you mean 'language'? - Block 25 — L604; fence 13, synced L605:
[2304] Cannot find name 'createPost'. - Block 26 — L634; fence 14, synced L635:
[2304] Cannot find name 'createPost'. - Block 27 — L644; fence 15, synced L645:
[2307] Cannot find module '../data.remote' or its corresponding type declarations. - Block 28 — L666; fence 16, synced L667:
[2304] Cannot find name 'createPost'. - Block 29 — L678; fence 17, synced L679:
[2304] Cannot find name 'createPost'.; [2552] Cannot find name 'render'. Did you mean '$$render'? - Block 30 — L693; fence 18, synced L694:
[2307] Cannot find module '../data.remote' or its corresponding type declarations. - Block 31 — L715; fence 19, synced L716:
[2304] Cannot find name 'register'. - Block 32 — L776; fence 20, synced L777:
[2307] Cannot find module '../data.remote' or its corresponding type declarations. - Block 33 — L803; fence 21, synced L804:
[2307] Cannot find module '../data.remote' or its corresponding type declarations.; [2307] Cannot find module '$lib/toast' or its corresponding type declarations.; [7006] Parameter 'form' implicitly has an 'any' type. - Block 34 — L839; fence 22, synced L840:
[2307] Cannot find module '../data.remote' or its corresponding type declarations. - Block 35 — L862; fence 23, synced L863:
[2307] Cannot find module '$lib/auth' or its corresponding type declarations. - Block 36 — L948; fence 24, synced L949:
[2307] Cannot find module './likes.remote' or its corresponding type declarations.; [2307] Cannot find module '$lib/toast' or its corresponding type declarations.
documentation/docs/20-core-concepts/70-environment-variables.md
- Block 37 — L190; fence 1, synced L191:
[2307] Cannot find module '$app/env/public' or its corresponding type declarations.
documentation/docs/30-advanced/25-errors.md
- Block 38 — L45; fence 1, synced L46:
[18047] 'page.error' is possibly 'null'. - Block 39 — L142; fence 3, synced L143:
[js_parse_error] Unexpected token
documentation/docs/30-advanced/30-link-options.md
- Block 40 — L127; fence 1, synced L128:
[element_unclosed] `<div>` was left open
documentation/docs/30-advanced/65-snapshots.md
- Block 41 — L11; fence 1, synced L12:
[7006] Parameter 'value' implicitly has an 'any' type.
documentation/docs/30-advanced/67-shallow-routing.md
- Block 42 — L11; fence 1, synced L12:
[2339] Property 'showModal' does not exist on type 'PageState'. - Block 43 — L49; fence 2, synced L50:
[2339] Property 'selected' does not exist on type 'PageState'.
documentation/docs/40-best-practices/07-images.md
- Block 44 — L17; fence 1, synced L18:
[2307] Cannot find module '$lib/assets/logo.png' or its corresponding type declarations. - Block 45 — L74; fence 3, synced L75:
[2307] Cannot find module './path/to/your/image.jpg?enhanced' or its corresponding type declarations. - Block 46 — L84; fence 4, synced L85:
[2339] Property 'glob' does not exist on type 'ImportMeta'.; [18046] 'module' is of type 'unknown'.
packages/kit/types/index.d.ts
- Block 47 — L1824; fence 1, synced L400; page
98-reference/10-@sveltejs-kit:[unexpected_eof] Unexpected end of input - Block 48 — L638; fence 1, synced L977; page
98-reference/50-configuration:[2307] Cannot find module './favicon.png' or its corresponding type declarations.
documentation/docs/98-reference/54-types.md
- Block 49 — L103; fence 2, synced L104:
[2305] Module '"./$types"' has no exported member 'ActionData'. - Block 50 — L112; fence 3, synced L113:
[2305] Module '"./$types"' has no exported member 'ActionData'.; [2454] Variable 'data' is used before being assigned.
Source: sveltejs/kit