Skip to content

fix: MatchRoute types#7139

Merged
schiller-manuel merged 2 commits intomainfrom
fix-7128
Apr 10, 2026
Merged

fix: MatchRoute types#7139
schiller-manuel merged 2 commits intomainfrom
fix-7128

Conversation

@schiller-manuel
Copy link
Copy Markdown
Contributor

@schiller-manuel schiller-manuel commented Apr 10, 2026

fixes #7128

Summary by CodeRabbit

  • Bug Fixes

    • Corrected type inference for MatchRoute children callbacks so route parameters are resolved from the target route, improving accurate parameter types in child render functions across React, Solid, and Vue adapters.
  • Tests

    • Added type-level tests to validate the corrected parameter inference for children render callbacks.
  • Documentation

    • Added a changeset entry to mark the patch releases reflecting this fix.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 235c5b03-7ad2-4c75-ba6a-7496218f0cff

📥 Commits

Reviewing files that changed from the base of the PR and between 083db5a and 44eb409.

📒 Files selected for processing (2)
  • packages/react-router/tests/Matches.test-d.tsx
  • packages/solid-router/tests/Matches.test-d.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/react-router/tests/Matches.test-d.tsx

📝 Walkthrough

Walkthrough

Corrects type inference for the MatchRoute component's children/slot parameter across React, Solid, and Vue adapters by deriving params from ResolveRoute<...>['types']['allParams'] instead of resolving via route path keys.

Changes

Cohort / File(s) Summary
Changeset
\.changeset/fair-phones-grow.md
Added changeset entry documenting patch releases for React, Solid, and Vue routers and noting the MatchRoute child callback parameter inference fix.
React Router Source
packages/react-router/src/Matches.tsx
Replaced RouteByPath/relative-path-based children params typing with Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>; removed unused type imports.
React Router Tests
packages/react-router/tests/Matches.test-d.tsx
Added a type-level test asserting MakeMatchRouteOptions<...>['children'] infers `params?: { id: string }
Solid Router Source
packages/solid-router/src/Matches.tsx
Applied the same type-level change as React: derive children params from ResolveRoute expansion and removed unused imports.
Solid Router Tests
packages/solid-router/tests/Matches.test-d.tsx
Added type-level test asserting MatchRoute children infer correct params under pathless layouts.
Vue Router Source
packages/vue-router/src/Matches.tsx
Updated MakeMatchRouteOptions children params typing to use ResolveRoute<...>['types']['allParams'] instead of RouteByPath+relative helpers; removed unused imports.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Hop hop, the types now find their way,
Params resolved from routes, no more stray.
Adapters aligned, the inference sings,
A rabbit cheers for tidier things!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: MatchRoute types' directly relates to the main objective of correcting type inference for the MatchRoute component's parameters.
Linked Issues check ✅ Passed All code changes implement the fix for issue #7128 by modifying parameter type inference in MatchRoute components across React, Solid, and Vue adapters to resolve from the target route instead of the route key.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing MatchRoute type inference across three adapters with matching test updates, aligned with issue #7128 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-7128

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react-router/tests/Matches.test-d.tsx`:
- Line 3: There are duplicate type-only imports from '../src' (e.g.,
MakeMatchRouteOptions and the other type imported later); consolidate them into
a single type import statement by combining the named types (e.g., import type {
MakeMatchRouteOptions, <OtherTypeName> } from '../src') and remove the redundant
import so lint rule import/no-duplicates is satisfied.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62e86816-93f3-4106-9108-8e97fc606791

📥 Commits

Reviewing files that changed from the base of the PR and between 1d31393 and 083db5a.

📒 Files selected for processing (6)
  • .changeset/fair-phones-grow.md
  • packages/react-router/src/Matches.tsx
  • packages/react-router/tests/Matches.test-d.tsx
  • packages/solid-router/src/Matches.tsx
  • packages/solid-router/tests/Matches.test-d.tsx
  • packages/vue-router/src/Matches.tsx

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Apr 10, 2026

View your CI Pipeline Execution ↗ for commit 44eb409

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 7m 23s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 30s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-10 19:33:23 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

🚀 Changeset Version Preview

3 package(s) bumped directly, 9 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.168.11 → 1.168.12 Changeset
@tanstack/solid-router 1.168.10 → 1.168.11 Changeset
@tanstack/vue-router 1.168.10 → 1.168.11 Changeset
@tanstack/react-start 1.167.18 → 1.167.19 Dependent
@tanstack/react-start-client 1.166.27 → 1.166.28 Dependent
@tanstack/react-start-server 1.166.27 → 1.166.28 Dependent
@tanstack/solid-start 1.167.17 → 1.167.18 Dependent
@tanstack/solid-start-client 1.166.25 → 1.166.26 Dependent
@tanstack/solid-start-server 1.166.25 → 1.166.26 Dependent
@tanstack/vue-start 1.167.17 → 1.167.18 Dependent
@tanstack/vue-start-client 1.166.25 → 1.166.26 Dependent
@tanstack/vue-start-server 1.166.25 → 1.166.26 Dependent

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7139

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7139

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7139

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7139

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7139

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7139

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7139

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7139

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7139

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7139

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7139

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7139

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7139

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7139

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7139

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7139

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7139

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7139

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7139

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7139

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7139

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7139

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7139

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7139

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7139

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7139

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7139

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7139

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7139

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7139

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7139

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7139

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7139

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7139

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7139

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7139

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7139

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7139

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7139

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7139

commit: 44eb409

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ The fix from Nx Cloud was applied

We fixed the ESLint failures in Matches.test-d.tsx for both react-router and solid-router by correcting the import ordering introduced by the PR. The PR added new type imports (MakeMatchRouteOptions and React) before the existing regular '../src' import, violating import/order (regular imports must precede type-only imports) and creating duplicate '../src' entries that violated import/no-duplicates. These changes reorder the imports so all regular imports appear first, followed by type-only imports, and merge the duplicate '../src' type imports into a single statement.

Tip

We verified this fix by re-running @tanstack/solid-router:test:eslint, @tanstack/react-router:test:eslint.

Suggested Fix changes
diff --git a/packages/react-router/tests/Matches.test-d.tsx b/packages/react-router/tests/Matches.test-d.tsx
index 479b41d788..89e1088454 100644
--- a/packages/react-router/tests/Matches.test-d.tsx
+++ b/packages/react-router/tests/Matches.test-d.tsx
@@ -1,6 +1,4 @@
 import { expectTypeOf, test } from 'vitest'
-import type * as React from 'react'
-import type { MakeMatchRouteOptions } from '../src'
 import {
   MatchRoute,
   createRootRoute,
@@ -10,7 +8,8 @@ import {
   useMatchRoute,
   useMatches,
 } from '../src'
-import type { AnyRouteMatch, RouteMatch } from '../src'
+import type * as React from 'react'
+import type { AnyRouteMatch, MakeMatchRouteOptions, RouteMatch } from '../src'
 
 const rootRoute = createRootRoute()
 
diff --git a/packages/solid-router/tests/Matches.test-d.tsx b/packages/solid-router/tests/Matches.test-d.tsx
index 16bd90e8a3..346e8c45cb 100644
--- a/packages/solid-router/tests/Matches.test-d.tsx
+++ b/packages/solid-router/tests/Matches.test-d.tsx
@@ -1,5 +1,4 @@
 import { expectTypeOf, test } from 'vitest'
-import type { MakeMatchRouteOptions } from '../src'
 import {
   MatchRoute,
   createRootRoute,
@@ -11,6 +10,7 @@ import {
 } from '../src'
 import type { AnyRouteMatch, RouteMatch } from '@tanstack/router-core'
 import type * as Solid from 'solid-js'
+import type { MakeMatchRouteOptions } from '../src'
 
 const rootRoute = createRootRoute()
 

Revert fix via Nx Cloud  

View interactive diff ↗

➡️ This fix was applied by manuel.schiller@caligano.de

🎓 Learn more about Self-Healing CI on nx.dev

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 10, 2026

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing fix-7128 (44eb409) with main (b29d64d)

Open in CodSpeed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Bundle Size Benchmarks

  • Commit: b29d64de0c40
  • Measured at: 2026-04-10T19:23:10.397Z
  • Baseline source: history:b29d64de0c40
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.52 KiB 0 B (0.00%) 275.76 KiB 75.94 KiB █▁▁▁▁▁▂▃▃▅▇
react-router.full 90.78 KiB 0 B (0.00%) 286.95 KiB 78.89 KiB █▁▁▁▁▁▂▂▂▂▃
solid-router.minimal 35.60 KiB 0 B (0.00%) 107.36 KiB 31.94 KiB ▅▁▁▁▁▁▁▅▅▆█
solid-router.full 40.07 KiB 0 B (0.00%) 120.90 KiB 35.96 KiB ▆▁▁▁▁▁▁▅▅▆█
vue-router.minimal 53.46 KiB 0 B (0.00%) 153.16 KiB 48.00 KiB ▅▁▁▁▁▁▂▃▃▆█
vue-router.full 58.36 KiB 0 B (0.00%) 168.62 KiB 52.25 KiB ▄▁▁▁▁▁▁▂▂▆█
react-start.minimal 102.02 KiB 0 B (0.00%) 324.00 KiB 88.20 KiB █▁▂▂▂▂▃▃▃▂▅
react-start.full 105.41 KiB 0 B (0.00%) 334.35 KiB 91.08 KiB █▁▁▁▂▂▃▃▄▅▇
solid-start.minimal 49.70 KiB 0 B (0.00%) 153.61 KiB 43.77 KiB ▅▁▁▁▁▁▂▅▅▆█
solid-start.full 55.21 KiB 0 B (0.00%) 169.84 KiB 48.58 KiB ▅▁▁▁▁▁▂▅▆▆█

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

Co-authored-by: schiller-manuel <schiller-manuel@users.noreply.github.com>
@schiller-manuel schiller-manuel merged commit 540d221 into main Apr 10, 2026
16 checks passed
@schiller-manuel schiller-manuel deleted the fix-7128 branch April 10, 2026 19:35
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.

Incorrect type inference for the match param in MatchRoute component

1 participant