Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Why are my import types not resolving correctly?

$
0
0

I'm using VS Code v1.95.3 on an M2 mac, running a SvelteKit TS project and I'm trying to understand why the type of my imports does not resolve correctly.

During form validation I created a Zod schema on my +page.server.ts to type the form schema, and upon hovering the type of the Zod z object shows up as any.When I do the same in my .page.svelte file, the object type shows up correctly.I am using Bun, if this might be of any effect, and the project was bootstrapped using npx sv create, which uses vite behind the scenes.

Does anyone have any idea why this might be happening? The project is a single git repo with one tsconfig file, there are no funny business going on there.

I suspect it's probably something that went wrong with the TS Language Server or the Svelte Language server, but I tried restarting both of them multiple times, to no avail. I can't get almost any import types on the +page.server.ts. I tried also removing and reinstalling node_modules, also reinstalling with npm, nothing works.

My folder structure is as following:

bun.lockbnode_modulessrc/  |-- app.html  |-- app.d.ts  |-- app.html  |-- routes/      |-- +layout.svelte      |-- +page.server.ts      |-- +page.sveltesvelte.config.jstsconfig.jsonvite.config.ts

Package versions:

"@sveltejs/kit": "^2.0.0","svelte": "^5.0.0","typescript": "^5.0.0","vite": "^5.0.3","zod": "^3.23.8"

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>