Skip to content
Discussion options

You must be logged in to vote

@logic-and-math I ran into the same issue on a fresh SvelteKit + TS project. tsc (and VS Code when it falls back to its built-in TS service) doesn’t seem to pick up the generated $types. That means when you destructure { params } in +page.server.ts, it shows up as any and throws TS7031, even though svelte-check reports no problems.

From what I can tell, this happens because VS Code is using the bundled TypeScript instead of the workspace version that has the @sveltejs/ts-plugin.

What fixed it for me:

  1. In VS Code, run TypeScript: Select TypeScript Version and choose Use Workspace Version.
  2. Then restart the TS server (TypeScript: Restart TS server) or just reload the window.

After switching…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@logic-and-math
Comment options

@logic-and-math
Comment options

Answer selected by logic-and-math
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants