Skip to content

Commit 2506478

Browse files
authored
docs(start): use router package for module declaration to type the request context (#7427)
1 parent 86b5ca0 commit 2506478

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

docs/start/framework/react/guide/server-entry-point.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default createServerEntry({
6464

6565
When your server needs to pass additional, typed data into request handlers (for example, authenticated user info, a database connection, or per-request flags), register a request context type via TypeScript module augmentation. The registered context is delivered as the second argument to the server `fetch` handler and is available throughout the server-side middleware chain — including global middleware, request/function middleware, server routes, server functions, and the router itself.
6666

67-
To add types for your request context, augment the `Register` interface from `@tanstack/react-start` with a `server.requestContext` property. The runtime `context` you pass to `handler.fetch` will then match that type. Example:
67+
To add types for your request context, augment the `Register` interface from `@tanstack/react-router` with a `server.requestContext` property. The runtime `context` you pass to `handler.fetch` will then match that type. Example:
6868

6969
```tsx
7070
import handler, { createServerEntry } from '@tanstack/react-start/server-entry'
@@ -74,7 +74,7 @@ type MyRequestContext = {
7474
foo: number
7575
}
7676

77-
declare module '@tanstack/react-start' {
77+
declare module '@tanstack/react-router' {
7878
interface Register {
7979
server: {
8080
requestContext: MyRequestContext
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
ref: docs/start/framework/react/guide/server-entry-point.md
33
replace:
4-
{ '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }
4+
{
5+
'@tanstack/react-start': '@tanstack/solid-start',
6+
'@tanstack/react-router': '@tanstack/solid-router',
7+
'React': 'SolidJS',
8+
}
59
---

0 commit comments

Comments
 (0)