import type { ReactElement } from 'react'; export type Action = 'PUSH' | 'REPLACE' | 'POP'; export type Location = { pathname: string; action?: Action; } & Record; export interface NonIndexRouteObject { caseSensitive?: boolean; children?: RouteObject[]; handle?: Record; element?: React.ReactNode | null; errorElement?: React.ReactNode | null; index?: any; path?: string; } export interface IndexRouteObject { caseSensitive?: boolean; children?: undefined; handle?: Record; element?: React.ReactNode | null; errorElement?: React.ReactNode | null; index: any; path?: string; } export type RouteObject = (IndexRouteObject | NonIndexRouteObject) & Record; export type Params = { readonly [key in Key]: string | undefined; }; export type UseRoutes = (routes: RouteObject[], locationArg?: Partial | string) => React.ReactElement | null; export interface RouteMatch { /** * The names and values of dynamic parameters in the URL. */ params: Params; /** * The portion of the URL pathname that was matched. */ pathname: string; /** * The portion of the URL pathname that was matched before child routes. */ pathnameBase: string; /** * The route object that was used to match. */ route: RouteObject; } export type UseEffect = (cb: () => void, deps: unknown[]) => void; export type UseLocation = () => Location; export type UseNavigationType = () => Action; export type RouteObjectArrayAlias = any; export type RouteMatchAlias = any; export type CreateRoutesFromChildren = (children: ReactElement[]) => RouteObjectArrayAlias; export type MatchRoutes = (routes: RouteObjectArrayAlias, location: Location, basename?: string) => RouteMatchAlias[] | null; export type ShouldRevalidateFunction = (args: any) => boolean; interface DataFunctionArgs { request: Request; params: Params; } type LoaderFunctionArgs = DataFunctionArgs; type ActionFunctionArgs = DataFunctionArgs; export interface LoaderFunction { (args: LoaderFunctionArgs): Promise | Response | Promise | any; } export interface ActionFunction { (args: ActionFunctionArgs): Promise | Response | Promise | any; } declare type AgnosticBaseRouteObject = { caseSensitive?: boolean; path?: string; id?: string; loader?: LoaderFunction; action?: ActionFunction; hasErrorBoundary?: boolean; shouldRevalidate?: ShouldRevalidateFunction; handle?: any; }; export declare type AgnosticIndexRouteObject = AgnosticBaseRouteObject & Record; export declare type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & Record; export declare type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & { id: string; }; export declare type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & { children?: AgnosticDataRouteObject[]; id: string; }; export interface AgnosticRouteMatch { params: Params; pathname: string; pathnameBase: string; route: RouteObjectType; } export type AgnosticDataRouteMatch = AgnosticRouteMatch; interface UseMatchesMatch { id: string; pathname: string; params: AgnosticRouteMatch['params']; data: unknown; handle: unknown; } export interface GetScrollRestorationKeyFunction { (location: Location, matches: UseMatchesMatch[]): string | null; } export interface Path { pathname: string; search: string; hash: string; } export interface RouterSubscriber { (state: TState): void; } export interface GetScrollPositionFunction { (): number; } declare type LinkNavigateOptions = { replace?: boolean; state?: any; preventScrollReset?: boolean; }; export declare type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject; export declare type To = string | Partial; export declare type HydrationState = any; export declare type FormMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; export declare type FormEncType = 'application/x-www-form-urlencoded' | 'multipart/form-data'; export declare type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; export declare type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject; declare type SubmissionNavigateOptions = { replace?: boolean; state?: any; formMethod?: FormMethod; formEncType?: FormEncType; formData: FormData; }; export interface RouterInit { basename: string; routes: AgnosticRouteObject[]; history: History; hydrationData?: HydrationState; } export type NavigationState = { state: 'idle' | 'loading' | 'submitting'; }; export type NavigationStates = { Idle: NavigationState; Loading: NavigationState; Submitting: NavigationState; }; export type Navigation = NavigationStates[keyof NavigationStates]; export type RouteData = any; export type Fetcher = any; type HistoryAction = 'POP' | 'PUSH' | 'REPLACE'; export interface RouterState { historyAction: Action | HistoryAction | any; location: Location; navigation: Navigation; } export interface Router { state: TState; subscribe(fn: RouterSubscriber): () => void; } export type CreateRouterFunction = Router> = (routes: RouteObject[], opts?: any) => TRouter; export {}; //# sourceMappingURL=types.d.ts.map