Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 7b54446 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 |
TuplePaths intersected each sibling with the recursion on the rest, so every route nested one more instantiation and 47 or more siblings (a flat file-system manifest of that many pages) failed with TS2589. Folding into an accumulator makes it tail-recursive; the member order is unchanged.
akazwz
force-pushed
the
fix/paths-many-routes
branch
from
November 25, 2026 14:34
203fd3c to
7b54446
Compare
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.
A router with 47 or more sibling routes fails to type-check at
createRouterwith TS2589, "Type instantiation is excessively deep and possibly infinite". The file-system router emits one flat entry per page, so an app with about 50 pages hits it as soon as it readspaths. I found this while building an app template on@solidjs/router2.0.1; there is no issue for it.Root cause
TuplePathsintersected each sibling with the recursion on the rest (RouteContrib<H, PAcc> & TuplePaths<T, PAcc>). That is not a tail call, so every route nested one more instantiation until the compiler's depth limit.Changes
TuplePathsfolds the siblings into an accumulator, which makes it tail-recursive. The intersection keeps the same member order, which thePARAM_NEXTmerging of sibling param calls relies on. Added a patch changeset.Verification
test/paths-types.spec.tswith 100 sibling routes. It fails onmainwith TS2589 and passes with the fix. Inline route arrays,defineRoutesandfileRoutesmanifests all fail at 47 siblings onmainand type-check up to at least 400 with the fix.pathstypes (every call signature in order and every property, five levels deep), printed through the compiler API, are identical before and after for the existing spec routes and other shapes: sibling param prefixes in both orders, lazy children, multi-path routes, optional params, splats andfileRoutesmanifests.pnpm test: 762 client tests, 110 server tests andtest:typespass.pnpm buildpasses.tsc --extendedDiagnosticsontsconfig.test.jsonwithout the new case: 171,525 instantiations instead of 191,537.