import { AnyRoute, StaticDataRouteOption } from './route.cjs'; import { AllContext, AllLoaderData, AllParams, FullSearchSchema, ParseRoute, RouteById, RouteIds } from './routeInfo.cjs'; import { AnyRouter, RegisteredRouter } from './router.cjs'; import { Constrain, ControlledPromise } from './utils.cjs'; export type AnyMatchAndValue = { match: any; value: any; }; export type FindValueByIndex> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never; export type FindValueByKey = TValue extends ReadonlyArray ? FindValueByIndex : TValue[TKey & keyof TValue]; export type CreateMatchAndValue = TValue extends any ? { match: TMatch; value: TValue; } : never; export type NextMatchAndValue = TMatchAndValue extends any ? CreateMatchAndValue> : never; export type IsMatchKeyOf = TValue extends ReadonlyArray ? number extends TValue['length'] ? `${number}` : keyof TValue & `${number}` : TValue extends object ? keyof TValue & string : never; export type IsMatchPath = `${TParentPath}${IsMatchKeyOf}`; export type IsMatchResult = TMatchAndValue extends any ? TKey extends keyof TMatchAndValue['value'] ? TMatchAndValue['match'] : never : never; export type IsMatchParse = TPath extends `${string}.${string}` ? TPath extends `${infer TFirst}.${infer TRest}` ? IsMatchParse, `${TParentPath}${TFirst}.`> : never : { path: IsMatchPath; result: IsMatchResult; }; export type IsMatch = IsMatchParse; /** * Narrows matches based on a path * @experimental */ export declare const isMatch: (match: TMatch, path: Constrain["path"]>) => match is IsMatch["result"]; export interface DefaultRouteMatchExtensions { scripts?: unknown; links?: unknown; headScripts?: unknown; meta?: unknown; } export interface RouteMatchExtensions extends DefaultRouteMatchExtensions { } export interface RouteMatch extends RouteMatchExtensions { id: string; routeId: TRouteId; fullPath: TFullPath; index: number; pathname: string; params: TAllParams; _strictParams: TAllParams; status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'; isFetching: false | 'beforeLoad' | 'loader'; error: unknown; paramsError: unknown; searchError: unknown; updatedAt: number; loadPromise?: ControlledPromise; beforeLoadPromise?: ControlledPromise; loaderPromise?: ControlledPromise; loaderData?: TLoaderData; __routeContext: Record; __beforeLoadContext: Record; context: TAllContext; search: TFullSearchSchema; _strictSearch: TFullSearchSchema; fetchCount: number; abortController: AbortController; cause: 'preload' | 'enter' | 'stay'; loaderDeps: TLoaderDeps; preload: boolean; invalid: boolean; headers?: Record; globalNotFound?: boolean; staticData: StaticDataRouteOption; minPendingPromise?: ControlledPromise; pendingTimeout?: ReturnType; } export type MakeRouteMatchFromRoute = RouteMatch; export type MakeRouteMatch, TStrict extends boolean = true> = RouteMatch['types']['fullPath'], TStrict extends false ? AllParams : RouteById['types']['allParams'], TStrict extends false ? FullSearchSchema : RouteById['types']['fullSearchSchema'], TStrict extends false ? AllLoaderData : RouteById['types']['loaderData'], TStrict extends false ? AllContext : RouteById['types']['allContext'], RouteById['types']['loaderDeps']>; export type AnyRouteMatch = RouteMatch; export type MakeRouteMatchUnion> = TRoute extends any ? RouteMatch : never; /** * The `MatchRouteOptions` type is used to describe the options that can be used when matching a route. * * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#matchrouteoptions-type) */ export interface MatchRouteOptions { /** * If `true`, will match against pending location instead of the current location. * * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#pending-property) */ pending?: boolean; /** * If `true`, will match against the current location with case sensitivity. * * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#casesensitive-property) */ caseSensitive?: boolean; /** * If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`. * * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#includesearch-property) */ includeSearch?: boolean; /** * If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`. * * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#fuzzy-property) */ fuzzy?: boolean; }