-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSCode shows error/any
for generated types
#2053
Comments
Any update on this? I'm having the same issue, haven't found a workaround so far. |
Doesn't seem limited to VSC by the way, same issue on Sublime. |
I consistently have this problem every time I open a file that uses auto-generated types. While the issue goes away after editing the file, it would be better if this didn't happen at all. |
I wrote about this here sveltejs/kit#10703 I am having this problem on a daily basis to such an extent that it is unusable. My impression is that it has increased in frequency (or maybe it is just my app that has grown, which amplifies the problem). Any update / work on this? |
#2053 If a file is patched the first time, typescript might have cached the unpatched version. It won't update even if we return the patched version in getScriptSnapshot. This should only happen to files the client opens after the first compilation of the proxy language service. In the first compilation, there won't be any files in the cache. And once there are any updates TypeScript will reparse the file with the patched snapshot.
Describe the bug
SvelteKit generated types often don't work correctly with VSCode. It could be a bigger issue than just with
Locals
, I'm not sure.In my production repo I have a
+layout.ts
which receivesIn the reproduction repo I have a
+layout.ts
which receives data from+layout.server.ts
.If I open
+layout.ts
in VSCode, it shows thedata
type asany
:Then if I open the
+layout.server.ts
, it shows the reason for that:If I just update
+layout.server.ts
, the error goes away and the types are correct in both files.Reproduction
Repo: https://github.com/probablykasper/sveltekit-generated-any
Screen.Recording.2023-06-12.at.07.32.37.mp4
Expected behaviour
The type error shouldn't happen. If some error like this does happen, it would be nice to avoid silently using
any
and instead provide some hint that there's an error somewhereSystem Info
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
Tested with a fresh VSCode instance, with only the Svelte for VSCode extension
The text was updated successfully, but these errors were encountered: