1- /**
2- * Type definitions for React Router RSC (React Server Components) APIs.
3- *
4- * These types mirror the unstable RSC APIs from react-router v7.9.0+.
5- * All RSC APIs in React Router are prefixed with `unstable_` and subject to change.
6- */
7-
8- /**
9- * RSC route configuration entry - mirrors `unstable_RSCRouteConfigEntry` from react-router.
10- */
11- export interface RSCRouteConfigEntry {
12- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13- [ key : string ] : any ;
14- path ?: string ;
15- index ?: boolean ;
16- caseSensitive ?: boolean ;
17- id ?: string ;
18- children ?: RSCRouteConfigEntry [ ] ;
19- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20- lazy ?: ( ) => Promise < any > ;
21- }
22-
231/**
242 * RSC payload types - mirrors the various payload types from react-router.
253 */
@@ -57,17 +35,6 @@ export type DecodeFormStateFunction = (actionResult: any, body: FormData, option
5735export type LoadServerActionFunction = ( id : string ) => Promise < any > ;
5836// eslint-disable-next-line @typescript-eslint/no-explicit-any
5937export type SSRCreateFromReadableStreamFunction = ( stream : ReadableStream < Uint8Array > ) => Promise < any > ;
60- export type BrowserCreateFromReadableStreamFunction = (
61- stream : ReadableStream < Uint8Array > ,
62- options ?: { temporaryReferences ?: unknown } ,
63- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64- ) => Promise < any > ;
65-
66- /**
67- * Router context provider - mirrors `RouterContextProvider` from react-router.
68- */
69- // eslint-disable-next-line @typescript-eslint/no-explicit-any
70- export type RouterContextProvider = any ;
7138
7239/**
7340 * Arguments for `unstable_matchRSCServerRequest`.
@@ -80,7 +47,8 @@ export interface MatchRSCServerRequestArgs {
8047 /** Function to decode server function arguments */
8148 decodeReply ?: DecodeReplyFunction ;
8249 /** Per-request context provider instance */
83- requestContext ?: RouterContextProvider ;
50+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51+ requestContext ?: any ;
8452 /** Function to load a server action by ID */
8553 loadServerAction ?: LoadServerActionFunction ;
8654 /** Function to decode server actions */
@@ -92,7 +60,8 @@ export interface MatchRSCServerRequestArgs {
9260 /** The Request to match against */
9361 request : Request ;
9462 /** Route definitions */
95- routes : RSCRouteConfigEntry [ ] ;
63+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
64+ routes : any [ ] ;
9665 /** Function to generate Response encoding the RSC payload */
9766 generateResponse : (
9867 match : RSCMatch ,
@@ -128,22 +97,6 @@ export interface RouteRSCServerRequestArgs {
12897 */
12998export type RouteRSCServerRequestFn = ( args : RouteRSCServerRequestArgs ) => Promise < Response > ;
13099
131- /**
132- * Props for `unstable_RSCHydratedRouter` component.
133- */
134- export interface RSCHydratedRouterProps {
135- /** Function to decode RSC payloads from server */
136- createFromReadableStream : BrowserCreateFromReadableStreamFunction ;
137- /** Optional fetch implementation */
138- fetch ?: ( request : Request ) => Promise < Response > ;
139- /** The decoded RSC payload to hydrate */
140- payload : RSCPayload ;
141- /** Route discovery behavior: "eager" or "lazy" */
142- routeDiscovery ?: 'eager' | 'lazy' ;
143- /** Function that returns a router context provider instance */
144- getContext ?: ( ) => RouterContextProvider ;
145- }
146-
147100/**
148101 * Context for server component wrapping.
149102 */
0 commit comments