-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
The auto generated types like PageData
are not updated automatically when editing files in newer svelte-kit versions.
Example: Changing the return type of the load
function in +page.server.ts
does not automatically change the import('./$types').PageData
type in +page.svelte
I first thought that it might be an issue with nvim+lsp but I get the same behavior using vscode.
It seems that this is caused by svelte-kit sync
not running automatically on write of a file.
Running svelte-kit sync
manually generates the correct types. However reopening the editor or restarting the svelte-languageserver is necessary in order to display the changed types correctly in the editor.
I don't remember that I had this issue in versions prior to the big change of the load API.
The behavior is present in a project that I'm currently migrating to 1.0.0-next.406
and in a fresh 1.0.0-next.454
project that I created with npm init svelte@latest
(see reproduction example)
Reproduction
Setup
- Clone the reproduction repo https://github.com/icalvin102/animated-octo-memory
- Install dependencies
npm i
- Run dev server
npm run dev
(optional / has no effect for me)
Check automatic type (re)generation
- Open
src/routes/+page.server.ts
- Change property name of return value from
foo
to something else - Save file
- Open
scr/routes/+page.svelte
- Check if hover info on
PageData
reflects the above changes - Repeat a few times
Check manual type (re)generation
- Open
src/routes/+page.server.ts
- Change property name of return value from
foo
to something else - Save file
- Open
scr/routes/+page.svelte
- Check if hover info on
PageData
reflects the above changes - Run
npm run sync
- Restart svelte language server or restart editor
- Check if hover info on
PageData
reflects the above changes
Logs
No response
System Info
Editors:
NVIM: v0.7.2
vscodium: 1.70.2.22230-2
svelte-languageserver: 0.14.33
System:
OS: Linux 5.19 Arch Linux
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 12.34 GB / 31.29 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 16.16.0 - /usr/bin/node
npm: 8.17.0 - /usr/bin/npm
Browsers:
Brave Browser: 104.1.42.88
Firefox: 103.0.2
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.69
@sveltejs/kit: next => 1.0.0-next.454
svelte: ^3.44.0 => 3.49.0
vite: ^3.1.0-beta.1 => 3.1.0-beta.1
Severity
blocking an upgrade
Additional Information
No response