react-router 7.2.0-pre.2 → 7.2.0-pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/development/{chunk-ULARE4JK.mjs → chunk-N43MPAHC.mjs} +2 -2
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/{fog-of-war-yKFj2vdd.d.mts → fog-of-war-BALYJxf_.d.mts} +1 -1
- package/dist/{production/fog-of-war-rn7nVSAv.d.ts → development/fog-of-war-Cm1iXIp7.d.ts} +1 -1
- package/dist/development/index.d.mts +4 -4
- package/dist/development/index.d.ts +4 -4
- package/dist/development/index.js +2 -2
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.d.mts +81 -2
- package/dist/development/lib/types/route-module.d.ts +81 -2
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-CfLfC_Bh.d.ts → route-data-BmvbmBej.d.mts} +75 -2
- package/dist/{production/route-data-CfLfC_Bh.d.mts → development/route-data-BmvbmBej.d.ts} +75 -2
- package/dist/production/{chunk-QRCLBIUO.mjs → chunk-WSLSTL6H.mjs} +2 -2
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/{fog-of-war-yKFj2vdd.d.mts → fog-of-war-BALYJxf_.d.mts} +1 -1
- package/dist/{development/fog-of-war-rn7nVSAv.d.ts → production/fog-of-war-Cm1iXIp7.d.ts} +1 -1
- package/dist/production/index.d.mts +4 -4
- package/dist/production/index.d.ts +4 -4
- package/dist/production/index.js +2 -2
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.d.mts +81 -2
- package/dist/production/lib/types/route-module.d.ts +81 -2
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-CfLfC_Bh.d.ts → route-data-BmvbmBej.d.mts} +75 -2
- package/dist/{development/route-data-CfLfC_Bh.d.mts → production/route-data-BmvbmBej.d.ts} +75 -2
- package/package.json +1 -1
|
@@ -266,8 +266,28 @@ type Submission = {
|
|
|
266
266
|
* this as a private implementation detail in case they diverge in the future.
|
|
267
267
|
*/
|
|
268
268
|
interface DataFunctionArgs<Context> {
|
|
269
|
+
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
|
269
270
|
request: Request;
|
|
271
|
+
/**
|
|
272
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
273
|
+
* @example
|
|
274
|
+
* // app/routes.ts
|
|
275
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
276
|
+
*
|
|
277
|
+
* // app/team.tsx
|
|
278
|
+
* export function loader({
|
|
279
|
+
* params,
|
|
280
|
+
* }: Route.LoaderArgs) {
|
|
281
|
+
* params.teamId;
|
|
282
|
+
* // ^ string
|
|
283
|
+
* }
|
|
284
|
+
**/
|
|
270
285
|
params: Params;
|
|
286
|
+
/**
|
|
287
|
+
* This is the context passed in to your server adapter's getLoadContext() function.
|
|
288
|
+
* It's a way to bridge the gap between the adapter's request/response API with your React Router app.
|
|
289
|
+
* It is only applicable if you are using a custom server adapter.
|
|
290
|
+
*/
|
|
271
291
|
context?: Context;
|
|
272
292
|
}
|
|
273
293
|
/**
|
|
@@ -305,18 +325,56 @@ interface ActionFunction<Context = any> {
|
|
|
305
325
|
* Arguments passed to shouldRevalidate function
|
|
306
326
|
*/
|
|
307
327
|
interface ShouldRevalidateFunctionArgs {
|
|
328
|
+
/** This is the url the navigation started from. You can compare it with `nextUrl` to decide if you need to revalidate this route's data. */
|
|
308
329
|
currentUrl: URL;
|
|
330
|
+
/** These are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the URL that can be compared to the `nextParams` to decide if you need to reload or not. Perhaps you're using only a partial piece of the param for data loading, you don't need to revalidate if a superfluous part of the param changed. */
|
|
309
331
|
currentParams: AgnosticDataRouteMatch["params"];
|
|
332
|
+
/** In the case of navigation, this the URL the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentUrl. */
|
|
310
333
|
nextUrl: URL;
|
|
334
|
+
/** In the case of navigation, these are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the next location the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentParams. */
|
|
311
335
|
nextParams: AgnosticDataRouteMatch["params"];
|
|
336
|
+
/** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
|
|
312
337
|
formMethod?: Submission["formMethod"];
|
|
338
|
+
/** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
|
|
313
339
|
formAction?: Submission["formAction"];
|
|
340
|
+
/** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
|
|
314
341
|
formEncType?: Submission["formEncType"];
|
|
342
|
+
/** The form submission data when the form's encType is `text/plain` */
|
|
315
343
|
text?: Submission["text"];
|
|
344
|
+
/** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
|
|
316
345
|
formData?: Submission["formData"];
|
|
346
|
+
/** The form submission data when the form's encType is `application/json` */
|
|
317
347
|
json?: Submission["json"];
|
|
348
|
+
/** The status code of the action response */
|
|
318
349
|
actionStatus?: number;
|
|
350
|
+
/**
|
|
351
|
+
* When a submission causes the revalidation this will be the result of the action—either action data or an error if the action failed. It's common to include some information in the action result to instruct shouldRevalidate to revalidate or not.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* export async function action() {
|
|
355
|
+
* await saveSomeStuff();
|
|
356
|
+
* return { ok: true };
|
|
357
|
+
* }
|
|
358
|
+
*
|
|
359
|
+
* export function shouldRevalidate({
|
|
360
|
+
* actionResult,
|
|
361
|
+
* }) {
|
|
362
|
+
* if (actionResult?.ok) {
|
|
363
|
+
* return false;
|
|
364
|
+
* }
|
|
365
|
+
* return true;
|
|
366
|
+
* }
|
|
367
|
+
*/
|
|
319
368
|
actionResult?: any;
|
|
369
|
+
/**
|
|
370
|
+
* By default, React Router doesn't call every loader all the time. There are reliable optimizations it can make by default. For example, only loaders with changing params are called. Consider navigating from the following URL to the one below it:
|
|
371
|
+
*
|
|
372
|
+
* /projects/123/tasks/abc
|
|
373
|
+
* /projects/123/tasks/def
|
|
374
|
+
* React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
|
|
375
|
+
*
|
|
376
|
+
* It's safest to always return defaultShouldRevalidate after you've done your specific optimizations that return false, otherwise your UI might get out of sync with your data on the server.
|
|
377
|
+
*/
|
|
320
378
|
defaultShouldRevalidate: boolean;
|
|
321
379
|
}
|
|
322
380
|
/**
|
|
@@ -473,8 +531,13 @@ declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = Agnos
|
|
|
473
531
|
interface UIMatch<Data = unknown, Handle = unknown> {
|
|
474
532
|
id: string;
|
|
475
533
|
pathname: string;
|
|
534
|
+
/**
|
|
535
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
|
|
536
|
+
**/
|
|
476
537
|
params: AgnosticRouteMatch["params"];
|
|
538
|
+
/** The return value from the matched route's loader or clientLoader */
|
|
477
539
|
data: Data;
|
|
540
|
+
/** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
|
|
478
541
|
handle: Handle;
|
|
479
542
|
}
|
|
480
543
|
/**
|
|
@@ -1558,6 +1621,16 @@ type Serializable = undefined | null | boolean | string | symbol | number | Arra
|
|
|
1558
1621
|
[key: PropertyKey]: Serializable;
|
|
1559
1622
|
} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
|
|
1560
1623
|
|
|
1624
|
+
/**
|
|
1625
|
+
* A brand that can be applied to a type to indicate that it will serialize
|
|
1626
|
+
* to a specific type when transported to the client from a loader.
|
|
1627
|
+
* Only use this if you have additional serialization/deserialization logic
|
|
1628
|
+
* in your application.
|
|
1629
|
+
*/
|
|
1630
|
+
type unstable_SerializesTo<T> = {
|
|
1631
|
+
unstable__ReactRouter_SerializesTo?: [T];
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1561
1634
|
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
1562
1635
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
1563
1636
|
type Func = (...args: any[]) => unknown;
|
|
@@ -1565,7 +1638,7 @@ type Pretty<T> = {
|
|
|
1565
1638
|
[K in keyof T]: T[K];
|
|
1566
1639
|
} & {};
|
|
1567
1640
|
|
|
1568
|
-
type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1641
|
+
type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1569
1642
|
[K in keyof T]: Serialize<T[K]>;
|
|
1570
1643
|
} : undefined;
|
|
1571
1644
|
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
|
|
@@ -1576,4 +1649,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
|
1576
1649
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1577
1650
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1578
1651
|
|
|
1579
|
-
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9,
|
|
1652
|
+
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, type unstable_SerializesTo as aA, createBrowserHistory as aB, invariant as aC, createRouter as aD, ErrorResponseImpl as aE, DataRouterContext as aF, DataRouterStateContext as aG, FetchersContext as aH, LocationContext as aI, NavigationContext as aJ, RouteContext as aK, ViewTransitionContext as aL, type RouteModule as aM, type History as aN, type ServerDataFrom as aO, type ClientDataFrom as aP, type Func as aQ, type Pretty as aR, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunction as ap, type ClientActionFunctionArgs as aq, type ClientLoaderFunction as ar, type ClientLoaderFunctionArgs as as, type HeadersArgs as at, type HeadersFunction as au, type MetaArgs as av, type MetaDescriptor as aw, type PageLinkDescriptor as ax, type HtmlLinkDescriptor as ay, type LinkDescriptor as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
|
|
@@ -266,8 +266,28 @@ type Submission = {
|
|
|
266
266
|
* this as a private implementation detail in case they diverge in the future.
|
|
267
267
|
*/
|
|
268
268
|
interface DataFunctionArgs<Context> {
|
|
269
|
+
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
|
269
270
|
request: Request;
|
|
271
|
+
/**
|
|
272
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
273
|
+
* @example
|
|
274
|
+
* // app/routes.ts
|
|
275
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
276
|
+
*
|
|
277
|
+
* // app/team.tsx
|
|
278
|
+
* export function loader({
|
|
279
|
+
* params,
|
|
280
|
+
* }: Route.LoaderArgs) {
|
|
281
|
+
* params.teamId;
|
|
282
|
+
* // ^ string
|
|
283
|
+
* }
|
|
284
|
+
**/
|
|
270
285
|
params: Params;
|
|
286
|
+
/**
|
|
287
|
+
* This is the context passed in to your server adapter's getLoadContext() function.
|
|
288
|
+
* It's a way to bridge the gap between the adapter's request/response API with your React Router app.
|
|
289
|
+
* It is only applicable if you are using a custom server adapter.
|
|
290
|
+
*/
|
|
271
291
|
context?: Context;
|
|
272
292
|
}
|
|
273
293
|
/**
|
|
@@ -305,18 +325,56 @@ interface ActionFunction<Context = any> {
|
|
|
305
325
|
* Arguments passed to shouldRevalidate function
|
|
306
326
|
*/
|
|
307
327
|
interface ShouldRevalidateFunctionArgs {
|
|
328
|
+
/** This is the url the navigation started from. You can compare it with `nextUrl` to decide if you need to revalidate this route's data. */
|
|
308
329
|
currentUrl: URL;
|
|
330
|
+
/** These are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the URL that can be compared to the `nextParams` to decide if you need to reload or not. Perhaps you're using only a partial piece of the param for data loading, you don't need to revalidate if a superfluous part of the param changed. */
|
|
309
331
|
currentParams: AgnosticDataRouteMatch["params"];
|
|
332
|
+
/** In the case of navigation, this the URL the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentUrl. */
|
|
310
333
|
nextUrl: URL;
|
|
334
|
+
/** In the case of navigation, these are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the next location the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentParams. */
|
|
311
335
|
nextParams: AgnosticDataRouteMatch["params"];
|
|
336
|
+
/** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
|
|
312
337
|
formMethod?: Submission["formMethod"];
|
|
338
|
+
/** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
|
|
313
339
|
formAction?: Submission["formAction"];
|
|
340
|
+
/** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
|
|
314
341
|
formEncType?: Submission["formEncType"];
|
|
342
|
+
/** The form submission data when the form's encType is `text/plain` */
|
|
315
343
|
text?: Submission["text"];
|
|
344
|
+
/** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
|
|
316
345
|
formData?: Submission["formData"];
|
|
346
|
+
/** The form submission data when the form's encType is `application/json` */
|
|
317
347
|
json?: Submission["json"];
|
|
348
|
+
/** The status code of the action response */
|
|
318
349
|
actionStatus?: number;
|
|
350
|
+
/**
|
|
351
|
+
* When a submission causes the revalidation this will be the result of the action—either action data or an error if the action failed. It's common to include some information in the action result to instruct shouldRevalidate to revalidate or not.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* export async function action() {
|
|
355
|
+
* await saveSomeStuff();
|
|
356
|
+
* return { ok: true };
|
|
357
|
+
* }
|
|
358
|
+
*
|
|
359
|
+
* export function shouldRevalidate({
|
|
360
|
+
* actionResult,
|
|
361
|
+
* }) {
|
|
362
|
+
* if (actionResult?.ok) {
|
|
363
|
+
* return false;
|
|
364
|
+
* }
|
|
365
|
+
* return true;
|
|
366
|
+
* }
|
|
367
|
+
*/
|
|
319
368
|
actionResult?: any;
|
|
369
|
+
/**
|
|
370
|
+
* By default, React Router doesn't call every loader all the time. There are reliable optimizations it can make by default. For example, only loaders with changing params are called. Consider navigating from the following URL to the one below it:
|
|
371
|
+
*
|
|
372
|
+
* /projects/123/tasks/abc
|
|
373
|
+
* /projects/123/tasks/def
|
|
374
|
+
* React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
|
|
375
|
+
*
|
|
376
|
+
* It's safest to always return defaultShouldRevalidate after you've done your specific optimizations that return false, otherwise your UI might get out of sync with your data on the server.
|
|
377
|
+
*/
|
|
320
378
|
defaultShouldRevalidate: boolean;
|
|
321
379
|
}
|
|
322
380
|
/**
|
|
@@ -473,8 +531,13 @@ declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = Agnos
|
|
|
473
531
|
interface UIMatch<Data = unknown, Handle = unknown> {
|
|
474
532
|
id: string;
|
|
475
533
|
pathname: string;
|
|
534
|
+
/**
|
|
535
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
|
|
536
|
+
**/
|
|
476
537
|
params: AgnosticRouteMatch["params"];
|
|
538
|
+
/** The return value from the matched route's loader or clientLoader */
|
|
477
539
|
data: Data;
|
|
540
|
+
/** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
|
|
478
541
|
handle: Handle;
|
|
479
542
|
}
|
|
480
543
|
/**
|
|
@@ -1558,6 +1621,16 @@ type Serializable = undefined | null | boolean | string | symbol | number | Arra
|
|
|
1558
1621
|
[key: PropertyKey]: Serializable;
|
|
1559
1622
|
} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
|
|
1560
1623
|
|
|
1624
|
+
/**
|
|
1625
|
+
* A brand that can be applied to a type to indicate that it will serialize
|
|
1626
|
+
* to a specific type when transported to the client from a loader.
|
|
1627
|
+
* Only use this if you have additional serialization/deserialization logic
|
|
1628
|
+
* in your application.
|
|
1629
|
+
*/
|
|
1630
|
+
type unstable_SerializesTo<T> = {
|
|
1631
|
+
unstable__ReactRouter_SerializesTo?: [T];
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1561
1634
|
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
1562
1635
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
1563
1636
|
type Func = (...args: any[]) => unknown;
|
|
@@ -1565,7 +1638,7 @@ type Pretty<T> = {
|
|
|
1565
1638
|
[K in keyof T]: T[K];
|
|
1566
1639
|
} & {};
|
|
1567
1640
|
|
|
1568
|
-
type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1641
|
+
type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1569
1642
|
[K in keyof T]: Serialize<T[K]>;
|
|
1570
1643
|
} : undefined;
|
|
1571
1644
|
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
|
|
@@ -1576,4 +1649,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
|
1576
1649
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1577
1650
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1578
1651
|
|
|
1579
|
-
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9,
|
|
1652
|
+
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, type unstable_SerializesTo as aA, createBrowserHistory as aB, invariant as aC, createRouter as aD, ErrorResponseImpl as aE, DataRouterContext as aF, DataRouterStateContext as aG, FetchersContext as aH, LocationContext as aI, NavigationContext as aJ, RouteContext as aK, ViewTransitionContext as aL, type RouteModule as aM, type History as aN, type ServerDataFrom as aO, type ClientDataFrom as aP, type Func as aQ, type Pretty as aR, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunction as ap, type ClientActionFunctionArgs as aq, type ClientLoaderFunction as ar, type ClientLoaderFunctionArgs as as, type HeadersArgs as at, type HeadersFunction as au, type MetaArgs as av, type MetaDescriptor as aw, type PageLinkDescriptor as ax, type HtmlLinkDescriptor as ay, type LinkDescriptor as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
|