Skip to content

refactor(start): export and use its own Register interface#7428

Draft
SeanCassiere wants to merge 8 commits into
mainfrom
refactor/adjust-types-for-start-register-declaration
Draft

refactor(start): export and use its own Register interface#7428
SeanCassiere wants to merge 8 commits into
mainfrom
refactor/adjust-types-for-start-register-declaration

Conversation

@SeanCassiere
Copy link
Copy Markdown
Member

@SeanCassiere SeanCassiere commented May 17, 2026

In reference to #7399

Summary by CodeRabbit

  • Documentation

    • Updated server entry point guides to use correct module augmentation targets for TypeScript request context typing across React, Solid, and Vue frameworks.
  • Refactor

    • Consolidated Register interface exports within Start packages, improving type consistency across framework implementations.

Review Change Stack

…t-start

Add a Start-owned Register interface that extends router-core's
Register, then export and consume it from `start-client-core`.

This lets declarations against `@tanstack/react-start`, including
`server.requestContext`, flow into Start-specific type consumers instead
of requiring users to augment `@tanstack/router-core` or
`@tanstack/react-router` directly.

Router-core Register augmentations remain compatible because Start's
Register extends the core Register.
Import Register from `@tanstack/start-client-core` in
`createStartHandler` instead of `@tanstack/router-core`.

This makes the server handler default to Start's augmentation surface,
allowing `@tanstack/react-start` Register declarations such as
`server.requestContext` to flow into RequestHandler typing.
…e the request context (#7427)

This reverts commit 2506478 since these
changes now can infer the types off of Start's Register interface
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0bd3a0c4-650b-43b1-82fb-5d72bcbac844

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR refactors the Register type to be owned and exported by Start packages rather than imported from router packages. Start-client-core introduces a local Register interface; framework-specific start packages import from their own package; documentation and E2E tests demonstrate the new module augmentation pattern.

Changes

Register Interface Ownership Refactor

Layer / File(s) Summary
Local Register interface in start-client-core
packages/start-client-core/src/register.ts, packages/start-client-core/src/index.tsx, packages/start-client-core/src/createMiddleware.ts, packages/start-client-core/src/createStart.ts
A new register.ts file exports a Register interface extending router-core's type. Internal modules and the package entrypoint are updated to import and re-export this local Register.
Framework-specific start packages adopt local Register
packages/react-start/src/default-entry/server.ts, packages/solid-start/src/default-entry/server.ts, packages/vue-start/src/default-entry/server.ts
React, Solid, and Vue start packages update their server entry points to import Register from their respective start package (e.g., @tanstack/react-start) instead of from router packages.
Start server-core package wiring
packages/start-server-core/src/createStartHandler.ts
The createStartHandler module updates its type imports to source Register from @tanstack/start-client-core instead of from router-core.
E2E tests and documentation updates
e2e/react-start/basic/src/server.ts, e2e/solid-start/basic/src/server.ts, e2e/vue-start/basic/src/server.ts, docs/start/framework/react/guide/server-entry-point.md, docs/start/framework/solid/guide/server-entry-point.md, .changeset/thick-sloths-write.md
E2E test servers in React, Solid, and Vue augment their respective start package's Register interface and pass typed request context through handler.fetch. Documentation examples updated to target start packages for TypeScript module augmentation. Changeset declares patch versions and refactor note.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • TanStack/router#7427: Updates React server entry point documentation for TypeScript module augmentation targeting @tanstack/react-router (related refactor of the same documentation pattern).

Poem

🐰 The Register hops into its own nest,
No longer borrowed from the router's best,
Each Start package now holds its own key,
TypeScript types flow wild and free!
Context flows sweetly through the land,
Built by hands, understood by the brand. 🚀

🚥 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 accurately describes the main change: refactoring the Start packages to export and use their own Register interface instead of importing from router-core or router packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/adjust-types-for-start-register-declaration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 17, 2026

View your CI Pipeline Execution ↗ for commit 89310e0

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

☁️ Nx Cloud last updated this comment at 2026-05-18 00:06:15 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 17, 2026

🚀 Changeset Version Preview

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

🟩 Patch bumps

Package Version Reason
@tanstack/react-start 1.168.6 → 1.168.7 Changeset
@tanstack/solid-start 1.168.6 → 1.168.7 Changeset
@tanstack/start-client-core 1.169.4 → 1.169.5 Changeset
@tanstack/start-server-core 1.168.4 → 1.168.5 Changeset
@tanstack/vue-start 1.168.6 → 1.168.7 Changeset
@tanstack/react-start-client 1.167.4 → 1.167.5 Dependent
@tanstack/react-start-rsc 0.1.6 → 0.1.7 Dependent
@tanstack/react-start-server 1.167.4 → 1.167.5 Dependent
@tanstack/solid-start-client 1.167.4 → 1.167.5 Dependent
@tanstack/solid-start-server 1.167.4 → 1.167.5 Dependent
@tanstack/start-plugin-core 1.170.6 → 1.170.7 Dependent
@tanstack/start-static-server-functions 1.167.4 → 1.167.5 Dependent
@tanstack/vue-start-client 1.167.4 → 1.167.5 Dependent
@tanstack/vue-start-server 1.167.4 → 1.167.5 Dependent

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 17, 2026

Bundle Size Benchmarks

  • Commit: 6eacd9c2ffe5
  • Measured at: 2026-05-17T23:59:03.879Z
  • Baseline source: history:ee8a6753da78
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.33 KiB 0 B (0.00%) 87.19 KiB 274.21 KiB 75.94 KiB ▁▁▁████████
react-router.full 90.85 KiB 0 B (0.00%) 90.72 KiB 285.71 KiB 78.92 KiB ▁▁▁████████
solid-router.minimal 35.55 KiB 0 B (0.00%) 35.43 KiB 106.50 KiB 32.01 KiB ▁▁▁████████
solid-router.full 40.27 KiB 0 B (0.00%) 40.14 KiB 120.71 KiB 36.18 KiB ▁▁▁████████
vue-router.minimal 53.33 KiB 0 B (0.00%) 53.19 KiB 151.65 KiB 47.89 KiB ▁▁▁████████
vue-router.full 58.45 KiB 0 B (0.00%) 58.32 KiB 167.82 KiB 52.41 KiB ▁▁▁████████
react-start.minimal 102.01 KiB 0 B (0.00%) 101.87 KiB 322.65 KiB 88.12 KiB ▁▁▁████████
react-start.full 105.44 KiB 0 B (0.00%) 105.30 KiB 332.98 KiB 91.17 KiB ▁▁▁██▇▇▇▇▇▇
react-start.rsbuild.minimal 99.63 KiB 0 B (0.00%) 99.46 KiB 317.11 KiB 85.65 KiB ▁▁▁████████
react-start.rsbuild.full 102.93 KiB 0 B (0.00%) 102.76 KiB 327.55 KiB 88.47 KiB ▁▁▁████████
solid-start.minimal 49.66 KiB 0 B (0.00%) 49.53 KiB 152.62 KiB 43.80 KiB ▁▁▁████████
solid-start.full 55.44 KiB 0 B (0.00%) 55.31 KiB 169.52 KiB 48.72 KiB ▁▁▁████████

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@SeanCassiere SeanCassiere changed the title refactor: start should export and use its own Register interface refactor(start): export and use its own Register interface May 17, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 17, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7428

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 89310e0

@SeanCassiere SeanCassiere marked this pull request as ready for review May 17, 2026 23:29
@SeanCassiere SeanCassiere marked this pull request as draft May 17, 2026 23:34
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 17, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing refactor/adjust-types-for-start-register-declaration (89310e0) with main (ee8a675)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

  2. No successful run was found on main (2506478) during the generation of this report, so ee8a675 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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.

1 participant