-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
![image](https://private-user-images.githubusercontent.com/11315492/245043283-0e83260a-cae3-42e8-b300-c23041054b91.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM4ODc0NzcsIm5iZiI6MTcyMzg4NzE3NywicGF0aCI6Ii8xMTMxNTQ5Mi8yNDUwNDMyODMtMGU4MzI2MGEtY2FlMy00MmU4LWIzMDAtYzIzMDQxMDU0YjkxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE3VDA5MzI1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyMDQyYzcwYWU1MDRhNjgxODMyZTc3MGE5ZDMwMmZhZTRlOGM0ZTYyYmY3ZWIwZjQyMDc3Mjc2OTYxM2FhMmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YRLq05d4qZIHcx9FjPR7z5rdSoTeAfcI5qHaYP49MFI)
+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: