-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the problem
There is no way to cleanly modify the types generated by @sveltejs/kit/src/core/sync/write_types/index.js
(example: .svelte-kit/types/src/routes/.../$types.d.ts)
Describe the proposed solution
Add a pipe hook in svelte.config.ts that user can use to rewrite the types before they get saved
Alternatives considered
Waiting for the types to generate then overwriting it, but this forces ide to do a lot of tsconfig recalculations which will cause unnecessary performance issues and general confusion while the types recalculate
Importance
i cannot use SvelteKit without it
Additional Information
I faced this issue while working on https://github.com/SaaSTEMLY/sveltekit-auto-openapi, I wanted to extend RequestEvent to contain types that are generated "magically" from a _config object above it without having to wrap it with a boilerplate helper function
Currently Im using the alternative of "waiting until the types generate and then overriting it", but this makes my IDE flash with different types everytime I save which is bad developer experience, and the problem would get worse the more files that generate at once, example running vite dev triggers sveltekit to rewrite all the types, so I have to overwrite all the types again right after user runs vite dev