fix: generate valid Path types for routes with optional or rest params, several params in one segment, or escape sequences - #16577
Open
Nic-Polumeyv wants to merge 7 commits into
Conversation
…gment or several params in one segment
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/15d2da79ecf3bfab3771638325213bbe5f186b61Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: 15d2da7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Nic-Polumeyv
marked this pull request as draft
July 30, 2026 02:37
Contributor
Author
|
Needed to tidy up a few things and fix an omission bug. Opening in a couple min! |
Nic-Polumeyv
marked this pull request as ready for review
July 30, 2026 18:49
Path types for routes with optional or rest params, several params in one segment, or escape sequences
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/[[lang]]/aboutgenerates thePathmember{string}/about, a plain string rather than a template: #16430 appended.slice(1)to a branch whose replacement had already consumed the leading slash, chopping the$. Sinceresolve()is bounded byPath,resolve('en/about')is rejected whileresolve('{string}/about')type checks.The pathname is now built from the route's segments. An omitted optional param contributes its own pathname instead of absorbing the following
/, soxyzaboutis no longer admitted, and a second param in one segment (/[foo]-[bar]) no longer leaks in verbatim.Rest params get the same treatment, since
[...path]can match zero segments. Escape sequences are expanded the same way #16570 expands them inresolve, so/[x+2e]well-knowncontributes.well-knownrather than the raw route id.