Skip to content

fix: extend Svelte Config type#13982

Merged
teemingc merged 4 commits intomainfrom
extend-svelte-config-type
Jul 11, 2025
Merged

fix: extend Svelte Config type#13982
teemingc merged 4 commits intomainfrom
extend-svelte-config-type

Conversation

@teemingc
Copy link
Copy Markdown
Member

@teemingc teemingc commented Jul 10, 2025

This PR changes our Config type to extend the VPS Config type instead of trying to duplicate it like we are now.

TODO:

  • check that the options are consistent with the user's installed VPS rather than the version we've installed in our Kit repo

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 10, 2025

🦋 Changeset detected

Latest commit: 3b26193

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot
Copy link
Copy Markdown

@teemingc teemingc mentioned this pull request Jul 10, 2025
6 tasks
@teemingc teemingc marked this pull request as ready for review July 10, 2025 04:23
@teemingc teemingc requested a review from dominikg July 10, 2025 04:23
@dummdidumm
Copy link
Copy Markdown
Member

Just to double-check, these types exist in the correct way since the vps version that we have a peer dep on, right?

@teemingc
Copy link
Copy Markdown
Member Author

teemingc commented Jul 10, 2025

Just to double-check, these types exist in the correct way since the vps version that we have a peer dep on, right?

Yes. I tested this by installing this PR into a new SvelteKit project.

One thing to think about is how to link to the VPS config type and let people know it's based on their VPS version in https://svelte-dev-git-preview-kit-13982-svelte.vercel.app/docs/kit/configuration#Config . Should we explain it in the Config type's JSDoc or mention it here?

## Config
> TYPES: Configuration#Config

@dominikg
Copy link
Copy Markdown
Contributor

SvelteConfig is exported by v-p-s@3 which is the lowest version sveltekit supports.
However i'm not sure if this https://github.com/sveltejs/vite-plugin-svelte/blob/9fab1303820d6219f97ff8e365807785e21af5c6/packages/vite-plugin-svelte/types/index.d.ts#L3 worked for svelte@4, digging into that now

@dominikg
Copy link
Copy Markdown
Contributor

looks like it works, setting up an old kit project via pnpm create svelte@6 and linking this branch

devDependencies:
@sveltejs/kit file:../../sveltejs/kit/packages/kit(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.20)(vite@5.4.19(@types/node@24.0.12)))(svelte@4.2.20)(vite@5.4.19(@types/node@24.0.12))
@sveltejs/vite-plugin-svelte 3.1.2
svelte 4.2.20
is 📦 v0.0.1 via  v22.17.0 
develop/reproductions/old-kit ❯ tsc --allowJs --checkJs --skipLibCheck --noEmit svelte.config.js
is 📦 v0.0.1 via  v22.17.0 
develop/reproductions/old-kit ❯ 

i had to install @types/node and set up a tsconfig.json that covers svelte.config.js to make it work

@dominikg
Copy link
Copy Markdown
Contributor

Not getting autocomplete for onwarn in intellij, but works in vscode
image

@teemingc teemingc merged commit 06e1d2c into main Jul 11, 2025
18 checks passed
@teemingc teemingc deleted the extend-svelte-config-type branch July 11, 2025 02:32
@github-actions github-actions bot mentioned this pull request Jul 11, 2025
Copilot AI pushed a commit to Stadly/kit that referenced this pull request Mar 6, 2026
* extend svelte config type

* changeset

* format

* add link to vite-plugin-svelte config options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants