Broken auto generation of types #6444
Labels
bug
Something isn't working
p2-nice-to-have
SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
types / typescript
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 theimport('./$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 fresh1.0.0-next.454
project that I created withnpm init svelte@latest
(see reproduction example)Reproduction
Setup
npm i
npm run dev
(optional / has no effect for me)Check automatic type (re)generation
src/routes/+page.server.ts
foo
to something elsescr/routes/+page.svelte
PageData
reflects the above changesCheck manual type (re)generation
src/routes/+page.server.ts
foo
to something elsescr/routes/+page.svelte
PageData
reflects the above changesnpm run sync
PageData
reflects the above changesLogs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: