Closed martinbeentjes closed 2 years ago
These files are generated automatically on the .svelte-kit/types
folder as part of the npm lifecycle. I believe you can force them to be generated using npx svelte-kit sync
(docs). I believe this may solve your issue.
However, after they are generated, I'm getting another issue on svelte files when trying to import ./$types
- Cannot resolve file '$types'
It is working on VSCode, and it is also working when the import is on a Typescript file. The error only shows on the script tag of svelte files when running WebStorm
I'll adapt this issue, I was indeed making a mistake myself. However, I am having the same issue as you, with ./$types
unknown.
One to investigate, I am also having some issues with duplicate code. But that was fixed by marking the .svelte-kit
folder excluded.
I was facing similar issues. I changed my tsconfig.json
to include files from root
dir. That seems to have fixed the import of ./$types
. However, in +page.svelte
file, while it correctly imports PageData
type, data
variable still stays untyped.
Here's the screenshot of my setup.
Seems this is unrelated to the plugin, but a Webstorm issue.
@martinbeentjes do you know if there is a separate issue we can follow for the underlying Jetbrains / Webstorm problem here?
When importing a SvelteKit type (e.g.
PageData
) in a.svelte
file, the IDE thinks it does not know$types
. When importing a SvelteKit type (e.g.PageServerLoad
) from a .ts file, it does work properly.Edit [30th of August]: I have rephrased the issue to the issue I am actually facing. Text below was original text
I am upgrading one of my projects to the newest version SvelteKit. I am seeing some errors in my code which are not errors. So an error inside Webstorm and the Svelte plugin.Since the new router changes to SvelteKit, there are some errors in the plugin. For example, the following error.Module '"./$types"' has no exported member 'Load'.
This happens on animport type { Load } from './$types';
How can I assist in fixing these? Where do I start?