UNPKG

74.4 kBTypeScriptView Raw
1import * as React from 'react';
2import { ComponentType, ReactElement } from 'react';
3
4/**
5 * An augmentable interface users can modify in their app-code to opt into
6 * future-flag-specific types
7 */
8interface Future {
9}
10type MiddlewareEnabled = Future extends {
11 unstable_middleware: infer T extends boolean;
12} ? T : false;
13
14/**
15 * Actions represent the type of change to a location value.
16 */
17declare enum Action {
18 /**
19 * A POP indicates a change to an arbitrary index in the history stack, such
20 * as a back or forward navigation. It does not describe the direction of the
21 * navigation, only that the current index changed.
22 *
23 * Note: This is the default action for newly created history objects.
24 */
25 Pop = "POP",
26 /**
27 * A PUSH indicates a new entry being added to the history stack, such as when
28 * a link is clicked and a new page loads. When this happens, all subsequent
29 * entries in the stack are lost.
30 */
31 Push = "PUSH",
32 /**
33 * A REPLACE indicates the entry at the current index in the history stack
34 * being replaced by a new one.
35 */
36 Replace = "REPLACE"
37}
38/**
39 * The pathname, search, and hash values of a URL.
40 */
41interface Path {
42 /**
43 * A URL pathname, beginning with a /.
44 */
45 pathname: string;
46 /**
47 * A URL search string, beginning with a ?.
48 */
49 search: string;
50 /**
51 * A URL fragment identifier, beginning with a #.
52 */
53 hash: string;
54}
55/**
56 * An entry in a history stack. A location contains information about the
57 * URL path, as well as possibly some arbitrary state and a key.
58 */
59interface Location<State = any> extends Path {
60 /**
61 * A value of arbitrary data associated with this location.
62 */
63 state: State;
64 /**
65 * A unique string associated with this location. May be used to safely store
66 * and retrieve data in some other storage API, like `localStorage`.
67 *
68 * Note: This value is always "default" on the initial location.
69 */
70 key: string;
71}
72/**
73 * A change to the current location.
74 */
75interface Update {
76 /**
77 * The action that triggered the change.
78 */
79 action: Action;
80 /**
81 * The new location.
82 */
83 location: Location;
84 /**
85 * The delta between this location and the former location in the history stack
86 */
87 delta: number | null;
88}
89/**
90 * A function that receives notifications about location changes.
91 */
92interface Listener {
93 (update: Update): void;
94}
95/**
96 * Describes a location that is the destination of some navigation used in
97 * {@link Link}, {@link useNavigate}, etc.
98 */
99type To = string | Partial<Path>;
100/**
101 * A history is an interface to the navigation stack. The history serves as the
102 * source of truth for the current location, as well as provides a set of
103 * methods that may be used to change it.
104 *
105 * It is similar to the DOM's `window.history` object, but with a smaller, more
106 * focused API.
107 */
108interface History {
109 /**
110 * The last action that modified the current location. This will always be
111 * Action.Pop when a history instance is first created. This value is mutable.
112 */
113 readonly action: Action;
114 /**
115 * The current location. This value is mutable.
116 */
117 readonly location: Location;
118 /**
119 * Returns a valid href for the given `to` value that may be used as
120 * the value of an <a href> attribute.
121 *
122 * @param to - The destination URL
123 */
124 createHref(to: To): string;
125 /**
126 * Returns a URL for the given `to` value
127 *
128 * @param to - The destination URL
129 */
130 createURL(to: To): URL;
131 /**
132 * Encode a location the same way window.history would do (no-op for memory
133 * history) so we ensure our PUSH/REPLACE navigations for data routers
134 * behave the same as POP
135 *
136 * @param to Unencoded path
137 */
138 encodeLocation(to: To): Path;
139 /**
140 * Pushes a new location onto the history stack, increasing its length by one.
141 * If there were any entries in the stack after the current one, they are
142 * lost.
143 *
144 * @param to - The new URL
145 * @param state - Data to associate with the new location
146 */
147 push(to: To, state?: any): void;
148 /**
149 * Replaces the current location in the history stack with a new one. The
150 * location that was replaced will no longer be available.
151 *
152 * @param to - The new URL
153 * @param state - Data to associate with the new location
154 */
155 replace(to: To, state?: any): void;
156 /**
157 * Navigates `n` entries backward/forward in the history stack relative to the
158 * current index. For example, a "back" navigation would use go(-1).
159 *
160 * @param delta - The delta in the stack index
161 */
162 go(delta: number): void;
163 /**
164 * Sets up a listener that will be called whenever the current location
165 * changes.
166 *
167 * @param listener - A function that will be called when the location changes
168 * @returns unlisten - A function that may be used to stop listening
169 */
170 listen(listener: Listener): () => void;
171}
172/**
173 * A user-supplied object that describes a location. Used when providing
174 * entries to `createMemoryHistory` via its `initialEntries` option.
175 */
176type InitialEntry = string | Partial<Location>;
177/**
178 * A browser history stores the current location in regular URLs in a web
179 * browser environment. This is the standard for most web apps and provides the
180 * cleanest URLs the browser's address bar.
181 *
182 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#browserhistory
183 */
184interface BrowserHistory extends UrlHistory {
185}
186type BrowserHistoryOptions = UrlHistoryOptions;
187/**
188 * Browser history stores the location in regular URLs. This is the standard for
189 * most web apps, but it requires some configuration on the server to ensure you
190 * serve the same app at multiple URLs.
191 *
192 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
193 */
194declare function createBrowserHistory(options?: BrowserHistoryOptions): BrowserHistory;
195/**
196 * @private
197 */
198declare function invariant(value: boolean, message?: string): asserts value;
199declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
200/**
201 * Creates a string URL path from the given pathname, search, and hash components.
202 *
203 * @category Utils
204 */
205declare function createPath({ pathname, search, hash, }: Partial<Path>): string;
206/**
207 * Parses a string URL path into its separate pathname, search, and hash components.
208 *
209 * @category Utils
210 */
211declare function parsePath(path: string): Partial<Path>;
212interface UrlHistory extends History {
213}
214type UrlHistoryOptions = {
215 window?: Window;
216 v5Compat?: boolean;
217};
218
219type MaybePromise<T> = T | Promise<T>;
220/**
221 * Map of routeId -> data returned from a loader/action/error
222 */
223interface RouteData {
224 [routeId: string]: any;
225}
226type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
227type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
228/**
229 * Users can specify either lowercase or uppercase form methods on `<Form>`,
230 * useSubmit(), `<fetcher.Form>`, etc.
231 */
232type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;
233/**
234 * Active navigation/fetcher form methods are exposed in uppercase on the
235 * RouterState. This is to align with the normalization done via fetch().
236 */
237type FormMethod = UpperCaseFormMethod;
238type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";
239type JsonObject = {
240 [Key in string]: JsonValue;
241} & {
242 [Key in string]?: JsonValue | undefined;
243};
244type JsonArray = JsonValue[] | readonly JsonValue[];
245type JsonPrimitive = string | number | boolean | null;
246type JsonValue = JsonPrimitive | JsonObject | JsonArray;
247/**
248 * @private
249 * Internal interface to pass around for action submissions, not intended for
250 * external consumption
251 */
252type Submission = {
253 formMethod: FormMethod;
254 formAction: string;
255 formEncType: FormEncType;
256 formData: FormData;
257 json: undefined;
258 text: undefined;
259} | {
260 formMethod: FormMethod;
261 formAction: string;
262 formEncType: FormEncType;
263 formData: undefined;
264 json: JsonValue;
265 text: undefined;
266} | {
267 formMethod: FormMethod;
268 formAction: string;
269 formEncType: FormEncType;
270 formData: undefined;
271 json: undefined;
272 text: string;
273};
274interface unstable_RouterContext<T = unknown> {
275 defaultValue?: T;
276}
277/**
278 * Creates a context object that may be used to store and retrieve arbitrary values.
279 *
280 * If a `defaultValue` is provided, it will be returned from `context.get()` when no value has been
281 * set for the context. Otherwise reading this context when no value has been set will throw an
282 * error.
283 *
284 * @param defaultValue The default value for the context
285 * @returns A context object
286 */
287declare function unstable_createContext<T>(defaultValue?: T): unstable_RouterContext<T>;
288/**
289 * A Map of RouterContext objects to their initial values - used to populate a
290 * fresh `context` value per request/navigation/fetch
291 */
292type unstable_InitialContext = Map<unstable_RouterContext, unknown>;
293/**
294 * Provides methods for writing/reading values in application context in a typesafe way.
295 */
296declare class unstable_RouterContextProvider {
297 #private;
298 constructor(init?: unstable_InitialContext);
299 get<T>(context: unstable_RouterContext<T>): T;
300 set<C extends unstable_RouterContext>(context: C, value: C extends unstable_RouterContext<infer T> ? T : never): void;
301}
302type DefaultContext = MiddlewareEnabled extends true ? unstable_RouterContextProvider : any;
303/**
304 * @private
305 * Arguments passed to route loader/action functions. Same for now but we keep
306 * this as a private implementation detail in case they diverge in the future.
307 */
308interface DataFunctionArgs<Context> {
309 /** 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. */
310 request: Request;
311 /**
312 * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
313 * @example
314 * // app/routes.ts
315 * route("teams/:teamId", "./team.tsx"),
316 *
317 * // app/team.tsx
318 * export function loader({
319 * params,
320 * }: Route.LoaderArgs) {
321 * params.teamId;
322 * // ^ string
323 * }
324 **/
325 params: Params;
326 /**
327 * This is the context passed in to your server adapter's getLoadContext() function.
328 * It's a way to bridge the gap between the adapter's request/response API with your React Router app.
329 * It is only applicable if you are using a custom server adapter.
330 */
331 context: Context;
332}
333/**
334 * Route middleware `next` function to call downstream handlers and then complete
335 * middlewares from the bottom-up
336 */
337interface unstable_MiddlewareNextFunction<Result = unknown> {
338 (): MaybePromise<Result>;
339}
340/**
341 * Route middleware function signature. Receives the same "data" arguments as a
342 * `loader`/`action` (`request`, `params`, `context`) as the first parameter and
343 * a `next` function as the second parameter which will call downstream handlers
344 * and then complete middlewares from the bottom-up
345 */
346type unstable_MiddlewareFunction<Result = unknown> = (args: DataFunctionArgs<unstable_RouterContextProvider>, next: unstable_MiddlewareNextFunction<Result>) => MaybePromise<Result | void>;
347/**
348 * Arguments passed to loader functions
349 */
350interface LoaderFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
351}
352/**
353 * Arguments passed to action functions
354 */
355interface ActionFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
356}
357/**
358 * Loaders and actions can return anything
359 */
360type DataFunctionValue = unknown;
361type DataFunctionReturnValue = MaybePromise<DataFunctionValue>;
362/**
363 * Route loader function signature
364 */
365type LoaderFunction<Context = DefaultContext> = {
366 (args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
367} & {
368 hydrate?: boolean;
369};
370/**
371 * Route action function signature
372 */
373interface ActionFunction<Context = DefaultContext> {
374 (args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
375}
376/**
377 * Arguments passed to shouldRevalidate function
378 */
379interface ShouldRevalidateFunctionArgs {
380 /** 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. */
381 currentUrl: URL;
382 /** 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. */
383 currentParams: AgnosticDataRouteMatch["params"];
384 /** 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. */
385 nextUrl: URL;
386 /** 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. */
387 nextParams: AgnosticDataRouteMatch["params"];
388 /** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
389 formMethod?: Submission["formMethod"];
390 /** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
391 formAction?: Submission["formAction"];
392 /** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
393 formEncType?: Submission["formEncType"];
394 /** The form submission data when the form's encType is `text/plain` */
395 text?: Submission["text"];
396 /** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
397 formData?: Submission["formData"];
398 /** The form submission data when the form's encType is `application/json` */
399 json?: Submission["json"];
400 /** The status code of the action response */
401 actionStatus?: number;
402 /**
403 * 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.
404 *
405 * @example
406 * export async function action() {
407 * await saveSomeStuff();
408 * return { ok: true };
409 * }
410 *
411 * export function shouldRevalidate({
412 * actionResult,
413 * }) {
414 * if (actionResult?.ok) {
415 * return false;
416 * }
417 * return true;
418 * }
419 */
420 actionResult?: any;
421 /**
422 * 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:
423 *
424 * /projects/123/tasks/abc
425 * /projects/123/tasks/def
426 * React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
427 *
428 * 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.
429 */
430 defaultShouldRevalidate: boolean;
431}
432/**
433 * Route shouldRevalidate function signature. This runs after any submission
434 * (navigation or fetcher), so we flatten the navigation/fetcher submission
435 * onto the arguments. It shouldn't matter whether it came from a navigation
436 * or a fetcher, what really matters is the URLs and the formData since loaders
437 * have to re-run based on the data models that were potentially mutated.
438 */
439interface ShouldRevalidateFunction {
440 (args: ShouldRevalidateFunctionArgs): boolean;
441}
442interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
443 /**
444 * @private
445 */
446 _lazyPromises?: {
447 middleware: Promise<void> | undefined;
448 handler: Promise<void> | undefined;
449 route: Promise<void> | undefined;
450 };
451 /**
452 * A boolean value indicating whether this route handler should be called in this pass.
453 *
454 * The `matches` array always includes _all_ matched routes even when only _some_
455 * route handlers need to be called so that things like middleware can be implemented.
456 *
457 * `shouldLoad` is usually only interesting if you are skipping the route handler
458 * entirely and implementing custom handler logic - since it lets you determine
459 * if that custom logic should run for this route or not.
460 *
461 * For example:
462 * - If you are on `/parent/child/a` and you navigate to `/parent/child/b` -
463 * you'll get an array of three matches (`[parent, child, b]`), but only `b`
464 * will have `shouldLoad=true` because the data for `parent` and `child` is
465 * already loaded
466 * - If you are on `/parent/child/a` and you submit to `a`'s `action`, then only
467 * `a` will have `shouldLoad=true` for the action execution of `dataStrategy`
468 * - After the `action`, `dataStrategy` will be called again for the `loader`
469 * revalidation, and all matches will have `shouldLoad=true` (assuming no custom
470 * `shouldRevalidate` implementations)
471 */
472 shouldLoad: boolean;
473 unstable_shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
474 unstable_shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
475 /**
476 * An async function that will resolve any `route.lazy` implementations and
477 * execute the route's handler (if necessary), returning a `DataStrategyResult`
478 *
479 * - Calling `match.resolve` does not mean you're calling the `loader`/`action`
480 * (the "handler") - `resolve` will only call the `handler` internally if
481 * needed _and_ if you don't pass your own `handlerOverride` function parameter
482 * - It is safe to call `match.resolve` for all matches, even if they have
483 * `shouldLoad=false`, and it will no-op if no loading is required
484 * - You should generally always call `match.resolve()` for `shouldLoad:true`
485 * routes to ensure that any `route.lazy` implementations are processed
486 * - See the examples below for how to implement custom handler execution via
487 * `match.resolve`
488 */
489 resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
490}
491interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
492 /**
493 * Matches for this route extended with Data strategy APIs
494 */
495 matches: DataStrategyMatch[];
496 unstable_runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
497 /**
498 * The key of the fetcher we are calling `dataStrategy` for, otherwise `null`
499 * for navigational executions
500 */
501 fetcherKey: string | null;
502}
503/**
504 * Result from a loader or action called via dataStrategy
505 */
506interface DataStrategyResult {
507 type: "data" | "error";
508 result: unknown;
509}
510interface DataStrategyFunction<Context = DefaultContext> {
511 (args: DataStrategyFunctionArgs<Context>): Promise<Record<string, DataStrategyResult>>;
512}
513type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = {
514 signal: AbortSignal;
515 path: string;
516 matches: M[];
517 fetcherKey: string | undefined;
518 patch: (routeId: string | null, children: O[]) => void;
519};
520type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = (opts: AgnosticPatchRoutesOnNavigationFunctionArgs<O, M>) => MaybePromise<void>;
521/**
522 * Function provided by the framework-aware layers to set any framework-specific
523 * properties from framework-agnostic properties
524 */
525interface MapRoutePropertiesFunction {
526 (route: AgnosticRouteObject): {
527 hasErrorBoundary: boolean;
528 } & Record<string, any>;
529}
530/**
531 * Keys we cannot change from within a lazy object. We spread all other keys
532 * onto the route. Either they're meaningful to the router, or they'll get
533 * ignored.
534 */
535type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
536/**
537 * Keys we cannot change from within a lazy() function. We spread all other keys
538 * onto the route. Either they're meaningful to the router, or they'll get
539 * ignored.
540 */
541type UnsupportedLazyRouteFunctionKey = UnsupportedLazyRouteObjectKey | "unstable_middleware";
542/**
543 * lazy object to load route properties, which can add non-matching
544 * related properties to a route
545 */
546type LazyRouteObject<R extends AgnosticRouteObject> = {
547 [K in keyof R as K extends UnsupportedLazyRouteObjectKey ? never : K]?: () => Promise<R[K] | null | undefined>;
548};
549/**
550 * lazy() function to load a route definition, which can add non-matching
551 * related properties to a route
552 */
553interface LazyRouteFunction<R extends AgnosticRouteObject> {
554 (): Promise<Omit<R, UnsupportedLazyRouteFunctionKey> & Partial<Record<UnsupportedLazyRouteFunctionKey, never>>>;
555}
556type LazyRouteDefinition<R extends AgnosticRouteObject> = LazyRouteObject<R> | LazyRouteFunction<R>;
557/**
558 * Base RouteObject with common props shared by all types of routes
559 */
560type AgnosticBaseRouteObject = {
561 caseSensitive?: boolean;
562 path?: string;
563 id?: string;
564 unstable_middleware?: unstable_MiddlewareFunction[];
565 loader?: LoaderFunction | boolean;
566 action?: ActionFunction | boolean;
567 hasErrorBoundary?: boolean;
568 shouldRevalidate?: ShouldRevalidateFunction;
569 handle?: any;
570 lazy?: LazyRouteDefinition<AgnosticBaseRouteObject>;
571};
572/**
573 * Index routes must not have children
574 */
575type AgnosticIndexRouteObject = AgnosticBaseRouteObject & {
576 children?: undefined;
577 index: true;
578};
579/**
580 * Non-index routes may have children, but cannot have index
581 */
582type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {
583 children?: AgnosticRouteObject[];
584 index?: false;
585};
586/**
587 * A route object represents a logical route, with (optionally) its child
588 * routes organized in a tree-like structure.
589 */
590type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject;
591type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & {
592 id: string;
593};
594type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
595 children?: AgnosticDataRouteObject[];
596 id: string;
597};
598/**
599 * A data route object, which is just a RouteObject with a required unique ID
600 */
601type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
602type RouteManifest<R = AgnosticDataRouteObject> = Record<string, R | undefined>;
603type Regex_az = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
604type Regez_AZ = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
605type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
606type Regex_w = Regex_az | Regez_AZ | Regex_09 | "_";
607type ParamChar = Regex_w | "-";
608type RegexMatchPlus<CharPattern extends string, T extends string> = T extends `${infer First}${infer Rest}` ? First extends CharPattern ? RegexMatchPlus<CharPattern, Rest> extends never ? First : `${First}${RegexMatchPlus<CharPattern, Rest>}` : never : never;
609type _PathParam<Path extends string> = Path extends `${infer L}/${infer R}` ? _PathParam<L> | _PathParam<R> : Path extends `:${infer Param}` ? Param extends `${infer Optional}?${string}` ? RegexMatchPlus<ParamChar, Optional> : RegexMatchPlus<ParamChar, Param> : never;
610type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
611type ParamParseKey<Segment extends string> = [
612 PathParam<Segment>
613] extends [never] ? string : PathParam<Segment>;
614/**
615 * The parameters that were parsed from the URL path.
616 */
617type Params<Key extends string = string> = {
618 readonly [key in Key]: string | undefined;
619};
620/**
621 * A RouteMatch contains info about how a route matched a URL.
622 */
623interface AgnosticRouteMatch<ParamKey extends string = string, RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject> {
624 /**
625 * The names and values of dynamic parameters in the URL.
626 */
627 params: Params<ParamKey>;
628 /**
629 * The portion of the URL pathname that was matched.
630 */
631 pathname: string;
632 /**
633 * The portion of the URL pathname that was matched before child routes.
634 */
635 pathnameBase: string;
636 /**
637 * The route object that was used to match.
638 */
639 route: RouteObjectType;
640}
641interface AgnosticDataRouteMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
642}
643/**
644 * Matches the given routes to a location and returns the match data.
645 *
646 * @category Utils
647 */
648declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;
649interface UIMatch<Data = unknown, Handle = unknown> {
650 id: string;
651 pathname: string;
652 /**
653 * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
654 **/
655 params: AgnosticRouteMatch["params"];
656 /** The return value from the matched route's loader or clientLoader */
657 data: Data;
658 /** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
659 handle: Handle;
660}
661/**
662 * Returns a path with params interpolated.
663 *
664 * @category Utils
665 */
666declare function generatePath<Path extends string>(originalPath: Path, params?: {
667 [key in PathParam<Path>]: string | null;
668}): string;
669/**
670 * A PathPattern is used to match on some portion of a URL pathname.
671 */
672interface PathPattern<Path extends string = string> {
673 /**
674 * A string to match against a URL pathname. May contain `:id`-style segments
675 * to indicate placeholders for dynamic parameters. May also end with `/*` to
676 * indicate matching the rest of the URL pathname.
677 */
678 path: Path;
679 /**
680 * Should be `true` if the static portions of the `path` should be matched in
681 * the same case.
682 */
683 caseSensitive?: boolean;
684 /**
685 * Should be `true` if this pattern should match the entire URL pathname.
686 */
687 end?: boolean;
688}
689/**
690 * A PathMatch contains info about how a PathPattern matched on a URL pathname.
691 */
692interface PathMatch<ParamKey extends string = string> {
693 /**
694 * The names and values of dynamic parameters in the URL.
695 */
696 params: Params<ParamKey>;
697 /**
698 * The portion of the URL pathname that was matched.
699 */
700 pathname: string;
701 /**
702 * The portion of the URL pathname that was matched before child routes.
703 */
704 pathnameBase: string;
705 /**
706 * The pattern that was used to match.
707 */
708 pattern: PathPattern;
709}
710/**
711 * Performs pattern matching on a URL pathname and returns information about
712 * the match.
713 *
714 * @category Utils
715 */
716declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;
717/**
718 * Returns a resolved path object relative to the given pathname.
719 *
720 * @category Utils
721 */
722declare function resolvePath(to: To, fromPathname?: string): Path;
723declare class DataWithResponseInit<D> {
724 type: string;
725 data: D;
726 init: ResponseInit | null;
727 constructor(data: D, init?: ResponseInit);
728}
729/**
730 * Create "responses" that contain `status`/`headers` without forcing
731 * serialization into an actual `Response` - used by Remix single fetch
732 *
733 * @category Utils
734 */
735declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
736type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
737/**
738 * A redirect response. Sets the status code and the `Location` header.
739 * Defaults to "302 Found".
740 *
741 * @category Utils
742 */
743declare const redirect: RedirectFunction;
744/**
745 * A redirect response that will force a document reload to the new location.
746 * Sets the status code and the `Location` header.
747 * Defaults to "302 Found".
748 *
749 * @category Utils
750 */
751declare const redirectDocument: RedirectFunction;
752/**
753 * A redirect response that will perform a `history.replaceState` instead of a
754 * `history.pushState` for client-side navigation redirects.
755 * Sets the status code and the `Location` header.
756 * Defaults to "302 Found".
757 *
758 * @category Utils
759 */
760declare const replace: RedirectFunction;
761type ErrorResponse = {
762 status: number;
763 statusText: string;
764 data: any;
765};
766/**
767 * @private
768 * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies
769 *
770 * We don't export the class for public use since it's an implementation
771 * detail, but we export the interface above so folks can build their own
772 * abstractions around instances via isRouteErrorResponse()
773 */
774declare class ErrorResponseImpl implements ErrorResponse {
775 status: number;
776 statusText: string;
777 data: any;
778 private error?;
779 private internal;
780 constructor(status: number, statusText: string | undefined, data: any, internal?: boolean);
781}
782/**
783 * Check if the given error is an ErrorResponse generated from a 4xx/5xx
784 * Response thrown from an action/loader
785 *
786 * @category Utils
787 */
788declare function isRouteErrorResponse(error: any): error is ErrorResponse;
789
790/**
791 * A Router instance manages all navigation and data loading/mutations
792 */
793interface Router {
794 /**
795 * @private
796 * PRIVATE - DO NOT USE
797 *
798 * Return the basename for the router
799 */
800 get basename(): RouterInit["basename"];
801 /**
802 * @private
803 * PRIVATE - DO NOT USE
804 *
805 * Return the future config for the router
806 */
807 get future(): FutureConfig;
808 /**
809 * @private
810 * PRIVATE - DO NOT USE
811 *
812 * Return the current state of the router
813 */
814 get state(): RouterState;
815 /**
816 * @private
817 * PRIVATE - DO NOT USE
818 *
819 * Return the routes for this router instance
820 */
821 get routes(): AgnosticDataRouteObject[];
822 /**
823 * @private
824 * PRIVATE - DO NOT USE
825 *
826 * Return the window associated with the router
827 */
828 get window(): RouterInit["window"];
829 /**
830 * @private
831 * PRIVATE - DO NOT USE
832 *
833 * Initialize the router, including adding history listeners and kicking off
834 * initial data fetches. Returns a function to cleanup listeners and abort
835 * any in-progress loads
836 */
837 initialize(): Router;
838 /**
839 * @private
840 * PRIVATE - DO NOT USE
841 *
842 * Subscribe to router.state updates
843 *
844 * @param fn function to call with the new state
845 */
846 subscribe(fn: RouterSubscriber): () => void;
847 /**
848 * @private
849 * PRIVATE - DO NOT USE
850 *
851 * Enable scroll restoration behavior in the router
852 *
853 * @param savedScrollPositions Object that will manage positions, in case
854 * it's being restored from sessionStorage
855 * @param getScrollPosition Function to get the active Y scroll position
856 * @param getKey Function to get the key to use for restoration
857 */
858 enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
859 /**
860 * @private
861 * PRIVATE - DO NOT USE
862 *
863 * Navigate forward/backward in the history stack
864 * @param to Delta to move in the history stack
865 */
866 navigate(to: number): Promise<void>;
867 /**
868 * Navigate to the given path
869 * @param to Path to navigate to
870 * @param opts Navigation options (method, submission, etc.)
871 */
872 navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
873 /**
874 * @private
875 * PRIVATE - DO NOT USE
876 *
877 * Trigger a fetcher load/submission
878 *
879 * @param key Fetcher key
880 * @param routeId Route that owns the fetcher
881 * @param href href to fetch
882 * @param opts Fetcher options, (method, submission, etc.)
883 */
884 fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
885 /**
886 * @private
887 * PRIVATE - DO NOT USE
888 *
889 * Trigger a revalidation of all current route loaders and fetcher loads
890 */
891 revalidate(): Promise<void>;
892 /**
893 * @private
894 * PRIVATE - DO NOT USE
895 *
896 * Utility function to create an href for the given location
897 * @param location
898 */
899 createHref(location: Location | URL): string;
900 /**
901 * @private
902 * PRIVATE - DO NOT USE
903 *
904 * Utility function to URL encode a destination path according to the internal
905 * history implementation
906 * @param to
907 */
908 encodeLocation(to: To): Path;
909 /**
910 * @private
911 * PRIVATE - DO NOT USE
912 *
913 * Get/create a fetcher for the given key
914 * @param key
915 */
916 getFetcher<TData = any>(key: string): Fetcher<TData>;
917 /**
918 * @private
919 * PRIVATE - DO NOT USE
920 *
921 * Delete the fetcher for a given key
922 * @param key
923 */
924 deleteFetcher(key: string): void;
925 /**
926 * @private
927 * PRIVATE - DO NOT USE
928 *
929 * Cleanup listeners and abort any in-progress loads
930 */
931 dispose(): void;
932 /**
933 * @private
934 * PRIVATE - DO NOT USE
935 *
936 * Get a navigation blocker
937 * @param key The identifier for the blocker
938 * @param fn The blocker function implementation
939 */
940 getBlocker(key: string, fn: BlockerFunction): Blocker;
941 /**
942 * @private
943 * PRIVATE - DO NOT USE
944 *
945 * Delete a navigation blocker
946 * @param key The identifier for the blocker
947 */
948 deleteBlocker(key: string): void;
949 /**
950 * @private
951 * PRIVATE DO NOT USE
952 *
953 * Patch additional children routes into an existing parent route
954 * @param routeId The parent route id or a callback function accepting `patch`
955 * to perform batch patching
956 * @param children The additional children routes
957 * @param unstable_allowElementMutations Allow mutation or route elements on
958 * existing routes. Intended for RSC-usage
959 * only.
960 */
961 patchRoutes(routeId: string | null, children: AgnosticRouteObject[], unstable_allowElementMutations?: boolean): void;
962 /**
963 * @private
964 * PRIVATE - DO NOT USE
965 *
966 * HMR needs to pass in-flight route updates to React Router
967 * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
968 */
969 _internalSetRoutes(routes: AgnosticRouteObject[]): void;
970 /**
971 * @private
972 * PRIVATE - DO NOT USE
973 *
974 * Cause subscribers to re-render. This is used to force a re-render.
975 */
976 _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
977 /**
978 * @private
979 * PRIVATE - DO NOT USE
980 *
981 * Internal fetch AbortControllers accessed by unit tests
982 */
983 _internalFetchControllers: Map<string, AbortController>;
984}
985/**
986 * State maintained internally by the router. During a navigation, all states
987 * reflect the "old" location unless otherwise noted.
988 */
989interface RouterState {
990 /**
991 * The action of the most recent navigation
992 */
993 historyAction: Action;
994 /**
995 * The current location reflected by the router
996 */
997 location: Location;
998 /**
999 * The current set of route matches
1000 */
1001 matches: AgnosticDataRouteMatch[];
1002 /**
1003 * Tracks whether we've completed our initial data load
1004 */
1005 initialized: boolean;
1006 /**
1007 * Current scroll position we should start at for a new view
1008 * - number -> scroll position to restore to
1009 * - false -> do not restore scroll at all (used during submissions/revalidations)
1010 * - null -> don't have a saved position, scroll to hash or top of page
1011 */
1012 restoreScrollPosition: number | false | null;
1013 /**
1014 * Indicate whether this navigation should skip resetting the scroll position
1015 * if we are unable to restore the scroll position
1016 */
1017 preventScrollReset: boolean;
1018 /**
1019 * Tracks the state of the current navigation
1020 */
1021 navigation: Navigation;
1022 /**
1023 * Tracks any in-progress revalidations
1024 */
1025 revalidation: RevalidationState;
1026 /**
1027 * Data from the loaders for the current matches
1028 */
1029 loaderData: RouteData;
1030 /**
1031 * Data from the action for the current matches
1032 */
1033 actionData: RouteData | null;
1034 /**
1035 * Errors caught from loaders for the current matches
1036 */
1037 errors: RouteData | null;
1038 /**
1039 * Map of current fetchers
1040 */
1041 fetchers: Map<string, Fetcher>;
1042 /**
1043 * Map of current blockers
1044 */
1045 blockers: Map<string, Blocker>;
1046}
1047/**
1048 * Data that can be passed into hydrate a Router from SSR
1049 */
1050type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
1051/**
1052 * Future flags to toggle new feature behavior
1053 */
1054interface FutureConfig {
1055 unstable_middleware: boolean;
1056}
1057/**
1058 * Initialization options for createRouter
1059 */
1060interface RouterInit {
1061 routes: AgnosticRouteObject[];
1062 history: History;
1063 basename?: string;
1064 unstable_getContext?: () => MaybePromise<unstable_InitialContext>;
1065 mapRouteProperties?: MapRoutePropertiesFunction;
1066 future?: Partial<FutureConfig>;
1067 hydrationRouteProperties?: string[];
1068 hydrationData?: HydrationState;
1069 window?: Window;
1070 dataStrategy?: DataStrategyFunction;
1071 patchRoutesOnNavigation?: AgnosticPatchRoutesOnNavigationFunction;
1072}
1073/**
1074 * State returned from a server-side query() call
1075 */
1076interface StaticHandlerContext {
1077 basename: Router["basename"];
1078 location: RouterState["location"];
1079 matches: RouterState["matches"];
1080 loaderData: RouterState["loaderData"];
1081 actionData: RouterState["actionData"];
1082 errors: RouterState["errors"];
1083 statusCode: number;
1084 loaderHeaders: Record<string, Headers>;
1085 actionHeaders: Record<string, Headers>;
1086 _deepestRenderedBoundaryId?: string | null;
1087}
1088/**
1089 * A StaticHandler instance manages a singular SSR navigation/fetch event
1090 */
1091interface StaticHandler {
1092 dataRoutes: AgnosticDataRouteObject[];
1093 query(request: Request, opts?: {
1094 requestContext?: unknown;
1095 filterMatchesToLoad?: (match: AgnosticDataRouteMatch) => boolean;
1096 skipLoaderErrorBubbling?: boolean;
1097 skipRevalidation?: boolean;
1098 dataStrategy?: DataStrategyFunction<unknown>;
1099 unstable_respond?: (staticContext: StaticHandlerContext) => MaybePromise<Response>;
1100 unstable_stream?: (context: unstable_RouterContextProvider, query: (r: Request) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
1101 }): Promise<StaticHandlerContext | Response>;
1102 queryRoute(request: Request, opts?: {
1103 routeId?: string;
1104 requestContext?: unknown;
1105 dataStrategy?: DataStrategyFunction<unknown>;
1106 unstable_respond?: (res: Response) => MaybePromise<Response>;
1107 }): Promise<any>;
1108}
1109type ViewTransitionOpts = {
1110 currentLocation: Location;
1111 nextLocation: Location;
1112};
1113/**
1114 * Subscriber function signature for changes to router state
1115 */
1116interface RouterSubscriber {
1117 (state: RouterState, opts: {
1118 deletedFetchers: string[];
1119 viewTransitionOpts?: ViewTransitionOpts;
1120 flushSync: boolean;
1121 }): void;
1122}
1123/**
1124 * Function signature for determining the key to be used in scroll restoration
1125 * for a given location
1126 */
1127interface GetScrollRestorationKeyFunction {
1128 (location: Location, matches: UIMatch[]): string | null;
1129}
1130/**
1131 * Function signature for determining the current scroll position
1132 */
1133interface GetScrollPositionFunction {
1134 (): number;
1135}
1136/**
1137 * - "route": relative to the route hierarchy so `..` means remove all segments
1138 * of the current route even if it has many. For example, a `route("posts/:id")`
1139 * would have both `:id` and `posts` removed from the url.
1140 * - "path": relative to the pathname so `..` means remove one segment of the
1141 * pathname. For example, a `route("posts/:id")` would have only `:id` removed
1142 * from the url.
1143 */
1144type RelativeRoutingType = "route" | "path";
1145type BaseNavigateOrFetchOptions = {
1146 preventScrollReset?: boolean;
1147 relative?: RelativeRoutingType;
1148 flushSync?: boolean;
1149};
1150type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
1151 replace?: boolean;
1152 state?: any;
1153 fromRouteId?: string;
1154 viewTransition?: boolean;
1155};
1156type BaseSubmissionOptions = {
1157 formMethod?: HTMLFormMethod;
1158 formEncType?: FormEncType;
1159} & ({
1160 formData: FormData;
1161 body?: undefined;
1162} | {
1163 formData?: undefined;
1164 body: any;
1165});
1166/**
1167 * Options for a navigate() call for a normal (non-submission) navigation
1168 */
1169type LinkNavigateOptions = BaseNavigateOptions;
1170/**
1171 * Options for a navigate() call for a submission navigation
1172 */
1173type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
1174/**
1175 * Options to pass to navigate() for a navigation
1176 */
1177type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
1178/**
1179 * Options for a fetch() load
1180 */
1181type LoadFetchOptions = BaseNavigateOrFetchOptions;
1182/**
1183 * Options for a fetch() submission
1184 */
1185type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
1186/**
1187 * Options to pass to fetch()
1188 */
1189type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
1190/**
1191 * Potential states for state.navigation
1192 */
1193type NavigationStates = {
1194 Idle: {
1195 state: "idle";
1196 location: undefined;
1197 formMethod: undefined;
1198 formAction: undefined;
1199 formEncType: undefined;
1200 formData: undefined;
1201 json: undefined;
1202 text: undefined;
1203 };
1204 Loading: {
1205 state: "loading";
1206 location: Location;
1207 formMethod: Submission["formMethod"] | undefined;
1208 formAction: Submission["formAction"] | undefined;
1209 formEncType: Submission["formEncType"] | undefined;
1210 formData: Submission["formData"] | undefined;
1211 json: Submission["json"] | undefined;
1212 text: Submission["text"] | undefined;
1213 };
1214 Submitting: {
1215 state: "submitting";
1216 location: Location;
1217 formMethod: Submission["formMethod"];
1218 formAction: Submission["formAction"];
1219 formEncType: Submission["formEncType"];
1220 formData: Submission["formData"];
1221 json: Submission["json"];
1222 text: Submission["text"];
1223 };
1224};
1225type Navigation = NavigationStates[keyof NavigationStates];
1226type RevalidationState = "idle" | "loading";
1227/**
1228 * Potential states for fetchers
1229 */
1230type FetcherStates<TData = any> = {
1231 /**
1232 * The fetcher is not calling a loader or action
1233 *
1234 * ```tsx
1235 * fetcher.state === "idle"
1236 * ```
1237 */
1238 Idle: {
1239 state: "idle";
1240 formMethod: undefined;
1241 formAction: undefined;
1242 formEncType: undefined;
1243 text: undefined;
1244 formData: undefined;
1245 json: undefined;
1246 /**
1247 * If the fetcher has never been called, this will be undefined.
1248 */
1249 data: TData | undefined;
1250 };
1251 /**
1252 * The fetcher is loading data from a {@link LoaderFunction | loader} from a
1253 * call to {@link FetcherWithComponents.load | `fetcher.load`}.
1254 *
1255 * ```tsx
1256 * // somewhere
1257 * <button onClick={() => fetcher.load("/some/route") }>Load</button>
1258 *
1259 * // the state will update
1260 * fetcher.state === "loading"
1261 * ```
1262 */
1263 Loading: {
1264 state: "loading";
1265 formMethod: Submission["formMethod"] | undefined;
1266 formAction: Submission["formAction"] | undefined;
1267 formEncType: Submission["formEncType"] | undefined;
1268 text: Submission["text"] | undefined;
1269 formData: Submission["formData"] | undefined;
1270 json: Submission["json"] | undefined;
1271 data: TData | undefined;
1272 };
1273 /**
1274 The fetcher is submitting to a {@link LoaderFunction} (GET) or {@link ActionFunction} (POST) from a {@link FetcherWithComponents.Form | `fetcher.Form`} or {@link FetcherWithComponents.submit | `fetcher.submit`}.
1275
1276 ```tsx
1277 // somewhere
1278 <input
1279 onChange={e => {
1280 fetcher.submit(event.currentTarget.form, { method: "post" });
1281 }}
1282 />
1283
1284 // the state will update
1285 fetcher.state === "submitting"
1286
1287 // and formData will be available
1288 fetcher.formData
1289 ```
1290 */
1291 Submitting: {
1292 state: "submitting";
1293 formMethod: Submission["formMethod"];
1294 formAction: Submission["formAction"];
1295 formEncType: Submission["formEncType"];
1296 text: Submission["text"];
1297 formData: Submission["formData"];
1298 json: Submission["json"];
1299 data: TData | undefined;
1300 };
1301};
1302type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
1303interface BlockerBlocked {
1304 state: "blocked";
1305 reset: () => void;
1306 proceed: () => void;
1307 location: Location;
1308}
1309interface BlockerUnblocked {
1310 state: "unblocked";
1311 reset: undefined;
1312 proceed: undefined;
1313 location: undefined;
1314}
1315interface BlockerProceeding {
1316 state: "proceeding";
1317 reset: undefined;
1318 proceed: undefined;
1319 location: Location;
1320}
1321type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
1322type BlockerFunction = (args: {
1323 currentLocation: Location;
1324 nextLocation: Location;
1325 historyAction: Action;
1326}) => boolean;
1327declare const IDLE_NAVIGATION: NavigationStates["Idle"];
1328declare const IDLE_FETCHER: FetcherStates["Idle"];
1329declare const IDLE_BLOCKER: BlockerUnblocked;
1330/**
1331 * Create a router and listen to history POP navigations
1332 */
1333declare function createRouter(init: RouterInit): Router;
1334interface CreateStaticHandlerOptions {
1335 basename?: string;
1336 mapRouteProperties?: MapRoutePropertiesFunction;
1337 future?: {};
1338}
1339
1340interface IndexRouteObject {
1341 caseSensitive?: AgnosticIndexRouteObject["caseSensitive"];
1342 path?: AgnosticIndexRouteObject["path"];
1343 id?: AgnosticIndexRouteObject["id"];
1344 unstable_middleware?: AgnosticIndexRouteObject["unstable_middleware"];
1345 loader?: AgnosticIndexRouteObject["loader"];
1346 action?: AgnosticIndexRouteObject["action"];
1347 hasErrorBoundary?: AgnosticIndexRouteObject["hasErrorBoundary"];
1348 shouldRevalidate?: AgnosticIndexRouteObject["shouldRevalidate"];
1349 handle?: AgnosticIndexRouteObject["handle"];
1350 index: true;
1351 children?: undefined;
1352 element?: React.ReactNode | null;
1353 hydrateFallbackElement?: React.ReactNode | null;
1354 errorElement?: React.ReactNode | null;
1355 Component?: React.ComponentType | null;
1356 HydrateFallback?: React.ComponentType | null;
1357 ErrorBoundary?: React.ComponentType | null;
1358 lazy?: LazyRouteDefinition<RouteObject>;
1359}
1360interface NonIndexRouteObject {
1361 caseSensitive?: AgnosticNonIndexRouteObject["caseSensitive"];
1362 path?: AgnosticNonIndexRouteObject["path"];
1363 id?: AgnosticNonIndexRouteObject["id"];
1364 unstable_middleware?: AgnosticNonIndexRouteObject["unstable_middleware"];
1365 loader?: AgnosticNonIndexRouteObject["loader"];
1366 action?: AgnosticNonIndexRouteObject["action"];
1367 hasErrorBoundary?: AgnosticNonIndexRouteObject["hasErrorBoundary"];
1368 shouldRevalidate?: AgnosticNonIndexRouteObject["shouldRevalidate"];
1369 handle?: AgnosticNonIndexRouteObject["handle"];
1370 index?: false;
1371 children?: RouteObject[];
1372 element?: React.ReactNode | null;
1373 hydrateFallbackElement?: React.ReactNode | null;
1374 errorElement?: React.ReactNode | null;
1375 Component?: React.ComponentType | null;
1376 HydrateFallback?: React.ComponentType | null;
1377 ErrorBoundary?: React.ComponentType | null;
1378 lazy?: LazyRouteDefinition<RouteObject>;
1379}
1380type RouteObject = IndexRouteObject | NonIndexRouteObject;
1381type DataRouteObject = RouteObject & {
1382 children?: DataRouteObject[];
1383 id: string;
1384};
1385interface RouteMatch<ParamKey extends string = string, RouteObjectType extends RouteObject = RouteObject> extends AgnosticRouteMatch<ParamKey, RouteObjectType> {
1386}
1387interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {
1388}
1389type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
1390type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
1391interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> {
1392 router: Router;
1393 staticContext?: StaticHandlerContext;
1394}
1395declare const DataRouterContext: React.Context<DataRouterContextObject | null>;
1396declare const DataRouterStateContext: React.Context<RouterState | null>;
1397type ViewTransitionContextObject = {
1398 isTransitioning: false;
1399} | {
1400 isTransitioning: true;
1401 flushSync: boolean;
1402 currentLocation: Location;
1403 nextLocation: Location;
1404};
1405declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
1406type FetchersContextObject = Map<string, any>;
1407declare const FetchersContext: React.Context<FetchersContextObject>;
1408interface NavigateOptions {
1409 /** Replace the current entry in the history stack instead of pushing a new one */
1410 replace?: boolean;
1411 /** Adds persistent client side routing state to the next location */
1412 state?: any;
1413 /** If you are using {@link https://api.reactrouter.com/v7/functions/react_router.ScrollRestoration.html <ScrollRestoration>}, prevent the scroll position from being reset to the top of the window when navigating */
1414 preventScrollReset?: boolean;
1415 /** Defines the relative path behavior for the link. "route" will use the route hierarchy so ".." will remove all URL segments of the current route pattern while "path" will use the URL path so ".." will remove one URL segment. */
1416 relative?: RelativeRoutingType;
1417 /** Wraps the initial state update for this navigation in a {@link https://react.dev/reference/react-dom/flushSync ReactDOM.flushSync} call instead of the default {@link https://react.dev/reference/react/startTransition React.startTransition} */
1418 flushSync?: boolean;
1419 /** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link https://api.reactrouter.com/v7/functions/react_router.useViewTransitionState.html useViewTransitionState()} hook. */
1420 viewTransition?: boolean;
1421}
1422/**
1423 * A Navigator is a "location changer"; it's how you get to different locations.
1424 *
1425 * Every history instance conforms to the Navigator interface, but the
1426 * distinction is useful primarily when it comes to the low-level `<Router>` API
1427 * where both the location and a navigator must be provided separately in order
1428 * to avoid "tearing" that may occur in a suspense-enabled app if the action
1429 * and/or location were to be read directly from the history instance.
1430 */
1431interface Navigator {
1432 createHref: History["createHref"];
1433 encodeLocation?: History["encodeLocation"];
1434 go: History["go"];
1435 push(to: To, state?: any, opts?: NavigateOptions): void;
1436 replace(to: To, state?: any, opts?: NavigateOptions): void;
1437}
1438interface NavigationContextObject {
1439 basename: string;
1440 navigator: Navigator;
1441 static: boolean;
1442 future: {};
1443}
1444declare const NavigationContext: React.Context<NavigationContextObject>;
1445interface LocationContextObject {
1446 location: Location;
1447 navigationType: Action;
1448}
1449declare const LocationContext: React.Context<LocationContextObject>;
1450interface RouteContextObject {
1451 outlet: React.ReactElement | null;
1452 matches: RouteMatch[];
1453 isDataRoute: boolean;
1454}
1455declare const RouteContext: React.Context<RouteContextObject>;
1456
1457type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1458type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1459interface HtmlLinkProps {
1460 /**
1461 * Address of the hyperlink
1462 */
1463 href?: string;
1464 /**
1465 * How the element handles crossorigin requests
1466 */
1467 crossOrigin?: "anonymous" | "use-credentials";
1468 /**
1469 * Relationship between the document containing the hyperlink and the destination resource
1470 */
1471 rel: LiteralUnion<"alternate" | "dns-prefetch" | "icon" | "manifest" | "modulepreload" | "next" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "search" | "stylesheet", string>;
1472 /**
1473 * Applicable media: "screen", "print", "(max-width: 764px)"
1474 */
1475 media?: string;
1476 /**
1477 * Integrity metadata used in Subresource Integrity checks
1478 */
1479 integrity?: string;
1480 /**
1481 * Language of the linked resource
1482 */
1483 hrefLang?: string;
1484 /**
1485 * Hint for the type of the referenced resource
1486 */
1487 type?: string;
1488 /**
1489 * Referrer policy for fetches initiated by the element
1490 */
1491 referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
1492 /**
1493 * Sizes of the icons (for rel="icon")
1494 */
1495 sizes?: string;
1496 /**
1497 * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
1498 */
1499 as?: LiteralUnion<"audio" | "audioworklet" | "document" | "embed" | "fetch" | "font" | "frame" | "iframe" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt", string>;
1500 /**
1501 * Color to use when customizing a site's icon (for rel="mask-icon")
1502 */
1503 color?: string;
1504 /**
1505 * Whether the link is disabled
1506 */
1507 disabled?: boolean;
1508 /**
1509 * The title attribute has special semantics on this element: Title of the link; CSS style sheet set name.
1510 */
1511 title?: string;
1512 /**
1513 * Images to use in different situations, e.g., high-resolution displays,
1514 * small monitors, etc. (for rel="preload")
1515 */
1516 imageSrcSet?: string;
1517 /**
1518 * Image sizes for different page layouts (for rel="preload")
1519 */
1520 imageSizes?: string;
1521}
1522interface HtmlLinkPreloadImage extends HtmlLinkProps {
1523 /**
1524 * Relationship between the document containing the hyperlink and the destination resource
1525 */
1526 rel: "preload";
1527 /**
1528 * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
1529 */
1530 as: "image";
1531 /**
1532 * Address of the hyperlink
1533 */
1534 href?: string;
1535 /**
1536 * Images to use in different situations, e.g., high-resolution displays,
1537 * small monitors, etc. (for rel="preload")
1538 */
1539 imageSrcSet: string;
1540 /**
1541 * Image sizes for different page layouts (for rel="preload")
1542 */
1543 imageSizes?: string;
1544}
1545/**
1546 * Represents a `<link>` element.
1547 *
1548 * WHATWG Specification: https://html.spec.whatwg.org/multipage/semantics.html#the-link-element
1549 */
1550type HtmlLinkDescriptor = (HtmlLinkProps & Pick<Required<HtmlLinkProps>, "href">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "imageSizes">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "href"> & {
1551 imageSizes?: never;
1552});
1553interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "type" | "sizes" | "imageSrcSet" | "imageSizes" | "as" | "color" | "title"> {
1554 /**
1555 * The absolute path of the page to prefetch.
1556 */
1557 page: string;
1558}
1559type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
1560
1561/**
1562 * An object of unknown type for route loaders and actions provided by the
1563 * server's `getLoadContext()` function. This is defined as an empty interface
1564 * specifically so apps can leverage declaration merging to augment this type
1565 * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1566 */
1567interface AppLoadContext {
1568 [key: string]: unknown;
1569}
1570
1571type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
1572 [key: PropertyKey]: Serializable;
1573} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
1574
1575type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
1576type IsAny<T> = 0 extends 1 & T ? true : false;
1577type Func = (...args: any[]) => unknown;
1578type Pretty<T> = {
1579 [K in keyof T]: T[K];
1580} & {};
1581type Normalize<T> = _Normalize<UnionKeys<T>, T>;
1582type _Normalize<Key extends keyof any, T> = T extends infer U ? Pretty<{
1583 [K in Key as K extends keyof U ? undefined extends U[K] ? never : K : never]: K extends keyof U ? U[K] : never;
1584} & {
1585 [K in Key as K extends keyof U ? undefined extends U[K] ? K : never : never]?: K extends keyof U ? U[K] : never;
1586} & {
1587 [K in Key as K extends keyof U ? never : K]?: undefined;
1588}> : never;
1589type UnionKeys<T> = T extends any ? keyof T : never;
1590
1591type RouteModule$1 = {
1592 meta?: Func;
1593 links?: Func;
1594 headers?: Func;
1595 loader?: Func;
1596 clientLoader?: Func;
1597 action?: Func;
1598 clientAction?: Func;
1599 HydrateFallback?: Func;
1600 default?: Func;
1601 ErrorBoundary?: Func;
1602 [key: string]: unknown;
1603};
1604
1605/**
1606 * A brand that can be applied to a type to indicate that it will serialize
1607 * to a specific type when transported to the client from a loader.
1608 * Only use this if you have additional serialization/deserialization logic
1609 * in your application.
1610 */
1611type unstable_SerializesTo<T> = {
1612 unstable__ReactRouter_SerializesTo: [T];
1613};
1614
1615type 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> ? {
1616 [K in keyof T]: Serialize<T[K]>;
1617} : undefined;
1618type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
1619type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
1620type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? U : T;
1621type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
1622type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1623type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1624type ClientDataFunctionArgs<Params> = {
1625 /**
1626 * A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
1627 *
1628 * @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
1629 **/
1630 request: Request;
1631 /**
1632 * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1633 * @example
1634 * // app/routes.ts
1635 * route("teams/:teamId", "./team.tsx"),
1636 *
1637 * // app/team.tsx
1638 * export function clientLoader({
1639 * params,
1640 * }: Route.ClientLoaderArgs) {
1641 * params.teamId;
1642 * // ^ string
1643 * }
1644 **/
1645 params: Params;
1646 /**
1647 * When `future.unstable_middleware` is not enabled, this is undefined.
1648 *
1649 * When `future.unstable_middleware` is enabled, this is an instance of
1650 * `unstable_RouterContextProvider` and can be used to access context values
1651 * from your route middlewares. You may pass in initial context values in your
1652 * `<HydratedRouter unstable_getContext>` prop
1653 */
1654 context: unstable_RouterContextProvider;
1655};
1656type ServerDataFunctionArgs<Params> = {
1657 /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
1658 request: Request;
1659 /**
1660 * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1661 * @example
1662 * // app/routes.ts
1663 * route("teams/:teamId", "./team.tsx"),
1664 *
1665 * // app/team.tsx
1666 * export function loader({
1667 * params,
1668 * }: Route.LoaderArgs) {
1669 * params.teamId;
1670 * // ^ string
1671 * }
1672 **/
1673 params: Params;
1674 /**
1675 * Without `future.unstable_middleware` enabled, this is the context passed in
1676 * to your server adapter's `getLoadContext` function. It's a way to bridge the
1677 * gap between the adapter's request/response API with your React Router app.
1678 * It is only applicable if you are using a custom server adapter.
1679 *
1680 * With `future.unstable_middleware` enabled, this is an instance of
1681 * `unstable_RouterContextProvider` and can be used for type-safe access to
1682 * context value set in your route middlewares. If you are using a custom
1683 * server adapter, you may provide an initial set of context values from your
1684 * `getLoadContext` function.
1685 */
1686 context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
1687};
1688type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
1689 ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
1690] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1691type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
1692type IsHydrate<ClientLoader> = ClientLoader extends {
1693 hydrate: true;
1694} ? true : ClientLoader extends {
1695 hydrate: false;
1696} ? false : false;
1697type GetLoaderData<T extends RouteModule$1> = _DataLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
1698 HydrateFallback: Func;
1699} ? true : false>;
1700type _DataLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
1701 HasHydrateFallback,
1702 ClientLoaderHydrate
1703] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
1704 IsDefined<ClientLoaderData>,
1705 IsDefined<ServerLoaderData>
1706] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
1707type GetActionData<T extends RouteModule$1> = _DataActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
1708type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
1709 IsDefined<ServerActionData>,
1710 IsDefined<ClientActionData>
1711] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1712
1713interface RouteModules {
1714 [routeId: string]: RouteModule | undefined;
1715}
1716/**
1717 * The shape of a route module shipped to the client
1718 */
1719interface RouteModule {
1720 clientAction?: ClientActionFunction;
1721 clientLoader?: ClientLoaderFunction;
1722 unstable_clientMiddleware?: unstable_MiddlewareFunction<undefined>[];
1723 ErrorBoundary?: ErrorBoundaryComponent;
1724 HydrateFallback?: HydrateFallbackComponent;
1725 Layout?: LayoutComponent;
1726 default: RouteComponent;
1727 handle?: RouteHandle;
1728 links?: LinksFunction;
1729 meta?: MetaFunction;
1730 shouldRevalidate?: ShouldRevalidateFunction;
1731}
1732/**
1733 * The shape of a route module on the server
1734 */
1735interface ServerRouteModule extends RouteModule {
1736 action?: ActionFunction;
1737 headers?: HeadersFunction | {
1738 [name: string]: string;
1739 };
1740 loader?: LoaderFunction;
1741 unstable_middleware?: unstable_MiddlewareFunction<Response>[];
1742}
1743/**
1744 * A function that handles data mutations for a route on the client
1745 */
1746type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<ActionFunction>;
1747/**
1748 * Arguments passed to a route `clientAction` function
1749 */
1750type ClientActionFunctionArgs = ActionFunctionArgs & {
1751 serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
1752};
1753/**
1754 * A function that loads data for a route on the client
1755 */
1756type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<LoaderFunction>) & {
1757 hydrate?: boolean;
1758};
1759/**
1760 * Arguments passed to a route `clientLoader` function
1761 */
1762type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
1763 serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
1764};
1765/**
1766 * ErrorBoundary to display for this route
1767 */
1768type ErrorBoundaryComponent = ComponentType;
1769type HeadersArgs = {
1770 loaderHeaders: Headers;
1771 parentHeaders: Headers;
1772 actionHeaders: Headers;
1773 errorHeaders: Headers | undefined;
1774};
1775/**
1776 * A function that returns HTTP headers to be used for a route. These headers
1777 * will be merged with (and take precedence over) headers from parent routes.
1778 */
1779interface HeadersFunction {
1780 (args: HeadersArgs): Headers | HeadersInit;
1781}
1782/**
1783 * `<Route HydrateFallback>` component to render on initial loads
1784 * when client loaders are present
1785 */
1786type HydrateFallbackComponent = ComponentType;
1787/**
1788 * Optional, root-only `<Route Layout>` component to wrap the root content in.
1789 * Useful for defining the <html>/<head>/<body> document shell shared by the
1790 * Component, HydrateFallback, and ErrorBoundary
1791 */
1792type LayoutComponent = ComponentType<{
1793 children: ReactElement<unknown, ErrorBoundaryComponent | HydrateFallbackComponent | RouteComponent>;
1794}>;
1795/**
1796 * A function that defines `<link>` tags to be inserted into the `<head>` of
1797 * the document on route transitions.
1798 *
1799 * @see https://remix.run/route/meta
1800 */
1801interface LinksFunction {
1802 (): LinkDescriptor[];
1803}
1804interface MetaMatch<RouteId extends string = string, Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown> {
1805 id: RouteId;
1806 pathname: DataRouteMatch["pathname"];
1807 data: Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown;
1808 handle?: RouteHandle;
1809 params: DataRouteMatch["params"];
1810 meta: MetaDescriptor[];
1811 error?: unknown;
1812}
1813type MetaMatches<MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> = Array<{
1814 [K in keyof MatchLoaders]: MetaMatch<Exclude<K, number | symbol>, MatchLoaders[K]>;
1815}[keyof MatchLoaders]>;
1816interface MetaArgs<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
1817 data: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
1818 params: Params;
1819 location: Location;
1820 matches: MetaMatches<MatchLoaders>;
1821 error?: unknown;
1822}
1823/**
1824 * A function that returns an array of data objects to use for rendering
1825 * metadata HTML tags in a route. These tags are not rendered on descendant
1826 * routes in the route hierarchy. In other words, they will only be rendered on
1827 * the route in which they are exported.
1828 *
1829 * @param Loader - The type of the current route's loader function
1830 * @param MatchLoaders - Mapping from a parent route's filepath to its loader
1831 * function type
1832 *
1833 * Note that parent route filepaths are relative to the `app/` directory.
1834 *
1835 * For example, if this meta function is for `/sales/customers/$customerId`:
1836 *
1837 * ```ts
1838 * // app/root.tsx
1839 * const loader = () => ({ hello: "world" })
1840 * export type Loader = typeof loader
1841 *
1842 * // app/routes/sales.tsx
1843 * const loader = () => ({ salesCount: 1074 })
1844 * export type Loader = typeof loader
1845 *
1846 * // app/routes/sales/customers.tsx
1847 * const loader = () => ({ customerCount: 74 })
1848 * export type Loader = typeof loader
1849 *
1850 * // app/routes/sales/customers/$customersId.tsx
1851 * import type { Loader as RootLoader } from "../../../root"
1852 * import type { Loader as SalesLoader } from "../../sales"
1853 * import type { Loader as CustomersLoader } from "../../sales/customers"
1854 *
1855 * const loader = () => ({ name: "Customer name" })
1856 *
1857 * const meta: MetaFunction<typeof loader, {
1858 * "root": RootLoader,
1859 * "routes/sales": SalesLoader,
1860 * "routes/sales/customers": CustomersLoader,
1861 * }> = ({ data, matches }) => {
1862 * const { name } = data
1863 * // ^? string
1864 * const { customerCount } = matches.find((match) => match.id === "routes/sales/customers").data
1865 * // ^? number
1866 * const { salesCount } = matches.find((match) => match.id === "routes/sales").data
1867 * // ^? number
1868 * const { hello } = matches.find((match) => match.id === "root").data
1869 * // ^? "world"
1870 * }
1871 * ```
1872 */
1873interface MetaFunction<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
1874 (args: MetaArgs<Loader, MatchLoaders>): MetaDescriptor[] | undefined;
1875}
1876type MetaDescriptor = {
1877 charSet: "utf-8";
1878} | {
1879 title: string;
1880} | {
1881 name: string;
1882 content: string;
1883} | {
1884 property: string;
1885 content: string;
1886} | {
1887 httpEquiv: string;
1888 content: string;
1889} | {
1890 "script:ld+json": LdJsonObject;
1891} | {
1892 tagName: "meta" | "link";
1893 [name: string]: string;
1894} | {
1895 [name: string]: unknown;
1896};
1897type LdJsonObject = {
1898 [Key in string]: LdJsonValue;
1899} & {
1900 [Key in string]?: LdJsonValue | undefined;
1901};
1902type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
1903type LdJsonPrimitive = string | number | boolean | null;
1904type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
1905/**
1906 * A React component that is rendered for a route.
1907 */
1908type RouteComponent = ComponentType<{}>;
1909/**
1910 * An arbitrary object that is associated with a route.
1911 *
1912 * @see https://remix.run/route/handle
1913 */
1914type RouteHandle = unknown;
1915
1916export { type GetScrollRestorationKeyFunction as $, Action as A, type BlockerFunction as B, type ClientDataFunctionArgs as C, type DataStrategyFunction as D, type unstable_InitialContext as E, type Equal as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type ClientActionFunction as J, type ClientLoaderFunction as K, type LinkDescriptor as L, type MetaDescriptor as M, type Normalize as N, type HeadersFunction as O, type Pretty as P, type ShouldRevalidateFunction as Q, type RouteModule$1 as R, type ServerDataFunctionArgs as S, type To as T, type UIMatch as U, type RouterInit as V, type RouterState as W, type PatchRoutesOnNavigationFunction as X, type DataRouteObject as Y, type StaticHandler as Z, type GetScrollPositionFunction as _, type Location as a, type ServerRouteModule as a$, type StaticHandlerContext as a0, type Fetcher as a1, type NavigationStates as a2, type RouterSubscriber as a3, type RouterNavigateOptions as a4, type RouterFetchOptions as a5, type RevalidationState as a6, type ActionFunctionArgs as a7, type DataStrategyFunctionArgs as a8, type DataStrategyMatch as a9, replace as aA, resolvePath as aB, type DataRouteMatch as aC, type Navigator as aD, type PatchRoutesOnNavigationFunctionArgs as aE, type RouteMatch as aF, type ClientActionFunctionArgs as aG, type ClientLoaderFunctionArgs as aH, type HeadersArgs as aI, type MetaArgs as aJ, type PageLinkDescriptor as aK, type HtmlLinkDescriptor as aL, type Future as aM, type unstable_SerializesTo as aN, createBrowserHistory as aO, invariant as aP, createRouter as aQ, ErrorResponseImpl as aR, DataRouterContext as aS, DataRouterStateContext as aT, FetchersContext as aU, LocationContext as aV, NavigationContext as aW, RouteContext as aX, ViewTransitionContext as aY, type FutureConfig as aZ, type RouteManifest as a_, type DataStrategyResult as aa, DataWithResponseInit as ab, type ErrorResponse as ac, type FormEncType as ad, type FormMethod as ae, type HTMLFormMethod as af, type LazyRouteFunction as ag, type LoaderFunctionArgs as ah, type unstable_MiddlewareFunction as ai, type PathParam as aj, type RedirectFunction as ak, type unstable_RouterContext as al, type ShouldRevalidateFunctionArgs as am, unstable_createContext as an, createPath as ao, parsePath as ap, IDLE_NAVIGATION as aq, IDLE_FETCHER as ar, IDLE_BLOCKER as as, data as at, generatePath as au, isRouteErrorResponse as av, matchPath as aw, matchRoutes as ax, redirect as ay, redirectDocument as az, type ServerDataFrom as b, type History as b0, type CreateStaticHandlerOptions as b1, type GetActionData as c, type Router as d, type RouteModules as e, type NavigateOptions as f, type Blocker as g, type SerializeFrom as h, type RelativeRoutingType as i, type ParamParseKey as j, type Path as k, type PathPattern as l, type PathMatch as m, type Navigation as n, type Params as o, type RouteObject as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type MetaFunction as t, type unstable_MiddlewareNextFunction as u, type LinksFunction as v, type NonIndexRouteObject as w, type AppLoadContext as x, unstable_RouterContextProvider as y, type MiddlewareEnabled as z };