@tanstack/router-core 1.112.8 → 1.112.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sources":["../../src/router.ts"],"sourcesContent":["import type { ParsedLocation } from './location'\nimport type { DeferredPromiseState } from './defer'\nimport type { ControlledPromise } from './utils'\nimport type { AnyRoute, AnyRouteWithContext } from './route'\n\nexport interface Register {\n // router: Router\n}\n\nexport type RegisteredRouter = Register extends {\n router: infer TRouter extends AnyRouter\n}\n ? TRouter\n : AnyRouter\n\nexport interface RouterOptions<\n in out TTrailingSlashOption extends TrailingSlashOption,\n> {\n trailingSlash?: TTrailingSlashOption\n}\n\nexport interface Router<\n in out TRouteTree extends AnyRoute,\n in out TTrailingSlashOption extends TrailingSlashOption,\n> {\n routeTree: TRouteTree\n options: RouterOptions<TTrailingSlashOption>\n}\n\nexport type AnyRouterWithContext<TContext> = Router<\n AnyRouteWithContext<TContext>,\n any\n>\n\nexport type AnyRouter = Router<any, any>\n\nexport interface ViewTransitionOptions {\n types: Array<string>\n}\n\nexport function defaultSerializeError(err: unknown) {\n if (err instanceof Error) {\n const obj = {\n name: err.name,\n message: err.message,\n }\n\n if (process.env.NODE_ENV === 'development') {\n ;(obj as any).stack = err.stack\n }\n\n return obj\n }\n\n return {\n data: err,\n }\n}\nexport interface ExtractedBaseEntry {\n dataType: '__beforeLoadContext' | 'loaderData'\n type: string\n path: Array<string>\n id: number\n matchIndex: number\n}\n\nexport interface ExtractedStream extends ExtractedBaseEntry {\n type: 'stream'\n streamState: StreamState\n}\n\nexport interface ExtractedPromise extends ExtractedBaseEntry {\n type: 'promise'\n promiseState: DeferredPromiseState<any>\n}\n\nexport type ExtractedEntry = ExtractedStream | ExtractedPromise\n\nexport type StreamState = {\n promises: Array<ControlledPromise<string | null>>\n}\n\nexport type TrailingSlashOption = 'always' | 'never' | 'preserve'\n\nexport function getLocationChangeInfo(routerState: {\n resolvedLocation?: ParsedLocation\n location: ParsedLocation\n}) {\n const fromLocation = routerState.resolvedLocation\n const toLocation = routerState.location\n const pathChanged = fromLocation?.pathname !== toLocation.pathname\n const hrefChanged = fromLocation?.href !== toLocation.href\n const hashChanged = fromLocation?.hash !== toLocation.hash\n return { fromLocation, toLocation, pathChanged, hrefChanged, hashChanged }\n}\n"],"names":[],"mappings":"AAwCO,SAAS,sBAAsB,KAAc;AAClD,MAAI,eAAe,OAAO;AACxB,UAAM,MAAM;AAAA,MACV,MAAM,IAAI;AAAA,MACV,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,QAAQ,IAAI,aAAa,eAAe;AACxC,UAAY,QAAQ,IAAI;AAAA,IAAA;AAGrB,WAAA;AAAA,EAAA;AAGF,SAAA;AAAA,IACL,MAAM;AAAA,EACR;AACF;AA2BO,SAAS,sBAAsB,aAGnC;AACD,QAAM,eAAe,YAAY;AACjC,QAAM,aAAa,YAAY;AACzB,QAAA,eAAc,6CAAc,cAAa,WAAW;AACpD,QAAA,eAAc,6CAAc,UAAS,WAAW;AAChD,QAAA,eAAc,6CAAc,UAAS,WAAW;AACtD,SAAO,EAAE,cAAc,YAAY,aAAa,aAAa,YAAY;AAC3E;"}
1
+ {"version":3,"file":"router.js","sources":["../../src/router.ts"],"sourcesContent":["import type { ParsedLocation } from './location'\nimport type { DeferredPromiseState } from './defer'\nimport type {\n ControlledPromise,\n NoInfer,\n NonNullableUpdater,\n Updater,\n} from './utils'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouteWithContext,\n MakeRemountDepsOptionsUnion,\n RouteMask,\n} from './route'\nimport type { Store } from '@tanstack/store'\nimport type {\n FullSearchSchema,\n RouteById,\n RoutePaths,\n RoutesById,\n RoutesByPath,\n} from './routeInfo'\nimport type {\n AnyRouteMatch,\n MakeRouteMatchUnion,\n MatchRouteOptions,\n} from './Matches'\nimport type { AnyRedirect, ResolvedRedirect } from './redirect'\nimport type {\n BuildLocationFn,\n CommitLocationOptions,\n NavigateFn,\n} from './RouterProvider'\nimport type {\n HistoryLocation,\n HistoryState,\n ParsedHistoryState,\n RouterHistory,\n} from '@tanstack/history'\nimport type { Manifest } from './manifest'\nimport type { StartSerializer } from './serializer'\nimport type { AnySchema } from './validators'\nimport type { NavigateOptions, ResolveRelativePath, ToOptions } from './link'\nimport type { SearchParser, SearchSerializer } from './searchParams'\n\ndeclare global {\n interface Window {\n __TSR_ROUTER__?: AnyRouter\n }\n}\n\nexport type ControllablePromise<T = any> = Promise<T> & {\n resolve: (value: T) => void\n reject: (value?: any) => void\n}\n\nexport type InjectedHtmlEntry = Promise<string>\n\nexport interface Register {\n // router: Router\n}\n\nexport type RegisteredRouter = Register extends {\n router: infer TRouter extends AnyRouter\n}\n ? TRouter\n : AnyRouter\n\nexport type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (\n opts: MakeRemountDepsOptionsUnion<TRouteTree>,\n) => any\n\nexport interface DefaultRouterOptionsExtensions {}\n\nexport interface RouterOptionsExtensions\n extends DefaultRouterOptionsExtensions {}\n\nexport interface RouterOptions<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean = false,\n TRouterHistory extends RouterHistory = RouterHistory,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> extends RouterOptionsExtensions {\n /**\n * The history object that will be used to manage the browser history.\n *\n * If not provided, a new createBrowserHistory instance will be created and used.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)\n */\n history?: TRouterHistory\n /**\n * A function that will be used to stringify search params when generating links.\n *\n * @default defaultStringifySearch\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)\n */\n stringifySearch?: SearchSerializer\n /**\n * A function that will be used to parse search params when parsing the current location.\n *\n * @default defaultParseSearch\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)\n */\n parseSearch?: SearchParser\n /**\n * If `false`, routes will not be preloaded by default in any way.\n *\n * If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.\n *\n * If `'viewport'`, routes will be preloaded by default when they are within the viewport.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n */\n defaultPreload?: false | 'intent' | 'viewport' | 'render'\n /**\n * The delay in milliseconds that a route must be hovered over or touched before it is preloaded.\n *\n * @default 50\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)\n */\n defaultPreloadDelay?: number\n /**\n * The default `pendingMs` a route should use if no pendingMs is provided.\n *\n * @default 1000\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)\n */\n defaultPendingMs?: number\n /**\n * The default `pendingMinMs` a route should use if no pendingMinMs is provided.\n *\n * @default 500\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)\n */\n defaultPendingMinMs?: number\n /**\n * The default `staleTime` a route should use if no staleTime is provided. This is the time in milliseconds that a route will be considered fresh.\n *\n * @default 0\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)\n */\n defaultStaleTime?: number\n /**\n * The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.\n *\n * @default 30_000 `(30 seconds)`\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n */\n defaultPreloadStaleTime?: number\n /**\n * The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.\n *\n * @default 1_800_000 `(30 minutes)`\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n */\n defaultPreloadGcTime?: number\n /**\n * If `true`, route navigations will called using `document.startViewTransition()`.\n *\n * If the browser does not support this api, this option will be ignored.\n *\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)\n */\n defaultViewTransition?: boolean | ViewTransitionOptions\n /**\n * The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating\n *\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)\n */\n defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions\n /**\n * @default 'fuzzy'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)\n */\n notFoundMode?: 'root' | 'fuzzy'\n /**\n * The default `gcTime` a route should use if no gcTime is provided.\n *\n * @default 1_800_000 `(30 minutes)`\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)\n */\n defaultGcTime?: number\n /**\n * If `true`, all routes will be matched as case-sensitive.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)\n */\n caseSensitive?: boolean\n /**\n *\n * The route tree that will be used to configure the router instance.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)\n */\n routeTree?: TRouteTree\n /**\n * The basepath for then entire router. This is useful for mounting a router instance at a subpath.\n *\n * @default '/'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)\n */\n basepath?: string\n /**\n * The root context that will be provided to all routes in the route tree.\n *\n * This can be used to provide a context to all routes in the tree without having to provide it to each route individually.\n *\n * Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)\n */\n context?: InferRouterContext<TRouteTree>\n /**\n * A function that will be called when the router is dehydrated.\n *\n * The return value of this function will be serialized and stored in the router's dehydrated state.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)\n */\n dehydrate?: () => TDehydrated\n /**\n * A function that will be called when the router is hydrated.\n *\n * The return value of this function will be serialized and stored in the router's dehydrated state.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)\n */\n hydrate?: (dehydrated: TDehydrated) => void\n /**\n * An array of route masks that will be used to mask routes in the route tree.\n *\n * Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)\n */\n routeMasks?: Array<RouteMask<TRouteTree>>\n /**\n * If `true`, route masks will, by default, be removed when the page is reloaded.\n *\n * This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)\n */\n unmaskOnReload?: boolean\n\n /**\n * Use `notFoundComponent` instead.\n *\n * @deprecated\n * See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)\n */\n notFoundRoute?: AnyRoute\n /**\n * Configures how trailing slashes are treated.\n *\n * - `'always'` will add a trailing slash if not present\n * - `'never'` will remove the trailing slash if present\n * - `'preserve'` will not modify the trailing slash.\n *\n * @default 'never'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)\n */\n trailingSlash?: TTrailingSlashOption\n /**\n * While usually automatic, sometimes it can be useful to force the router into a server-side state, e.g. when using the router in a non-browser environment that has access to a global.document object.\n *\n * @default typeof document !== 'undefined'\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)\n */\n isServer?: boolean\n\n defaultSsr?: boolean\n\n search?: {\n /**\n * Configures how unknown search params (= not returned by any `validateSearch`) are treated.\n *\n * @default false\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)\n */\n strict?: boolean\n }\n\n /**\n * Configures whether structural sharing is enabled by default for fine-grained selectors.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstructuralsharing-property)\n */\n defaultStructuralSharing?: TDefaultStructuralSharingOption\n\n /**\n * Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)\n */\n pathParamsAllowedCharacters?: Array<\n ';' | ':' | '@' | '&' | '=' | '+' | '$' | ','\n >\n\n defaultRemountDeps?: DefaultRemountDepsFn<TRouteTree>\n\n /**\n * If `true`, scroll restoration will be enabled\n *\n * @default false\n */\n scrollRestoration?: boolean\n\n /**\n * A function that will be called to get the key for the scroll restoration cache.\n *\n * @default (location) => location.href\n */\n getScrollRestorationKey?: (location: ParsedLocation) => string\n /**\n * The default behavior for scroll restoration.\n *\n * @default 'auto'\n */\n scrollRestorationBehavior?: ScrollBehavior\n /**\n * An array of selectors that will be used to scroll to the top of the page in addition to `window`\n *\n * @default ['window']\n */\n scrollToTopSelectors?: Array<string>\n}\n\nexport interface RouterState<\n in out TRouteTree extends AnyRoute = AnyRoute,\n in out TRouteMatch = MakeRouteMatchUnion,\n> {\n status: 'pending' | 'idle'\n loadedAt: number\n isLoading: boolean\n isTransitioning: boolean\n matches: Array<TRouteMatch>\n pendingMatches?: Array<TRouteMatch>\n cachedMatches: Array<TRouteMatch>\n location: ParsedLocation<FullSearchSchema<TRouteTree>>\n resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>\n statusCode: number\n redirect?: ResolvedRedirect\n}\n\nexport interface BuildNextOptions {\n to?: string | number | null\n params?: true | Updater<unknown>\n search?: true | Updater<unknown>\n hash?: true | Updater<string>\n state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n mask?: {\n to?: string | number | null\n params?: true | Updater<unknown>\n search?: true | Updater<unknown>\n hash?: true | Updater<string>\n state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n unmaskOnReload?: boolean\n }\n from?: string\n _fromLocation?: ParsedLocation\n href?: string\n}\n\ntype NavigationEventInfo = {\n fromLocation?: ParsedLocation\n toLocation: ParsedLocation\n pathChanged: boolean\n hrefChanged: boolean\n hashChanged: boolean\n}\n\nexport type RouterEvents = {\n onBeforeNavigate: {\n type: 'onBeforeNavigate'\n } & NavigationEventInfo\n onBeforeLoad: {\n type: 'onBeforeLoad'\n } & NavigationEventInfo\n onLoad: {\n type: 'onLoad'\n } & NavigationEventInfo\n onResolved: {\n type: 'onResolved'\n } & NavigationEventInfo\n onBeforeRouteMount: {\n type: 'onBeforeRouteMount'\n } & NavigationEventInfo\n onInjectedHtml: {\n type: 'onInjectedHtml'\n promise: Promise<string>\n }\n onRendered: {\n type: 'onRendered'\n } & NavigationEventInfo\n}\n\nexport type RouterEvent = RouterEvents[keyof RouterEvents]\n\nexport type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void\n\nexport type RouterListener<TRouterEvent extends RouterEvent> = {\n eventType: TRouterEvent['type']\n fn: ListenerFn<TRouterEvent>\n}\n\nexport interface MatchRoutesOpts {\n preload?: boolean\n throwOnError?: boolean\n _buildLocation?: boolean\n dest?: BuildNextOptions\n}\n\nexport type InferRouterContext<TRouteTree extends AnyRoute> =\n TRouteTree['types']['routerContext']\n\nexport type RouterContextOptions<TRouteTree extends AnyRoute> =\n AnyContext extends InferRouterContext<TRouteTree>\n ? {\n context?: InferRouterContext<TRouteTree>\n }\n : {\n context: InferRouterContext<TRouteTree>\n }\n\nexport type RouterConstructorOptions<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n TDehydrated extends Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >,\n 'context'\n> &\n RouterContextOptions<TRouteTree>\n\nexport interface RouterErrorSerializer<TSerializedError> {\n serialize: (err: unknown) => TSerializedError\n deserialize: (err: TSerializedError) => unknown\n}\n\nexport interface MatchedRoutesResult {\n matchedRoutes: Array<AnyRoute>\n routeParams: Record<string, string>\n}\n\nexport type PreloadRouteFn<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n> = <\n TFrom extends RoutePaths<TRouteTree> | string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,\n TMaskTo extends string = '',\n>(\n opts: NavigateOptions<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n >,\n) => Promise<Array<AnyRouteMatch> | undefined>\n\nexport type MatchRouteFn<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n> = <\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string | undefined = undefined,\n TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,\n>(\n location: ToOptions<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >,\n TFrom,\n TTo\n >,\n opts?: MatchRouteOptions,\n) => false | RouteById<TRouteTree, TResolved>['types']['allParams']\n\nexport type UpdateFn<\n TRouteTree extends AnyRoute,\n TTrailingSlashOption extends TrailingSlashOption,\n TDefaultStructuralSharingOption extends boolean,\n TRouterHistory extends RouterHistory,\n TDehydrated extends Record<string, any>,\n> = (\n newOptions: RouterConstructorOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >,\n) => void\n\nexport type InvalidateFn<TRouter extends AnyRouter> = (opts?: {\n filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean\n sync?: boolean\n}) => Promise<void>\n\nexport type ParseLocationFn<TRouteTree extends AnyRoute> = (\n previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>,\n locationToParse?: HistoryLocation,\n) => ParsedLocation<FullSearchSchema<TRouteTree>>\n\nexport type GetMatchRoutesFn = (\n next: ParsedLocation,\n dest?: BuildNextOptions,\n) => {\n matchedRoutes: Array<AnyRoute>\n routeParams: Record<string, string>\n foundRoute: AnyRoute | undefined\n}\n\nexport type EmitFn = (routerEvent: RouterEvent) => void\n\nexport type LoadFn = (opts?: { sync?: boolean }) => Promise<void>\n\nexport type CommitLocationFn = ({\n viewTransition,\n ignoreBlocker,\n ...next\n}: ParsedLocation & CommitLocationOptions) => Promise<void>\n\nexport type StartTransitionFn = (fn: () => void) => void\n\nexport type SubscribeFn = <TType extends keyof RouterEvents>(\n eventType: TType,\n fn: ListenerFn<RouterEvents[TType]>,\n) => () => void\n\nexport interface MatchRoutesFn {\n (\n pathname: string,\n locationSearch: AnySchema,\n opts?: MatchRoutesOpts,\n ): Array<AnyRouteMatch>\n (next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>\n (\n pathnameOrNext: string | ParsedLocation,\n locationSearchOrOpts?: AnySchema | MatchRoutesOpts,\n opts?: MatchRoutesOpts,\n ): Array<AnyRouteMatch>\n}\n\nexport type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined\n\nexport type UpdateMatchFn = (\n id: string,\n updater: (match: AnyRouteMatch) => AnyRouteMatch,\n) => AnyRouteMatch\n\nexport type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>\n\nexport type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect\n\nexport type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {\n filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean\n}) => void\n\nexport interface ServerSrr {\n injectedHtml: Array<InjectedHtmlEntry>\n injectHtml: (getHtml: () => string | Promise<string>) => Promise<void>\n injectScript: (\n getScript: () => string | Promise<string>,\n opts?: { logScript?: boolean },\n ) => Promise<void>\n streamValue: (key: string, value: any) => void\n streamedKeys: Set<string>\n onMatchSettled: (opts: { router: AnyRouter; match: AnyRouteMatch }) => any\n}\n\nexport interface Router<\n in out TRouteTree extends AnyRoute,\n in out TTrailingSlashOption extends TrailingSlashOption,\n in out TDefaultStructuralSharingOption extends boolean,\n in out TRouterHistory extends RouterHistory = RouterHistory,\n in out TDehydrated extends Record<string, any> = Record<string, any>,\n> {\n routeTree: TRouteTree\n options: RouterOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n __store: Store<RouterState<TRouteTree>>\n navigate: NavigateFn\n history: TRouterHistory\n state: RouterState<TRouteTree>\n isServer: boolean\n clientSsr?: {\n getStreamedValue: <T>(key: string) => T | undefined\n }\n looseRoutesById: Record<string, AnyRoute>\n latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>\n isScrollRestoring: boolean\n resetNextScroll: boolean\n isScrollRestorationSetup: boolean\n ssr?: {\n manifest: Manifest | undefined\n serializer: StartSerializer\n }\n serverSsr?: ServerSrr\n basepath: string\n routesById: RoutesById<TRouteTree>\n routesByPath: RoutesByPath<TRouteTree>\n flatRoutes: Array<AnyRoute>\n parseLocation: ParseLocationFn<TRouteTree>\n getMatchedRoutes: GetMatchRoutesFn\n emit: EmitFn\n load: LoadFn\n commitLocation: CommitLocationFn\n buildLocation: BuildLocationFn\n startTransition: StartTransitionFn\n subscribe: SubscribeFn\n matchRoutes: MatchRoutesFn\n preloadRoute: PreloadRouteFn<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >\n getMatch: GetMatchFn\n updateMatch: UpdateMatchFn\n matchRoute: MatchRouteFn<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory\n >\n update: UpdateFn<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n invalidate: InvalidateFn<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n >\n loadRouteChunk: LoadRouteChunkFn\n resolveRedirect: ResolveRedirect\n buildRouteTree: () => void\n clearCache: ClearCacheFn<\n Router<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >\n >\n}\n\nexport type AnyRouterWithContext<TContext> = Router<\n AnyRouteWithContext<TContext>,\n any,\n any,\n any,\n any\n>\n\nexport type AnyRouter = Router<any, any, any, any, any>\n\nexport interface ViewTransitionOptions {\n types: Array<string>\n}\n\nexport function defaultSerializeError(err: unknown) {\n if (err instanceof Error) {\n const obj = {\n name: err.name,\n message: err.message,\n }\n\n if (process.env.NODE_ENV === 'development') {\n ;(obj as any).stack = err.stack\n }\n\n return obj\n }\n\n return {\n data: err,\n }\n}\nexport interface ExtractedBaseEntry {\n dataType: '__beforeLoadContext' | 'loaderData'\n type: string\n path: Array<string>\n id: number\n matchIndex: number\n}\n\nexport interface ExtractedStream extends ExtractedBaseEntry {\n type: 'stream'\n streamState: StreamState\n}\n\nexport interface ExtractedPromise extends ExtractedBaseEntry {\n type: 'promise'\n promiseState: DeferredPromiseState<any>\n}\n\nexport type ExtractedEntry = ExtractedStream | ExtractedPromise\n\nexport type StreamState = {\n promises: Array<ControlledPromise<string | null>>\n}\n\nexport type TrailingSlashOption = 'always' | 'never' | 'preserve'\n\nexport function getLocationChangeInfo(routerState: {\n resolvedLocation?: ParsedLocation\n location: ParsedLocation\n}) {\n const fromLocation = routerState.resolvedLocation\n const toLocation = routerState.location\n const pathChanged = fromLocation?.pathname !== toLocation.pathname\n const hrefChanged = fromLocation?.href !== toLocation.href\n const hashChanged = fromLocation?.hash !== toLocation.hash\n return { fromLocation, toLocation, pathChanged, hrefChanged, hashChanged }\n}\n"],"names":[],"mappings":"AAwtBO,SAAS,sBAAsB,KAAc;AAClD,MAAI,eAAe,OAAO;AACxB,UAAM,MAAM;AAAA,MACV,MAAM,IAAI;AAAA,MACV,SAAS,IAAI;AAAA,IACf;AAEI,QAAA,QAAQ,IAAI,aAAa,eAAe;AACxC,UAAY,QAAQ,IAAI;AAAA,IAAA;AAGrB,WAAA;AAAA,EAAA;AAGF,SAAA;AAAA,IACL,MAAM;AAAA,EACR;AACF;AA2BO,SAAS,sBAAsB,aAGnC;AACD,QAAM,eAAe,YAAY;AACjC,QAAM,aAAa,YAAY;AACzB,QAAA,eAAc,6CAAc,cAAa,WAAW;AACpD,QAAA,eAAc,6CAAc,UAAS,WAAW;AAChD,QAAA,eAAc,6CAAc,UAAS,WAAW;AACtD,SAAO,EAAE,cAAc,YAAY,aAAa,aAAa,YAAY;AAC3E;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
- "version": "1.112.8",
3
+ "version": "1.112.18",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@tanstack/store": "^0.7.0",
48
- "@tanstack/history": "1.112.8"
48
+ "@tanstack/history": "1.112.18"
49
49
  },
50
50
  "scripts": {}
51
51
  }
package/src/Matches.ts CHANGED
@@ -205,3 +205,10 @@ export type MakeRouteMatchUnion<
205
205
  TRoute['types']['loaderDeps']
206
206
  >
207
207
  : never
208
+
209
+ export interface MatchRouteOptions {
210
+ pending?: boolean
211
+ caseSensitive?: boolean
212
+ includeSearch?: boolean
213
+ fuzzy?: boolean
214
+ }
package/src/fileRoute.ts CHANGED
@@ -1,4 +1,10 @@
1
- import type { AnyRoute, RootRoute } from './route'
1
+ import type {
2
+ AnyContext,
3
+ AnyPathParams,
4
+ AnyRoute,
5
+ UpdatableRouteOptions,
6
+ } from './route'
7
+ import type { AnyValidator } from './validators'
2
8
 
3
9
  export interface FileRouteTypes {
4
10
  fileRoutesByFullPath: any
@@ -10,23 +16,36 @@ export interface FileRouteTypes {
10
16
  }
11
17
 
12
18
  export type InferFileRouteTypes<TRouteTree extends AnyRoute> =
13
- TRouteTree extends RootRoute<
14
- any,
15
- any,
16
- any,
17
- any,
18
- any,
19
- any,
20
- any,
21
- infer TFileRouteTypes extends FileRouteTypes
22
- >
23
- ? unknown extends TFileRouteTypes
24
- ? never
25
- : TFileRouteTypes
26
- : never
19
+ unknown extends TRouteTree['types']['fileRouteTypes']
20
+ ? never
21
+ : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes
22
+ ? TRouteTree['types']['fileRouteTypes']
23
+ : never
27
24
 
28
25
  export interface FileRoutesByPath {
29
26
  // '/': {
30
27
  // parentRoute: typeof rootRoute
31
28
  // }
32
29
  }
30
+
31
+ export type LazyRouteOptions = Pick<
32
+ UpdatableRouteOptions<
33
+ AnyRoute,
34
+ string,
35
+ string,
36
+ AnyPathParams,
37
+ AnyValidator,
38
+ {},
39
+ AnyContext,
40
+ AnyContext,
41
+ AnyContext,
42
+ AnyContext
43
+ >,
44
+ 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'
45
+ >
46
+
47
+ export interface LazyRoute {
48
+ options: {
49
+ id: string
50
+ } & LazyRouteOptions
51
+ }
package/src/index.ts CHANGED
@@ -60,6 +60,8 @@ export type {
60
60
  InferFileRouteTypes,
61
61
  FileRouteTypes,
62
62
  FileRoutesByPath,
63
+ LazyRoute,
64
+ LazyRouteOptions,
63
65
  } from './fileRoute'
64
66
 
65
67
  export type {
@@ -91,6 +93,7 @@ export type {
91
93
  MakeRouteMatch,
92
94
  AnyRouteMatch,
93
95
  MakeRouteMatchFromRoute,
96
+ MatchRouteOptions,
94
97
  } from './Matches'
95
98
  export {
96
99
  joinPaths,
@@ -166,7 +169,6 @@ export type {
166
169
  ResolveAllParamsFromParent,
167
170
  AnyRoute,
168
171
  Route,
169
- RootRoute,
170
172
  RouteTypes,
171
173
  FullSearchSchemaOption,
172
174
  RemountDepsOptions,
@@ -186,6 +188,14 @@ export type {
186
188
  ContextOptions,
187
189
  RootRouteOptions,
188
190
  UpdatableRouteOptionsExtensions,
191
+ RouteConstraints,
192
+ RouteTypesById,
193
+ RouteMask,
194
+ RouteExtensions,
195
+ RouteLazyFn,
196
+ RouteAddChildrenFn,
197
+ RouteAddFileChildrenFn,
198
+ RouteAddFileTypesFn,
189
199
  } from './route'
190
200
 
191
201
  export { defaultSerializeError, getLocationChangeInfo } from './router'
@@ -201,6 +211,40 @@ export type {
201
211
  AnyRouter,
202
212
  AnyRouterWithContext,
203
213
  RegisteredRouter,
214
+ RouterState,
215
+ BuildNextOptions,
216
+ RouterListener,
217
+ RouterEvent,
218
+ ListenerFn,
219
+ RouterEvents,
220
+ MatchRoutesOpts,
221
+ RouterOptionsExtensions,
222
+ Router,
223
+ DefaultRemountDepsFn,
224
+ PreloadRouteFn,
225
+ MatchRouteFn,
226
+ RouterContextOptions,
227
+ RouterOptions,
228
+ RouterConstructorOptions,
229
+ UpdateFn,
230
+ ParseLocationFn,
231
+ InvalidateFn,
232
+ ControllablePromise,
233
+ InjectedHtmlEntry,
234
+ RouterErrorSerializer,
235
+ MatchedRoutesResult,
236
+ EmitFn,
237
+ LoadFn,
238
+ GetMatchFn,
239
+ SubscribeFn,
240
+ UpdateMatchFn,
241
+ CommitLocationFn,
242
+ GetMatchRoutesFn,
243
+ MatchRoutesFn,
244
+ StartTransitionFn,
245
+ LoadRouteChunkFn,
246
+ ServerSrr,
247
+ ClearCacheFn,
204
248
  } from './router'
205
249
 
206
250
  export type {
package/src/route.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { LazyRoute } from './fileRoute'
1
2
  import type { NavigateOptions, ParsePathParams } from './link'
2
3
  import type { ParsedLocation } from './location'
3
4
  import type {
@@ -7,7 +8,7 @@ import type {
7
8
  RouteMatch,
8
9
  } from './Matches'
9
10
  import type { RootRouteId } from './root'
10
- import type { ParseRoute } from './routeInfo'
11
+ import type { ParseRoute, RouteById, RoutePaths } from './routeInfo'
11
12
  import type { AnyRouter, RegisteredRouter } from './router'
12
13
  import type { BuildLocationFn, NavigateFn } from './RouterProvider'
13
14
  import type {
@@ -371,15 +372,17 @@ export interface RemountDepsOptions<
371
372
 
372
373
  export type MakeRemountDepsOptionsUnion<
373
374
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
374
- TRoute extends AnyRoute = ParseRoute<TRouteTree>,
375
- > = TRoute extends any
376
- ? RemountDepsOptions<
377
- TRoute['id'],
378
- TRoute['types']['fullSearchSchema'],
379
- TRoute['types']['allParams'],
380
- TRoute['types']['loaderDeps']
381
- >
382
- : never
375
+ > =
376
+ ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute
377
+ ? TRoute extends any
378
+ ? RemountDepsOptions<
379
+ TRoute['id'],
380
+ TRoute['types']['fullSearchSchema'],
381
+ TRoute['types']['allParams'],
382
+ TRoute['types']['loaderDeps']
383
+ >
384
+ : never
385
+ : never
383
386
 
384
387
  export interface RouteTypes<
385
388
  in out TParentRoute extends AnyRoute,
@@ -435,6 +438,112 @@ export type ResolveFullPath<
435
438
  TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,
436
439
  > = TPrefixed extends RootRouteId ? '/' : TPrefixed
437
440
 
441
+ export interface RouteExtensions<TId, TFullPath> {}
442
+
443
+ export type RouteLazyFn<TRoute extends AnyRoute> = (
444
+ lazyFn: () => Promise<LazyRoute>,
445
+ ) => TRoute
446
+
447
+ export type RouteAddChildrenFn<
448
+ in out TParentRoute extends AnyRoute,
449
+ in out TPath extends string,
450
+ in out TFullPath extends string,
451
+ in out TCustomId extends string,
452
+ in out TId extends string,
453
+ in out TSearchValidator,
454
+ in out TParams,
455
+ in out TRouterContext,
456
+ in out TRouteContextFn,
457
+ in out TBeforeLoadFn,
458
+ in out TLoaderDeps extends Record<string, any>,
459
+ in out TLoaderFn,
460
+ in out TFileRouteTypes,
461
+ > = <const TNewChildren>(
462
+ children: Constrain<
463
+ TNewChildren,
464
+ ReadonlyArray<AnyRoute> | Record<string, AnyRoute>
465
+ >,
466
+ ) => Route<
467
+ TParentRoute,
468
+ TPath,
469
+ TFullPath,
470
+ TCustomId,
471
+ TId,
472
+ TSearchValidator,
473
+ TParams,
474
+ TRouterContext,
475
+ TRouteContextFn,
476
+ TBeforeLoadFn,
477
+ TLoaderDeps,
478
+ TLoaderFn,
479
+ TNewChildren,
480
+ TFileRouteTypes
481
+ >
482
+
483
+ export type RouteAddFileChildrenFn<
484
+ in out TParentRoute extends AnyRoute,
485
+ in out TPath extends string,
486
+ in out TFullPath extends string,
487
+ in out TCustomId extends string,
488
+ in out TId extends string,
489
+ in out TSearchValidator,
490
+ in out TParams,
491
+ in out TRouterContext,
492
+ in out TRouteContextFn,
493
+ in out TBeforeLoadFn,
494
+ in out TLoaderDeps extends Record<string, any>,
495
+ in out TLoaderFn,
496
+ in out TFileRouteTypes,
497
+ > = <const TNewChildren>(
498
+ children: TNewChildren,
499
+ ) => Route<
500
+ TParentRoute,
501
+ TPath,
502
+ TFullPath,
503
+ TCustomId,
504
+ TId,
505
+ TSearchValidator,
506
+ TParams,
507
+ TRouterContext,
508
+ TRouteContextFn,
509
+ TBeforeLoadFn,
510
+ TLoaderDeps,
511
+ TLoaderFn,
512
+ TNewChildren,
513
+ TFileRouteTypes
514
+ >
515
+
516
+ export type RouteAddFileTypesFn<
517
+ TParentRoute extends AnyRoute,
518
+ TPath extends string,
519
+ TFullPath extends string,
520
+ TCustomId extends string,
521
+ TId extends string,
522
+ TSearchValidator,
523
+ TParams,
524
+ TRouterContext,
525
+ TRouteContextFn,
526
+ TBeforeLoadFn,
527
+ TLoaderDeps extends Record<string, any>,
528
+ TLoaderFn,
529
+ TChildren,
530
+ > = <TNewFileRouteTypes>() => Route<
531
+ TParentRoute,
532
+ TPath,
533
+ TFullPath,
534
+ TCustomId,
535
+ TId,
536
+ TSearchValidator,
537
+ TParams,
538
+ TRouterContext,
539
+ TRouteContextFn,
540
+ TBeforeLoadFn,
541
+ TLoaderDeps,
542
+ TLoaderFn,
543
+ TChildren,
544
+ TNewFileRouteTypes
545
+ >
546
+
438
547
  export interface Route<
439
548
  in out TParentRoute extends AnyRoute,
440
549
  in out TPath extends string,
@@ -446,14 +555,16 @@ export interface Route<
446
555
  in out TRouterContext,
447
556
  in out TRouteContextFn,
448
557
  in out TBeforeLoadFn,
449
- in out TLoaderDeps,
558
+ in out TLoaderDeps extends Record<string, any>,
450
559
  in out TLoaderFn,
451
560
  in out TChildren,
452
561
  in out TFileRouteTypes,
453
- > {
562
+ > extends RouteExtensions<TId, TFullPath> {
454
563
  fullPath: TFullPath
455
564
  path: TPath
456
565
  id: TId
566
+ parentRoute: TParentRoute
567
+ children?: TChildren
457
568
  types: RouteTypes<
458
569
  TParentRoute,
459
570
  TPath,
@@ -470,6 +581,87 @@ export interface Route<
470
581
  TChildren,
471
582
  TFileRouteTypes
472
583
  >
584
+ options: RouteOptions<
585
+ TParentRoute,
586
+ TId,
587
+ TCustomId,
588
+ TFullPath,
589
+ TPath,
590
+ TSearchValidator,
591
+ TParams,
592
+ TLoaderDeps,
593
+ TLoaderFn,
594
+ TRouterContext,
595
+ TRouteContextFn,
596
+ TBeforeLoadFn
597
+ >
598
+ isRoot: TParentRoute extends AnyRoute ? true : false
599
+ _componentsPromise?: Promise<Array<void>>
600
+ lazyFn?: () => Promise<LazyRoute>
601
+ _lazyPromise?: Promise<void>
602
+ rank: number
603
+ to: TrimPathRight<TFullPath>
604
+ init: (opts: { originalIndex: number; defaultSsr?: boolean }) => void
605
+ update: (
606
+ options: UpdatableRouteOptions<
607
+ TParentRoute,
608
+ TCustomId,
609
+ TFullPath,
610
+ TParams,
611
+ TSearchValidator,
612
+ TLoaderFn,
613
+ TLoaderDeps,
614
+ TRouterContext,
615
+ TRouteContextFn,
616
+ TBeforeLoadFn
617
+ >,
618
+ ) => this
619
+ lazy: RouteLazyFn<this>
620
+ addChildren: RouteAddChildrenFn<
621
+ TParentRoute,
622
+ TPath,
623
+ TFullPath,
624
+ TCustomId,
625
+ TId,
626
+ TSearchValidator,
627
+ TParams,
628
+ TRouterContext,
629
+ TRouteContextFn,
630
+ TBeforeLoadFn,
631
+ TLoaderDeps,
632
+ TLoaderFn,
633
+ TFileRouteTypes
634
+ >
635
+ _addFileChildren: RouteAddFileChildrenFn<
636
+ TParentRoute,
637
+ TPath,
638
+ TFullPath,
639
+ TCustomId,
640
+ TId,
641
+ TSearchValidator,
642
+ TParams,
643
+ TRouterContext,
644
+ TRouteContextFn,
645
+ TBeforeLoadFn,
646
+ TLoaderDeps,
647
+ TLoaderFn,
648
+ TFileRouteTypes
649
+ >
650
+ _addFileTypes: RouteAddFileTypesFn<
651
+ TParentRoute,
652
+ TPath,
653
+ TFullPath,
654
+ TCustomId,
655
+ TId,
656
+ TSearchValidator,
657
+ TParams,
658
+ TRouterContext,
659
+ TRouteContextFn,
660
+ TBeforeLoadFn,
661
+ TLoaderDeps,
662
+ TLoaderFn,
663
+ TChildren
664
+ >
473
665
  }
474
666
 
475
667
  export type AnyRoute = Route<
@@ -489,32 +681,6 @@ export type AnyRoute = Route<
489
681
  any
490
682
  >
491
683
 
492
- export interface RootRoute<
493
- in out TSearchValidator,
494
- in out TRouterContext,
495
- in out TRouteContextFn,
496
- in out TBeforeLoadFn,
497
- in out TLoaderDeps extends Record<string, any>,
498
- in out TLoaderFn,
499
- in out TChildren,
500
- in out TFileRouteTypes,
501
- > extends Route<
502
- any, // TParentRoute
503
- '/', // TPath
504
- '/', // TFullPath
505
- string, // TCustomId
506
- RootRouteId, // TId
507
- TSearchValidator, // TSearchValidator
508
- {}, // TParams
509
- TRouterContext,
510
- TRouteContextFn,
511
- TBeforeLoadFn,
512
- TLoaderDeps,
513
- TLoaderFn,
514
- TChildren, // TChildren
515
- TFileRouteTypes
516
- > {}
517
-
518
684
  export type AnyRouteWithContext<TContext> = AnyRoute & {
519
685
  types: { allContext: TContext }
520
686
  }
@@ -799,7 +965,8 @@ export interface DefaultUpdatableRouteOptionsExtensions {
799
965
  pendingComponent?: unknown
800
966
  }
801
967
 
802
- export interface UpdatableRouteOptionsExtensions {}
968
+ export interface UpdatableRouteOptionsExtensions
969
+ extends DefaultUpdatableRouteOptionsExtensions {}
803
970
 
804
971
  export interface UpdatableRouteOptions<
805
972
  in out TParentRoute extends AnyRoute,
@@ -1030,6 +1197,40 @@ export type RootRouteOptions<
1030
1197
  | 'params'
1031
1198
  >
1032
1199
 
1200
+ export type RouteConstraints = {
1201
+ TParentRoute: AnyRoute
1202
+ TPath: string
1203
+ TFullPath: string
1204
+ TCustomId: string
1205
+ TId: string
1206
+ TSearchSchema: AnySchema
1207
+ TFullSearchSchema: AnySchema
1208
+ TParams: Record<string, any>
1209
+ TAllParams: Record<string, any>
1210
+ TParentContext: AnyContext
1211
+ TRouteContext: RouteContext
1212
+ TAllContext: AnyContext
1213
+ TRouterContext: AnyContext
1214
+ TChildren: unknown
1215
+ TRouteTree: AnyRoute
1216
+ }
1217
+
1218
+ export type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<
1219
+ TRouter['routeTree'],
1220
+ TId
1221
+ >['types']
1222
+
1223
+ export type RouteMask<TRouteTree extends AnyRoute> = {
1224
+ routeTree: TRouteTree
1225
+ from: RoutePaths<TRouteTree>
1226
+ to?: any
1227
+ params?: any
1228
+ search?: any
1229
+ hash?: any
1230
+ state?: any
1231
+ unmaskOnReload?: boolean
1232
+ }
1233
+
1033
1234
  /**
1034
1235
  * @deprecated Use `ErrorComponentProps` instead.
1035
1236
  */