@tanstack/react-router 1.30.1 → 1.31.0

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.
Files changed (56) hide show
  1. package/dist/cjs/Matches.cjs.map +1 -1
  2. package/dist/cjs/Matches.d.cts +9 -9
  3. package/dist/cjs/RouterProvider.cjs.map +1 -1
  4. package/dist/cjs/RouterProvider.d.cts +7 -7
  5. package/dist/cjs/fileRoute.d.cts +1 -1
  6. package/dist/cjs/link.cjs.map +1 -1
  7. package/dist/cjs/link.d.cts +42 -42
  8. package/dist/cjs/redirects.cjs.map +1 -1
  9. package/dist/cjs/redirects.d.cts +5 -6
  10. package/dist/cjs/route.cjs.map +1 -1
  11. package/dist/cjs/route.d.cts +6 -6
  12. package/dist/cjs/routeInfo.d.cts +19 -2
  13. package/dist/cjs/router.cjs.map +1 -1
  14. package/dist/cjs/router.d.cts +13 -12
  15. package/dist/cjs/routerContext.cjs.map +1 -1
  16. package/dist/cjs/routerContext.d.cts +1 -1
  17. package/dist/cjs/useNavigate.cjs.map +1 -1
  18. package/dist/cjs/useNavigate.d.cts +3 -4
  19. package/dist/cjs/useRouter.cjs.map +1 -1
  20. package/dist/cjs/useRouter.d.cts +3 -4
  21. package/dist/cjs/useRouterState.cjs.map +1 -1
  22. package/dist/cjs/useRouterState.d.cts +3 -4
  23. package/dist/esm/Matches.d.ts +9 -9
  24. package/dist/esm/Matches.js.map +1 -1
  25. package/dist/esm/RouterProvider.d.ts +7 -7
  26. package/dist/esm/RouterProvider.js.map +1 -1
  27. package/dist/esm/fileRoute.d.ts +1 -1
  28. package/dist/esm/link.d.ts +42 -42
  29. package/dist/esm/link.js.map +1 -1
  30. package/dist/esm/redirects.d.ts +5 -6
  31. package/dist/esm/redirects.js.map +1 -1
  32. package/dist/esm/route.d.ts +6 -6
  33. package/dist/esm/route.js.map +1 -1
  34. package/dist/esm/routeInfo.d.ts +19 -2
  35. package/dist/esm/router.d.ts +13 -12
  36. package/dist/esm/router.js.map +1 -1
  37. package/dist/esm/routerContext.d.ts +1 -1
  38. package/dist/esm/routerContext.js.map +1 -1
  39. package/dist/esm/useNavigate.d.ts +3 -4
  40. package/dist/esm/useNavigate.js.map +1 -1
  41. package/dist/esm/useRouter.d.ts +3 -4
  42. package/dist/esm/useRouter.js.map +1 -1
  43. package/dist/esm/useRouterState.d.ts +3 -4
  44. package/dist/esm/useRouterState.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/Matches.tsx +39 -21
  47. package/src/RouterProvider.tsx +34 -11
  48. package/src/link.tsx +124 -139
  49. package/src/redirects.ts +14 -14
  50. package/src/route.ts +3 -3
  51. package/src/routeInfo.ts +72 -4
  52. package/src/router.ts +52 -11
  53. package/src/routerContext.tsx +1 -1
  54. package/src/useNavigate.tsx +9 -10
  55. package/src/useRouter.tsx +4 -5
  56. package/src/useRouterState.tsx +5 -6
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import type { ParsedLocation } from '.';
2
+ import type { AnyRouter, ParsedLocation } from '.';
3
3
  import type { HistoryState } from '@tanstack/history';
4
4
  import type { Trim } from './fileRoute.cjs';
5
5
  import type { AnyRoute, RootSearchSchema } from './route.cjs';
6
- import type { RouteByPath, RouteLeaves, RoutePaths, RoutePathsAutoComplete } from './routeInfo.cjs';
6
+ import type { RouteByPath, RouteByToPath, RoutePaths, RoutePathsAutoComplete, RouteToPath } from './routeInfo.cjs';
7
7
  import type { RegisteredRouter } from './router.cjs';
8
8
  import type { Expand, MakeDifferenceOptional, NoInfer, NonNullableUpdater, PickRequired, Updater, WithoutEmpty } from './utils.cjs';
9
9
  export type CleanPath<T extends string> = T extends `${infer L}//${infer R}` ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`> : T extends `${infer L}//` ? `${CleanPath<L>}/` : T extends `//${infer L}` ? `/${CleanPath<L>}` : T;
@@ -16,83 +16,83 @@ export type Join<T, TDelimiter extends string = '/'> = T extends [] ? '' : T ext
16
16
  ...infer Tail extends [...Array<string>]
17
17
  ] ? CleanPath<`${L}${TDelimiter}${Join<Tail>}`> : never;
18
18
  export type Last<T extends Array<any>> = T extends [...infer _, infer L] ? L : never;
19
- export type RemoveTrailingSlashes<T> = T extends `${infer R}/` ? RemoveTrailingSlashes<R> : T;
20
- export type RemoveLeadingSlashes<T> = T extends `/${infer R}` ? RemoveLeadingSlashes<R> : T;
21
- export type ResolvePaths<TRouteTree extends AnyRoute, TSearchPath> = RouteByPath<TRouteTree, RemoveTrailingSlashes<TSearchPath>> extends never ? RouteLeaves<TRouteTree> : RouteLeaves<RouteByPath<TRouteTree, RemoveTrailingSlashes<TSearchPath>>>;
22
- export type SearchPaths<TRouteTree extends AnyRoute, TSearchPath extends string, TPaths = ResolvePaths<TRouteTree, TSearchPath>> = TPaths extends `${RemoveTrailingSlashes<TSearchPath>}/${infer TRest}` ? TRest : never;
23
- export type SearchRelativePathAutoComplete<TRouteTree extends AnyRoute, TTo extends string, TSearchPath extends string> = `${TTo}/${SearchPaths<TRouteTree, TSearchPath>}`;
24
- export type RelativeToParentPathAutoComplete<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string, TResolvedPath extends string = RemoveTrailingSlashes<ResolveRelativePath<TFrom, TTo>>> = SearchRelativePathAutoComplete<TRouteTree, TTo, TResolvedPath> | (TResolvedPath extends '' ? never : `${TTo}/../`);
25
- export type RelativeToCurrentPathAutoComplete<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string, TRestTo extends string, TResolvedPath extends string = RemoveTrailingSlashes<`${RemoveTrailingSlashes<TFrom>}/${RemoveLeadingSlashes<TRestTo>}`>> = SearchRelativePathAutoComplete<TRouteTree, TTo, TResolvedPath>;
26
- export type AbsolutePathAutoComplete<TRouteTree extends AnyRoute, TFrom extends string> = (string extends TFrom ? './' : TFrom extends `/` ? never : SearchPaths<TRouteTree, TFrom> extends '' ? never : './') | (string extends TFrom ? '../' : TFrom extends `/` ? never : '../') | RouteLeaves<TRouteTree> | (TFrom extends '/' ? never : SearchPaths<TRouteTree, TFrom>);
27
- export type RelativeToPathAutoComplete<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string> = TTo extends `..${string}` ? RelativeToParentPathAutoComplete<TRouteTree, TFrom, RemoveTrailingSlashes<TTo>> : TTo extends `./${infer TRestTTo}` ? RelativeToCurrentPathAutoComplete<TRouteTree, TFrom, RemoveTrailingSlashes<TTo>, TRestTTo> : AbsolutePathAutoComplete<TRouteTree, TFrom>;
28
- export type NavigateOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''> = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
19
+ export type RemoveTrailingSlashes<T> = T extends `${infer R}/` ? R : T;
20
+ export type RemoveLeadingSlashes<T> = T extends `/${infer R}` ? R : T;
21
+ export type ResolvePaths<TRouter extends AnyRouter, TSearchPath> = RouteByPath<TRouter['routeTree'], RemoveTrailingSlashes<TSearchPath>> extends never ? RouteToPath<TRouter, TRouter['routeTree']> : RouteToPath<TRouter, RouteByPath<TRouter['routeTree'], RemoveTrailingSlashes<TSearchPath>>>;
22
+ export type SearchPaths<TRouter extends AnyRouter, TSearchPath extends string, TPaths = ResolvePaths<TRouter, TSearchPath>> = TPaths extends `${RemoveTrailingSlashes<TSearchPath>}${infer TRest}` ? TRest : never;
23
+ export type SearchRelativePathAutoComplete<TRouter extends AnyRouter, TTo extends string, TSearchPath extends string> = `${TTo}/${RemoveLeadingSlashes<SearchPaths<TRouter, TSearchPath>>}`;
24
+ export type RelativeToParentPathAutoComplete<TRouter extends AnyRouter, TFrom extends string, TTo extends string, TResolvedPath extends string = RemoveTrailingSlashes<ResolveRelativePath<TFrom, TTo>>> = SearchRelativePathAutoComplete<TRouter, TTo, TResolvedPath> | (TResolvedPath extends '' ? never : `${TTo}/../`);
25
+ export type RelativeToCurrentPathAutoComplete<TRouter extends AnyRouter, TFrom extends string, TTo extends string, TRestTo extends string, TResolvedPath extends string = RemoveTrailingSlashes<`${RemoveTrailingSlashes<TFrom>}/${RemoveLeadingSlashes<TRestTo>}`>> = SearchRelativePathAutoComplete<TRouter, TTo, TResolvedPath>;
26
+ export type AbsolutePathAutoComplete<TRouter extends AnyRouter, TFrom extends string> = (string extends TFrom ? './' : TFrom extends `/` ? never : SearchPaths<TRouter, TFrom> extends '' ? never : './') | (string extends TFrom ? '../' : TFrom extends `/` ? never : '../') | RouteToPath<TRouter, TRouter['routeTree']> | (TFrom extends '/' ? never : string extends TFrom ? RemoveLeadingSlashes<RouteToPath<TRouter, TRouter['routeTree']>> : RemoveLeadingSlashes<SearchPaths<TRouter, TFrom>>);
27
+ export type RelativeToPathAutoComplete<TRouter extends AnyRouter, TFrom extends string, TTo extends string> = TTo extends `..${string}` ? RelativeToParentPathAutoComplete<TRouter, TFrom, RemoveTrailingSlashes<TTo>> : TTo extends `./${infer TRestTTo}` ? RelativeToCurrentPathAutoComplete<TRouter, TFrom, RemoveTrailingSlashes<TTo>, TRestTTo> : AbsolutePathAutoComplete<TRouter, TFrom>;
28
+ export type NavigateOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''> = ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
29
29
  replace?: boolean;
30
30
  resetScroll?: boolean;
31
31
  /** @deprecated All navigations now use startTransition under the hood */
32
32
  startTransition?: boolean;
33
33
  viewTransition?: boolean;
34
34
  };
35
- export type ToOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''> = ToSubOptions<TRouteTree, TFrom, TTo> & {
35
+ export type ToOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''> = ToSubOptions<TRouter, TFrom, TTo> & {
36
36
  _fromLocation?: ParsedLocation;
37
- mask?: ToMaskOptions<TRouteTree, TMaskFrom, TMaskTo>;
37
+ mask?: ToMaskOptions<TRouter, TMaskFrom, TMaskTo>;
38
38
  };
39
- export type ToMaskOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TMaskFrom extends RoutePaths<TRouteTree> | string = string, TMaskTo extends string = ''> = ToSubOptions<TRouteTree, TMaskFrom, TMaskTo> & {
39
+ export type ToMaskOptions<TRouteTree extends AnyRouter = RegisteredRouter, TMaskFrom extends RoutePaths<TRouteTree['routeTree']> | string = string, TMaskTo extends string = ''> = ToSubOptions<TRouteTree, TMaskFrom, TMaskTo> & {
40
40
  unmaskOnReload?: boolean;
41
41
  };
42
- export type ToSubOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = ''> = {
43
- to?: ToPathOption<TRouteTree, TFrom, TTo> & {};
42
+ export type ToSubOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = ''> = {
43
+ to?: ToPathOption<TRouter, TFrom, TTo> & {};
44
44
  hash?: true | Updater<string>;
45
45
  state?: true | NonNullableUpdater<HistoryState>;
46
- from?: RoutePathsAutoComplete<TRouteTree, TFrom> & {};
47
- } & SearchParamOptions<TRouteTree, TFrom, TTo> & PathParamOptions<TRouteTree, TFrom, TTo>;
46
+ from?: RoutePathsAutoComplete<TRouter['routeTree'], TFrom> & {};
47
+ } & SearchParamOptions<TRouter, TFrom, TTo> & PathParamOptions<TRouter, TFrom, TTo>;
48
48
  type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
49
49
  type ParamVariant = 'PATH' | 'SEARCH';
50
50
  type ExcludeRootSearchSchema<T, TExcluded = Exclude<T, RootSearchSchema>> = [
51
51
  TExcluded
52
52
  ] extends [never] ? {} : TExcluded;
53
- export type ResolveRoute<TRouteTree extends AnyRoute, TFrom, TTo, TPath = RemoveTrailingSlashes<string extends TFrom ? TTo : string extends TTo ? TFrom : ResolveRelativePath<TFrom, TTo>>> = TPath extends string ? RouteByPath<TRouteTree, `${TPath}/`> extends never ? RouteByPath<TRouteTree, TPath> : RouteByPath<TRouteTree, `${TPath}/`> : never;
53
+ export type ResolveRoute<TRouter extends AnyRouter, TFrom, TTo, TPath = string extends TFrom ? TTo : string extends TTo ? TFrom : ResolveRelativePath<TFrom, TTo>> = TPath extends string ? string extends TTo ? RouteByPath<TRouter['routeTree'], TPath> : RouteByToPath<TRouter, TPath> : never;
54
54
  type PostProcessParams<T, TParamVariant extends ParamVariant> = TParamVariant extends 'SEARCH' ? ExcludeRootSearchSchema<T> : T;
55
- type ResolveFromParams<TRouteTree extends AnyRoute, TParamVariant extends ParamVariant, TFrom, TFromRouteType extends 'allParams' | 'fullSearchSchema' = TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchema'> = PostProcessParams<RouteByPath<TRouteTree, TFrom>['types'][TFromRouteType], TParamVariant>;
56
- type ResolveToParams<TRouteTree extends AnyRoute, TParamVariant extends ParamVariant, TFrom, TTo, TRoute extends AnyRoute = ResolveRoute<TRouteTree, TFrom, TTo>> = PostProcessParams<TRoute['types'][TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchemaInput'], TParamVariant>;
57
- type ResolveRelativeToParams<TRouteTree extends AnyRoute, TParamVariant extends ParamVariant, TFrom, TTo, TToParams = ResolveToParams<TRouteTree, TParamVariant, TFrom, TTo>> = TParamVariant extends 'SEARCH' ? TToParams : string extends TFrom ? TToParams : MakeDifferenceOptional<ResolveFromParams<TRouteTree, TParamVariant, TFrom>, TToParams>;
58
- type MakeOptionalParams<TRouteTree extends AnyRoute, TParamVariant extends ParamVariant, TFrom, TTo> = TParamVariant extends 'SEARCH' ? {
59
- search?: true | (ParamsReducer<Expand<ResolveFromParams<TRouteTree, TParamVariant, TFrom>>, Expand<ResolveRelativeToParams<TRouteTree, TParamVariant, TFrom, TTo>>> & {});
55
+ type ResolveFromParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom> = PostProcessParams<RouteByPath<TRouter['routeTree'], TFrom>['types'][TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchema'], TParamVariant>;
56
+ type ResolveToParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo, TRoute extends AnyRoute = ResolveRoute<TRouter, TFrom, TTo>> = PostProcessParams<TRoute['types'][TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchemaInput'], TParamVariant>;
57
+ type ResolveRelativeToParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo, TToParams = ResolveToParams<TRouter, TParamVariant, TFrom, TTo>> = TParamVariant extends 'SEARCH' ? TToParams : string extends TFrom ? TToParams : MakeDifferenceOptional<ResolveFromParams<TRouter, TParamVariant, TFrom>, TToParams>;
58
+ type MakeOptionalParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo> = TParamVariant extends 'SEARCH' ? {
59
+ search?: true | (ParamsReducer<Expand<ResolveFromParams<TRouter, TParamVariant, TFrom>>, Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>> & {});
60
60
  } : {
61
- params?: true | (ParamsReducer<Expand<ResolveFromParams<TRouteTree, TParamVariant, TFrom>>, Expand<ResolveRelativeToParams<TRouteTree, TParamVariant, TFrom, TTo>>> & {});
61
+ params?: true | (ParamsReducer<Expand<ResolveFromParams<TRouter, TParamVariant, TFrom>>, Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>> & {});
62
62
  };
63
- type MakeRequiredParamsReducer<TRouteTree extends AnyRoute, TParamVariant extends ParamVariant, TFrom, TToParams, TFromParams = ResolveFromParams<TRouteTree, TParamVariant, TFrom>> = ([TFromParams] extends [WithoutEmpty<PickRequired<TToParams>>] ? true : never) | ParamsReducer<Expand<TFromParams>, TToParams>;
64
- export type MakeRequiredParams<TRouteTree extends AnyRoute, TParamVariant extends ParamVariant, TFrom, TTo> = TParamVariant extends 'SEARCH' ? {
65
- search: Expand<MakeRequiredParamsReducer<TRouteTree, TParamVariant, TFrom, Expand<ResolveRelativeToParams<TRouteTree, TParamVariant, TFrom, TTo>>>> & {};
63
+ type MakeRequiredParamsReducer<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TToParams, TFromParams = ResolveFromParams<TRouter, TParamVariant, TFrom>> = ([TFromParams] extends [WithoutEmpty<PickRequired<TToParams>>] ? true : never) | ParamsReducer<Expand<TFromParams>, TToParams>;
64
+ export type MakeRequiredParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo> = TParamVariant extends 'SEARCH' ? {
65
+ search: Expand<MakeRequiredParamsReducer<TRouter, TParamVariant, TFrom, Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>>> & {};
66
66
  } : {
67
- params: Expand<MakeRequiredParamsReducer<TRouteTree, TParamVariant, TFrom, Expand<ResolveRelativeToParams<TRouteTree, TParamVariant, TFrom, TTo>>>> & {};
67
+ params: Expand<MakeRequiredParamsReducer<TRouter, TParamVariant, TFrom, Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>>> & {};
68
68
  };
69
69
  export type IsRequiredParams<TParams> = keyof TParams extends infer K extends keyof TParams ? K extends any ? undefined extends TParams[K] ? never : true : never : never;
70
- export type IsRequired<TRouteTree extends AnyRoute, TParamVariant extends ParamVariant, TFrom, TTo> = string extends TTo ? string extends TFrom ? never : IsRequiredParams<ResolveRelativeToParams<TRouteTree, TParamVariant, TFrom, TTo>> : IsRequiredParams<ResolveRelativeToParams<TRouteTree, TParamVariant, TFrom, TTo>>;
71
- export type ParamOptions<TRouteTree extends AnyRoute, TFrom, TTo extends string, TParamVariant extends ParamVariant> = IsRequired<TRouteTree, TParamVariant, TFrom, TTo> extends never ? MakeOptionalParams<TRouteTree, TParamVariant, TFrom, TTo> : MakeRequiredParams<TRouteTree, TParamVariant, TFrom, TTo>;
72
- export type SearchParamOptions<TRouteTree extends AnyRoute, TFrom, TTo extends string> = ParamOptions<TRouteTree, TFrom, TTo, 'SEARCH'>;
73
- export type PathParamOptions<TRouteTree extends AnyRoute, TFrom, TTo extends string> = ParamOptions<TRouteTree, TFrom, TTo, 'PATH'>;
74
- export type ToPathOption<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = string> = CheckPath<TRouteTree, TTo, never, TFrom, TTo> | RelativeToPathAutoComplete<TRouteTree, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
70
+ export type IsRequired<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo> = string extends TTo ? string extends TFrom ? never : IsRequiredParams<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>> : IsRequiredParams<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>;
71
+ export type ParamOptions<TRouter extends AnyRouter, TFrom, TTo extends string, TParamVariant extends ParamVariant> = IsRequired<TRouter, TParamVariant, TFrom, TTo> extends never ? MakeOptionalParams<TRouter, TParamVariant, TFrom, TTo> : MakeRequiredParams<TRouter, TParamVariant, TFrom, TTo>;
72
+ export type SearchParamOptions<TRouter extends AnyRouter, TFrom, TTo extends string> = ParamOptions<TRouter, TFrom, TTo, 'SEARCH'>;
73
+ export type PathParamOptions<TRouter extends AnyRouter, TFrom, TTo extends string> = ParamOptions<TRouter, TFrom, TTo, 'PATH'>;
74
+ export type ToPathOption<TRouter extends AnyRouter = AnyRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = string> = CheckPath<TRouter, TTo, never, TFrom, TTo> | RelativeToPathAutoComplete<TRouter, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
75
75
  export interface ActiveOptions {
76
76
  exact?: boolean;
77
77
  includeHash?: boolean;
78
78
  includeSearch?: boolean;
79
79
  }
80
- export type LinkOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''> = NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
80
+ export type LinkOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''> = NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
81
81
  target?: HTMLAnchorElement['target'];
82
82
  activeOptions?: ActiveOptions;
83
83
  preload?: false | 'intent';
84
84
  preloadDelay?: number;
85
85
  disabled?: boolean;
86
86
  };
87
- export type CheckPath<TRouteTree extends AnyRoute, TPass, TFail, TFrom, TTo> = ResolveRoute<TRouteTree, TFrom, TTo> extends infer TRoute extends AnyRoute ? [TRoute] extends [never] ? TFail : string extends TTo ? TPass : unknown extends TRoute['children'] ? TPass : TFail : TFail;
87
+ export type CheckPath<TRouter extends AnyRouter, TPass, TFail, TFrom, TTo> = ResolveRoute<TRouter, TFrom, TTo> extends never ? TFail : TPass;
88
88
  export type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string ? TTo extends string ? TTo extends '.' ? TFrom : TTo extends `./` ? Join<[TFrom, '/']> : TTo extends `./${infer TRest}` ? ResolveRelativePath<TFrom, TRest> : TTo extends `/${infer TRest}` ? TTo : Split<TTo> extends ['..', ...infer ToRest] ? Split<TFrom> extends [...infer FromRest, infer FromTail] ? ToRest extends ['/'] ? Join<['/', ...FromRest, '/']> : ResolveRelativePath<Join<FromRest>, Join<ToRest>> : never : Split<TTo> extends ['.', ...infer ToRest] ? ToRest extends ['/'] ? Join<[TFrom, '/']> : ResolveRelativePath<TFrom, Join<ToRest>> : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>> : never : never;
89
- export declare function useLinkProps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''>(options: UseLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): React.AnchorHTMLAttributes<HTMLAnchorElement>;
90
- export type UseLinkPropsOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''> = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
91
- export type ActiveLinkOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''> = LinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
89
+ export declare function useLinkProps<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): React.AnchorHTMLAttributes<HTMLAnchorElement>;
90
+ export type UseLinkPropsOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''> = ActiveLinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
91
+ export type ActiveLinkOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
92
92
  activeProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
93
93
  inactiveProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
94
94
  };
95
- export type LinkProps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = string, TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''> = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
95
+ export type LinkProps<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''> = ActiveLinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
96
96
  children?: React.ReactNode | ((state: {
97
97
  isActive: boolean;
98
98
  isTransitioning: boolean;
@@ -103,7 +103,7 @@ type LinkComponentProps<TComp> = React.PropsWithoutRef<TComp extends React.FC<in
103
103
  }> | React.Component<{
104
104
  ref: infer TRef;
105
105
  }> ? TRef : TComp extends keyof JSX.IntrinsicElements ? React.ComponentRef<TComp> : never>;
106
- export type LinkComponent<TComp> = <TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''>(props: LinkProps<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & LinkComponentProps<TComp>) => React.ReactElement;
106
+ export type LinkComponent<TComp> = <TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(props: LinkProps<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & LinkComponentProps<TComp>) => React.ReactElement;
107
107
  export declare function createLink<const TComp>(Comp: TComp): LinkComponent<TComp>;
108
108
  export declare const Link: LinkComponent<'a'>;
109
109
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"redirects.cjs","sources":["../../src/redirects.ts"],"sourcesContent":["import type { NavigateOptions } from './link'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type { RegisteredRouter } from './router'\nimport type { PickAsRequired } from './utils'\n\nexport type AnyRedirect = Redirect<any, any, any, any, any>\n\nexport type Redirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = {\n /**\n * @deprecated Use `statusCode` instead\n **/\n href?: string\n code?: number\n statusCode?: number\n throw?: any\n headers?: HeadersInit\n} & NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type ResolvedRedirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = PickAsRequired<\n Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n 'code' | 'statusCode' | 'headers'\n> & {\n href: string\n}\n\nexport function redirect<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n>(\n opts: Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> {\n ;(opts as any).isRedirect = true\n opts.statusCode = opts.statusCode || opts.code || 301\n opts.headers = opts.headers || {}\n if (opts.throw) {\n throw opts\n }\n\n return opts\n}\n\nexport function isRedirect(obj: any): obj is AnyRedirect {\n return !!obj?.isRedirect\n}\n"],"names":[],"mappings":";;AAsCO,SAAS,SAOd,MACsD;AACpD,OAAa,aAAa;AAC5B,OAAK,aAAa,KAAK,cAAc,KAAK,QAAQ;AAC7C,OAAA,UAAU,KAAK,WAAW,CAAA;AAC/B,MAAI,KAAK,OAAO;AACR,UAAA;AAAA,EACR;AAEO,SAAA;AACT;AAEO,SAAS,WAAW,KAA8B;AAChD,SAAA,CAAC,EAAC,2BAAK;AAChB;;;"}
1
+ {"version":3,"file":"redirects.cjs","sources":["../../src/redirects.ts"],"sourcesContent":["import type { NavigateOptions } from './link'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type { PickAsRequired } from './utils'\n\nexport type AnyRedirect = Redirect<any, any, any, any, any>\n\nexport type Redirect<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom,\n TMaskTo extends string = '',\n> = {\n /**\n * @deprecated Use `statusCode` instead\n **/\n href?: string\n code?: number\n statusCode?: number\n throw?: any\n headers?: HeadersInit\n} & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type ResolvedRedirect<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom,\n TMaskTo extends string = '',\n> = PickAsRequired<\n Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n 'code' | 'statusCode' | 'headers'\n> & {\n href: string\n}\n\nexport function redirect<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n opts: Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> {\n ;(opts as any).isRedirect = true\n opts.statusCode = opts.statusCode || opts.code || 301\n opts.headers = opts.headers || {}\n if (opts.throw) {\n throw opts\n }\n\n return opts\n}\n\nexport function isRedirect(obj: any): obj is AnyRedirect {\n return !!obj?.isRedirect\n}\n"],"names":[],"mappings":";;AAsCO,SAAS,SAOd,MACmD;AACjD,OAAa,aAAa;AAC5B,OAAK,aAAa,KAAK,cAAc,KAAK,QAAQ;AAC7C,OAAA,UAAU,KAAK,WAAW,CAAA;AAC/B,MAAI,KAAK,OAAO;AACR,UAAA;AAAA,EACR;AAEO,SAAA;AACT;AAEO,SAAS,WAAW,KAA8B;AAChD,SAAA,CAAC,EAAC,2BAAK;AAChB;;;"}
@@ -1,10 +1,9 @@
1
1
  import type { NavigateOptions } from './link.cjs';
2
- import type { AnyRoute } from './route.cjs';
3
2
  import type { RoutePaths } from './routeInfo.cjs';
4
- import type { RegisteredRouter } from './router.cjs';
3
+ import type { AnyRouter, RegisteredRouter } from './router.cjs';
5
4
  import type { PickAsRequired } from './utils.cjs';
6
5
  export type AnyRedirect = Redirect<any, any, any, any, any>;
7
- export type Redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = {
6
+ export type Redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom, TMaskTo extends string = ''> = {
8
7
  /**
9
8
  * @deprecated Use `statusCode` instead
10
9
  **/
@@ -13,9 +12,9 @@ export type Redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree']
13
12
  statusCode?: number;
14
13
  throw?: any;
15
14
  headers?: HeadersInit;
16
- } & NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>;
17
- export type ResolvedRedirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = PickAsRequired<Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>, 'code' | 'statusCode' | 'headers'> & {
15
+ } & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
16
+ export type ResolvedRedirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom, TMaskTo extends string = ''> = PickAsRequired<Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>, 'code' | 'statusCode' | 'headers'> & {
18
17
  href: string;
19
18
  };
20
- export declare function redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''>(opts: Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>;
19
+ export declare function redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
21
20
  export declare function isRedirect(obj: any): obj is AnyRedirect;
@@ -1 +1 @@
1
- {"version":3,"file":"route.cjs","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { useLoaderData, useLoaderDeps, useMatch } from './Matches'\nimport { joinPaths, trimPathLeft } from './path'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { notFound } from './not-found'\nimport { useNavigate } from './useNavigate'\nimport type { UseNavigateResult } from './useNavigate'\nimport type * as React from 'react'\nimport type { MakeRouteMatch, RouteMatch } from './Matches'\nimport type { NavigateOptions, ParsePathParams, ToSubOptions } from './link'\nimport type { ParsedLocation } from './location'\nimport type { RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type {\n Assign,\n Expand,\n IsAny,\n NoInfer,\n PickRequired,\n UnionToIntersection,\n} from './utils'\nimport type { BuildLocationFn, NavigateFn } from './RouterProvider'\nimport type { NotFoundError } from './not-found'\nimport type { LazyRoute } from './fileRoute'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnySearchSchema = {}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport interface StaticDataRouteOption {}\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> =\n UnionToIntersection<RoutePathOptions<TCustomId, TPath>>\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed = {},\n TFullSearchSchemaInput = TSearchSchemaUsed,\n TFullSearchSchema = TSearchSchema,\n TParams = AnyPathParams,\n TAllParams = TParams,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n> &\n UpdatableRouteOptions<\n NoInfer<TCustomId>,\n NoInfer<TAllParams>,\n NoInfer<TFullSearchSchema>,\n NoInfer<TLoaderData>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n NoInfer<TLoaderDeps>\n >\n\nexport type ParamsFallback<\n TPath extends string,\n TParams,\n> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams\n\nexport type FileBaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TFullSearchSchema = TSearchSchema,\n TParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n> = {\n validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>\n shouldReload?:\n | boolean\n | ((\n match: LoaderFnContext<\n TAllParams,\n TFullSearchSchema,\n TAllContext,\n TRouteContext\n >,\n ) => any)\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteContextReturn,\n TRouterContext\n >\n loaderDeps?: (opts: { search: TFullSearchSchema }) => TLoaderDeps\n loader?: RouteLoaderFn<\n TAllParams,\n NoInfer<TLoaderDeps>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n TLoaderDataReturn\n >\n} & (\n | {\n // Both or none\n parseParams?: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n stringifyParams?: (\n params: NoInfer<ParamsFallback<TPath, TParams>>,\n ) => Record<ParsePathParams<TPath>, string>\n }\n | {\n stringifyParams?: never\n parseParams?: never\n }\n)\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed = {},\n TFullSearchSchemaInput = TSearchSchemaUsed,\n TFullSearchSchema = TSearchSchema,\n TParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n> = RoutePathOptions<TCustomId, TPath> &\n FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n > & {\n getParentRoute: () => TParentRoute\n }\n\ntype BeforeLoadFn<\n in out TFullSearchSchema,\n in out TParentRoute extends AnyRoute,\n in out TAllParams,\n TRouteContextReturn extends RouteContext,\n in out TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n in out TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>,\n> = (opts: {\n search: TFullSearchSchema\n abortController: AbortController\n preload: boolean\n params: TAllParams\n context: TContext\n location: ParsedLocation\n navigate: NavigateFn\n buildLocation: BuildLocationFn<TParentRoute>\n cause: 'preload' | 'enter' | 'stay'\n}) => Promise<TRouteContextReturn> | TRouteContextReturn | void\n\nexport type UpdatableRouteOptions<\n TRouteId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps,\n TRouteMatch = RouteMatch<\n TRouteId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n> = {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n pendingMs?: number\n pendingMinMs?: number\n staleTime?: number\n gcTime?: number\n preloadStaleTime?: number\n preloadGcTime?: number\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: Array<SearchFilter<TFullSearchSchema>>\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: Array<SearchFilter<TFullSearchSchema>>\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: TRouteMatch) => void\n onStay?: (match: TRouteMatch) => void\n onLeave?: (match: TRouteMatch) => void\n meta?: (ctx: {\n params: TAllParams\n loaderData: TLoaderData\n }) => Array<JSX.IntrinsicElements['meta']>\n links?: () => Array<JSX.IntrinsicElements['link']>\n scripts?: () => Array<JSX.IntrinsicElements['script']>\n headers?: (ctx: { loaderData: TLoaderData }) => Record<string, string>\n} & UpdatableStaticRouteOption\n\nexport type UpdatableStaticRouteOption =\n {} extends PickRequired<StaticDataRouteOption>\n ? {\n staticData?: StaticDataRouteOption\n }\n : {\n staticData: StaticDataRouteOption\n }\n\nexport type MetaDescriptor =\n | { charSet: 'utf-8' }\n | { title: string }\n | { name: string; content: string }\n | { property: string; content: string }\n | { httpEquiv: string; content: string }\n | { 'script:ld+json': LdJsonObject }\n | { tagName: 'meta' | 'link'; [name: string]: string }\n | Record<string, unknown>\n\ntype LdJsonObject = { [Key in string]: LdJsonValue } & {\n [Key in string]?: LdJsonValue | undefined\n}\ntype LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>\ntype LdJsonPrimitive = string | number | boolean | null\ntype LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray\n\nexport type RouteLinkEntry = {}\n\nexport type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<\n TPath,\n TParams\n>\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n\nexport type ParseParamsObj<TPath extends string, TParams> = {\n parse?: ParseParamsFn<TPath, TParams>\n}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TInput, TReturn> =\n | SearchSchemaValidatorObj<TInput, TReturn>\n | SearchSchemaValidatorFn<TInput, TReturn>\n\nexport type SearchSchemaValidatorObj<TInput, TReturn> = {\n parse?: SearchSchemaValidatorFn<TInput, TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TInput, TReturn> = (\n searchObj: TInput,\n) => TReturn\n\nexport type RouteLoaderFn<\n in out TAllParams = {},\n in out TLoaderDeps extends Record<string, any> = {},\n in out TAllContext = AnyContext,\n in out TRouteContext = AnyContext,\n TLoaderData = unknown,\n> = (\n match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext, TRouteContext>,\n) => Promise<TLoaderData> | TLoaderData\n\nexport interface LoaderFnContext<\n in out TAllParams = {},\n in out TLoaderDeps = {},\n in out TAllContext = AnyContext,\n in out TRouteContext = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: TAllParams\n deps: TLoaderDeps\n context: Assign<TAllContext, TRouteContext>\n location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n /**\n * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n **/\n navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>\n parentMatchPromise?: Promise<void>\n cause: 'preload' | 'enter' | 'stay'\n route: Route\n}\n\nexport type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n types: {\n fullSearchSchemaInput: infer TFullSearchSchemaInput\n }\n}\n ? TFullSearchSchemaInput\n : {}\n\nexport type ResolveFullSearchSchema<\n TParentRoute extends AnyRoute,\n TSearchSchema,\n> = Assign<\n TParentRoute['id'] extends RootRouteId\n ? Omit<TParentRoute['types']['searchSchema'], keyof RootSearchSchema>\n : TParentRoute['types']['fullSearchSchema'],\n TSearchSchema\n>\n\nexport type ResolveFullSearchSchemaInput<\n TParentRoute extends AnyRoute,\n TSearchSchemaUsed,\n> = Assign<\n TParentRoute['id'] extends RootRouteId\n ? Omit<TParentRoute['types']['searchSchemaInput'], keyof RootSearchSchema>\n : TParentRoute['types']['fullSearchSchemaInput'],\n TSearchSchemaUsed\n>\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type MergeFromFromParent<T, U> = IsAny<T, U, T & U>\n\nexport type ResolveAllParams<TParentRoute extends AnyRoute, TParams> =\n Record<never, string> extends TParentRoute['types']['allParams']\n ? TParams\n : UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteContext: RouteContext\n TAllContext: AnyContext\n TRouterContext: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\nexport function getRouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n>(id: TId) {\n return new RouteApi<\n TId,\n TRoute,\n TFullSearchSchema,\n TAllParams,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >({ id })\n}\n\nexport class RouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch = <\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (s: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = Expand<TFullSearchSchema>>(opts?: {\n select?: (s: Expand<TFullSearchSchema>) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (s: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (s: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.id })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n in out TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n in out TSearchSchemaUsed = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n in out TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n in out TFullSearchSchema = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n in out TParams = Record<ParsePathParams<TPath>, string>,\n in out TAllParams = ResolveAllParams<TParentRoute, TParams>,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n in out TRouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n in out TAllContext = Assign<\n IsAny<TParentRoute['types']['allContext'], {}>,\n TRouteContext\n >,\n in out TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n in out TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n in out TChildren extends RouteConstraints['TChildren'] = unknown,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n lazyFn?: () => Promise<LazyRoute<any>>\n\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) {\n this.options = (options as any) || {}\n\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n searchSchemaInput: TSearchSchemaInput\n searchSchemaUsed: TSearchSchemaUsed\n fullSearchSchema: TFullSearchSchema\n fullSearchSchemaInput: TFullSearchSchemaInput\n params: TParams\n allParams: TAllParams\n routeContext: TRouteContext\n allContext: TAllContext\n children: TChildren\n routerContext: TRouterContext\n loaderData: TLoaderData\n loaderDeps: TLoaderDeps\n }\n\n init = (opts: { originalIndex: number }): void => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as\n | (RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>)\n | undefined\n\n const isRoot = !options?.path && !options?.id\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren = <const TNewChildren extends ReadonlyArray<AnyRoute>>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TNewChildren\n > => {\n this.children = children as any\n return this as any\n }\n\n updateLoader = <TNewLoaderData = unknown>(options: {\n loader: RouteLoaderFn<\n TAllParams,\n TLoaderDeps,\n TAllContext,\n TRouteContext,\n TNewLoaderData\n >\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TNewLoaderData,\n TChildren\n >\n }\n\n update = (\n options: UpdatableRouteOptions<\n TCustomId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ): this => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy = (lazyFn: () => Promise<LazyRoute<any>>): this => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch = <\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (search: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = Expand<TFullSearchSchema>>(opts?: {\n select?: (search: Expand<TFullSearchSchema>) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (search: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (search: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<string> => {\n return useNavigate({ from: this.id })\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>,\n TParams = Record<ParsePathParams<TPath>, string>,\n TAllParams = ResolveAllParams<TParentRoute, TParams>,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext = Assign<\n IsAny<TParentRoute['types']['allContext'], {}>,\n TRouteContext\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n>(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n) {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n >(\n options?: Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, //TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn, // TLoaderDataReturn,\n TLoaderData // TLoaderData,\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) => {\n return createRootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport type RootSearchSchema = {\n __TRootSearchSchema__: '__TRootSearchSchema__'\n}\n\nexport class RootRoute<\n in out TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n in out TSearchSchema extends Record<string, any> = RootSearchSchema,\n in out TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n in out TRouteContext extends RouteContext = [TRouteContextReturn] extends [\n never,\n ]\n ? RouteContext\n : TRouteContextReturn,\n in out TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n in out TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TRouterContext, // TRouterContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n any // TChildren\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) {\n super(options as any)\n }\n}\n\nexport function createRootRoute<\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n>(\n options?: Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n) {\n return new RootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >(options)\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToSubOptions<TRouteTree, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\n/**\n * @deprecated Use `ErrorComponentProps` instead.\n */\nexport type ErrorRouteProps = {\n error: unknown\n info?: { componentStack: string }\n reset: () => void\n}\n\nexport type ErrorComponentProps = {\n error: unknown\n info?: { componentStack: string }\n reset: () => void\n}\nexport type NotFoundRouteProps = {\n // TODO: Make sure this is `| null | undefined` (this is for global not-founds)\n data: unknown\n}\n//\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = SyncRouteComponent<TProps> &\n AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends RouteConstraints['TSearchSchema'] = {},\n TFullSearchSchemaInput extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = AnyContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,\n TAllContext = Assign<\n IsAny<TParentRoute['types']['allContext'], {}>,\n TRouteContext\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useNavigate","notFound","options","path","trimPathLeft","joinPaths"],"mappings":"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"}
1
+ {"version":3,"file":"route.cjs","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { useLoaderData, useLoaderDeps, useMatch } from './Matches'\nimport { joinPaths, trimPathLeft } from './path'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { notFound } from './not-found'\nimport { useNavigate } from './useNavigate'\nimport type { UseNavigateResult } from './useNavigate'\nimport type * as React from 'react'\nimport type { MakeRouteMatch, RouteMatch } from './Matches'\nimport type { NavigateOptions, ParsePathParams, ToSubOptions } from './link'\nimport type { ParsedLocation } from './location'\nimport type { RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport type { AnyRouter, RegisteredRouter, Router } from './router'\nimport type {\n Assign,\n Expand,\n IsAny,\n NoInfer,\n PickRequired,\n UnionToIntersection,\n} from './utils'\nimport type { BuildLocationFn, NavigateFn } from './RouterProvider'\nimport type { NotFoundError } from './not-found'\nimport type { LazyRoute } from './fileRoute'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnySearchSchema = {}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport interface StaticDataRouteOption {}\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> =\n UnionToIntersection<RoutePathOptions<TCustomId, TPath>>\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed = {},\n TFullSearchSchemaInput = TSearchSchemaUsed,\n TFullSearchSchema = TSearchSchema,\n TParams = AnyPathParams,\n TAllParams = TParams,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n> &\n UpdatableRouteOptions<\n NoInfer<TCustomId>,\n NoInfer<TAllParams>,\n NoInfer<TFullSearchSchema>,\n NoInfer<TLoaderData>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n NoInfer<TLoaderDeps>\n >\n\nexport type ParamsFallback<\n TPath extends string,\n TParams,\n> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams\n\nexport type FileBaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TFullSearchSchema = TSearchSchema,\n TParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n> = {\n validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>\n shouldReload?:\n | boolean\n | ((\n match: LoaderFnContext<\n TAllParams,\n TFullSearchSchema,\n TAllContext,\n TRouteContext\n >,\n ) => any)\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteContextReturn,\n TRouterContext\n >\n loaderDeps?: (opts: { search: TFullSearchSchema }) => TLoaderDeps\n loader?: RouteLoaderFn<\n TAllParams,\n NoInfer<TLoaderDeps>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n TLoaderDataReturn\n >\n} & (\n | {\n // Both or none\n parseParams?: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n stringifyParams?: (\n params: NoInfer<ParamsFallback<TPath, TParams>>,\n ) => Record<ParsePathParams<TPath>, string>\n }\n | {\n stringifyParams?: never\n parseParams?: never\n }\n)\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed = {},\n TFullSearchSchemaInput = TSearchSchemaUsed,\n TFullSearchSchema = TSearchSchema,\n TParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n> = RoutePathOptions<TCustomId, TPath> &\n FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn\n > & {\n getParentRoute: () => TParentRoute\n }\n\ntype BeforeLoadFn<\n in out TFullSearchSchema,\n in out TParentRoute extends AnyRoute,\n in out TAllParams,\n TRouteContextReturn extends RouteContext,\n in out TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n in out TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>,\n> = (opts: {\n search: TFullSearchSchema\n abortController: AbortController\n preload: boolean\n params: TAllParams\n context: TContext\n location: ParsedLocation\n navigate: NavigateFn\n buildLocation: BuildLocationFn<TParentRoute>\n cause: 'preload' | 'enter' | 'stay'\n}) => Promise<TRouteContextReturn> | TRouteContextReturn | void\n\nexport type UpdatableRouteOptions<\n TRouteId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps,\n TRouteMatch = RouteMatch<\n TRouteId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n> = {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n pendingMs?: number\n pendingMinMs?: number\n staleTime?: number\n gcTime?: number\n preloadStaleTime?: number\n preloadGcTime?: number\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: Array<SearchFilter<TFullSearchSchema>>\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: Array<SearchFilter<TFullSearchSchema>>\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: TRouteMatch) => void\n onStay?: (match: TRouteMatch) => void\n onLeave?: (match: TRouteMatch) => void\n meta?: (ctx: {\n params: TAllParams\n loaderData: TLoaderData\n }) => Array<JSX.IntrinsicElements['meta']>\n links?: () => Array<JSX.IntrinsicElements['link']>\n scripts?: () => Array<JSX.IntrinsicElements['script']>\n headers?: (ctx: { loaderData: TLoaderData }) => Record<string, string>\n} & UpdatableStaticRouteOption\n\nexport type UpdatableStaticRouteOption =\n {} extends PickRequired<StaticDataRouteOption>\n ? {\n staticData?: StaticDataRouteOption\n }\n : {\n staticData: StaticDataRouteOption\n }\n\nexport type MetaDescriptor =\n | { charSet: 'utf-8' }\n | { title: string }\n | { name: string; content: string }\n | { property: string; content: string }\n | { httpEquiv: string; content: string }\n | { 'script:ld+json': LdJsonObject }\n | { tagName: 'meta' | 'link'; [name: string]: string }\n | Record<string, unknown>\n\ntype LdJsonObject = { [Key in string]: LdJsonValue } & {\n [Key in string]?: LdJsonValue | undefined\n}\ntype LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>\ntype LdJsonPrimitive = string | number | boolean | null\ntype LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray\n\nexport type RouteLinkEntry = {}\n\nexport type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<\n TPath,\n TParams\n>\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n\nexport type ParseParamsObj<TPath extends string, TParams> = {\n parse?: ParseParamsFn<TPath, TParams>\n}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TInput, TReturn> =\n | SearchSchemaValidatorObj<TInput, TReturn>\n | SearchSchemaValidatorFn<TInput, TReturn>\n\nexport type SearchSchemaValidatorObj<TInput, TReturn> = {\n parse?: SearchSchemaValidatorFn<TInput, TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TInput, TReturn> = (\n searchObj: TInput,\n) => TReturn\n\nexport type RouteLoaderFn<\n in out TAllParams = {},\n in out TLoaderDeps extends Record<string, any> = {},\n in out TAllContext = AnyContext,\n in out TRouteContext = AnyContext,\n TLoaderData = unknown,\n> = (\n match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext, TRouteContext>,\n) => Promise<TLoaderData> | TLoaderData\n\nexport interface LoaderFnContext<\n in out TAllParams = {},\n in out TLoaderDeps = {},\n in out TAllContext = AnyContext,\n in out TRouteContext = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: TAllParams\n deps: TLoaderDeps\n context: Assign<TAllContext, TRouteContext>\n location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n /**\n * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n **/\n navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void>\n parentMatchPromise?: Promise<void>\n cause: 'preload' | 'enter' | 'stay'\n route: Route\n}\n\nexport type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n types: {\n fullSearchSchemaInput: infer TFullSearchSchemaInput\n }\n}\n ? TFullSearchSchemaInput\n : {}\n\nexport type ResolveFullSearchSchema<\n TParentRoute extends AnyRoute,\n TSearchSchema,\n> = Assign<\n TParentRoute['id'] extends RootRouteId\n ? Omit<TParentRoute['types']['searchSchema'], keyof RootSearchSchema>\n : TParentRoute['types']['fullSearchSchema'],\n TSearchSchema\n>\n\nexport type ResolveFullSearchSchemaInput<\n TParentRoute extends AnyRoute,\n TSearchSchemaUsed,\n> = Assign<\n TParentRoute['id'] extends RootRouteId\n ? Omit<TParentRoute['types']['searchSchemaInput'], keyof RootSearchSchema>\n : TParentRoute['types']['fullSearchSchemaInput'],\n TSearchSchemaUsed\n>\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type MergeFromFromParent<T, U> = IsAny<T, U, T & U>\n\nexport type ResolveAllParams<TParentRoute extends AnyRoute, TParams> =\n Record<never, string> extends TParentRoute['types']['allParams']\n ? TParams\n : UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteContext: RouteContext\n TAllContext: AnyContext\n TRouterContext: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\nexport function getRouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n>(id: TId) {\n return new RouteApi<\n TId,\n TRoute,\n TFullSearchSchema,\n TAllParams,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >({ id })\n}\n\nexport class RouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema = TRoute['types']['fullSearchSchema'],\n TAllParams = TRoute['types']['allParams'],\n TAllContext = TRoute['types']['allContext'],\n TLoaderDeps = TRoute['types']['loaderDeps'],\n TLoaderData = TRoute['types']['loaderData'],\n> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch = <\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (s: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = Expand<TFullSearchSchema>>(opts?: {\n select?: (s: Expand<TFullSearchSchema>) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (s: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (s: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.id })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n in out TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n in out TSearchSchemaUsed = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n in out TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n in out TFullSearchSchema = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n in out TParams = Record<ParsePathParams<TPath>, string>,\n in out TAllParams = ResolveAllParams<TParentRoute, TParams>,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n in out TRouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n in out TAllContext = Assign<\n IsAny<TParentRoute['types']['allContext'], {}>,\n TRouteContext\n >,\n in out TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n in out TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n in out TChildren extends RouteConstraints['TChildren'] = unknown,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n lazyFn?: () => Promise<LazyRoute<any>>\n\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n ) {\n this.options = (options as any) || {}\n\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n searchSchemaInput: TSearchSchemaInput\n searchSchemaUsed: TSearchSchemaUsed\n fullSearchSchema: TFullSearchSchema\n fullSearchSchemaInput: TFullSearchSchemaInput\n params: TParams\n allParams: TAllParams\n routeContext: TRouteContext\n allContext: TAllContext\n children: TChildren\n routerContext: TRouterContext\n loaderData: TLoaderData\n loaderDeps: TLoaderDeps\n }\n\n init = (opts: { originalIndex: number }): void => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as\n | (RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>)\n | undefined\n\n const isRoot = !options?.path && !options?.id\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren = <const TNewChildren extends ReadonlyArray<AnyRoute>>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TNewChildren\n > => {\n this.children = children as any\n return this as any\n }\n\n updateLoader = <TNewLoaderData = unknown>(options: {\n loader: RouteLoaderFn<\n TAllParams,\n TLoaderDeps,\n TAllContext,\n TRouteContext,\n TNewLoaderData\n >\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TNewLoaderData,\n TChildren\n >\n }\n\n update = (\n options: UpdatableRouteOptions<\n TCustomId,\n TAllParams,\n TFullSearchSchema,\n TLoaderData,\n TAllContext,\n TRouteContext,\n TLoaderDeps\n >,\n ): this => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy = (lazyFn: () => Promise<LazyRoute<any>>): this => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch = <\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TRouteMatch = MakeRouteMatch<TRouteTree, TId>,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id })\n }\n\n useRouteContext = <TSelected = Expand<TAllContext>>(opts?: {\n select?: (search: Expand<TAllContext>) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = Expand<TFullSearchSchema>>(opts?: {\n select?: (search: Expand<TFullSearchSchema>) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = Expand<TAllParams>>(opts?: {\n select?: (search: Expand<TAllParams>) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (search: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<string> => {\n return useNavigate({ from: this.id })\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>,\n TParams = Record<ParsePathParams<TPath>, string>,\n TAllParams = ResolveAllParams<TParentRoute, TParams>,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext = Assign<\n IsAny<TParentRoute['types']['allContext'], {}>,\n TRouteContext\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n>(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n) {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n >(\n options?: Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, //TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn, // TLoaderDataReturn,\n TLoaderData // TLoaderData,\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) => {\n return createRootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport type RootSearchSchema = {\n __TRootSearchSchema__: '__TRootSearchSchema__'\n}\n\nexport class RootRoute<\n in out TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n in out TSearchSchema extends Record<string, any> = RootSearchSchema,\n in out TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n in out TRouteContext extends RouteContext = [TRouteContextReturn] extends [\n never,\n ]\n ? RouteContext\n : TRouteContextReturn,\n in out TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n in out TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TRouterContext, // TRouterContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n any // TChildren\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) {\n super(options as any)\n }\n}\n\nexport function createRootRoute<\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n>(\n options?: Omit<\n RouteOptions<\n any, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n) {\n return new RootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >(options)\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToSubOptions<Router<TRouteTree, 'never'>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\n/**\n * @deprecated Use `ErrorComponentProps` instead.\n */\nexport type ErrorRouteProps = {\n error: unknown\n info?: { componentStack: string }\n reset: () => void\n}\n\nexport type ErrorComponentProps = {\n error: unknown\n info?: { componentStack: string }\n reset: () => void\n}\nexport type NotFoundRouteProps = {\n // TODO: Make sure this is `| null | undefined` (this is for global not-founds)\n data: unknown\n}\n//\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = SyncRouteComponent<TProps> &\n AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends RouteConstraints['TSearchSchema'] = {},\n TFullSearchSchemaInput extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = AnyContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,\n TAllContext = Assign<\n IsAny<TParentRoute['types']['allContext'], {}>,\n TRouteContext\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderDataReturn = unknown,\n TLoaderData = [TLoaderDataReturn] extends [never]\n ? undefined\n : TLoaderDataReturn,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderDataReturn,\n TLoaderData\n >,\n 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useNavigate","notFound","options","path","trimPathLeft","joinPaths"],"mappings":"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"}
@@ -4,7 +4,7 @@ import type { MakeRouteMatch, RouteMatch } from './Matches.cjs';
4
4
  import type { NavigateOptions, ParsePathParams, ToSubOptions } from './link.cjs';
5
5
  import type { ParsedLocation } from './location.cjs';
6
6
  import type { RouteById, RouteIds, RoutePaths } from './routeInfo.cjs';
7
- import type { AnyRouter, RegisteredRouter } from './router.cjs';
7
+ import type { AnyRouter, RegisteredRouter, Router } from './router.cjs';
8
8
  import type { Assign, Expand, IsAny, NoInfer, PickRequired, UnionToIntersection } from './utils.cjs';
9
9
  import type { BuildLocationFn, NavigateFn } from './RouterProvider.cjs';
10
10
  import type { NotFoundError } from './not-found.cjs';
@@ -144,7 +144,7 @@ export interface LoaderFnContext<in out TAllParams = {}, in out TLoaderDeps = {}
144
144
  /**
145
145
  * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
146
146
  **/
147
- navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>;
147
+ navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void>;
148
148
  parentMatchPromise?: Promise<void>;
149
149
  cause: 'preload' | 'enter' | 'stay';
150
150
  route: Route;
@@ -195,7 +195,7 @@ export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']
195
195
  constructor({ id }: {
196
196
  id: TId;
197
197
  });
198
- useMatch: <TRouteTree extends AnyRoute = AnyRoute, TRouteMatch = MakeRouteMatch<TRouteTree, TId>, TSelected = TRouteMatch>(opts?: {
198
+ useMatch: <TRouteTree extends AnyRoute = any, TRouteMatch = MakeRouteMatch<TRouteTree, TId>, TSelected = TRouteMatch>(opts?: {
199
199
  select?: ((match: TRouteMatch) => TSelected) | undefined;
200
200
  } | undefined) => TSelected;
201
201
  useRouteContext: <TSelected = Expand<TAllContext>>(opts?: {
@@ -263,7 +263,7 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
263
263
  }) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TNewLoaderData, TChildren, unknown>;
264
264
  update: (options: UpdatableRouteOptions<TCustomId, TAllParams, TFullSearchSchema, TLoaderData, TAllContext, TRouteContext, TLoaderDeps>) => this;
265
265
  lazy: (lazyFn: () => Promise<LazyRoute<any>>) => this;
266
- useMatch: <TRouteTree extends AnyRoute = AnyRoute, TRouteMatch = MakeRouteMatch<TRouteTree, TId>, TSelected = TRouteMatch>(opts?: {
266
+ useMatch: <TRouteTree extends AnyRoute = any, TRouteMatch = MakeRouteMatch<TRouteTree, TId>, TSelected = TRouteMatch>(opts?: {
267
267
  select?: ((match: TRouteMatch) => TSelected) | undefined;
268
268
  } | undefined) => TSelected;
269
269
  useRouteContext: <TSelected = Expand<TAllContext>>(opts?: {
@@ -285,7 +285,7 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
285
285
  }
286
286
  export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {}, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TSearchSchemaUsed = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : TSearchSchema, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams = Record<ParsePathParams<TPath>, string>, TAllParams = ResolveAllParams<TParentRoute, TParams>, TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext, TRouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TAllContext = Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = unknown, TLoaderData = [TLoaderDataReturn] extends [never] ? undefined : TLoaderDataReturn, TChildren extends RouteConstraints['TChildren'] = unknown>(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren>;
287
287
  export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
288
- export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TSearchSchemaInput extends Record<string, any> = RootSearchSchema, TSearchSchema extends Record<string, any> = RootSearchSchema, TSearchSchemaUsed extends Record<string, any> = RootSearchSchema, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = unknown, TLoaderData = [TLoaderDataReturn] extends [never] ? undefined : TLoaderDataReturn>(options?: Omit<RouteOptions<any, "__root__", "", TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TSearchSchemaUsed, TSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TRouterContext, Assign<TRouterContext, TRouteContext>, TLoaderDeps, TLoaderDataReturn, TLoaderData>, "path" | "id" | "stringifyParams" | "parseParams" | "getParentRoute" | "caseSensitive"> | undefined) => RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderData, [TLoaderData] extends [never] ? undefined : TLoaderData>;
288
+ export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TSearchSchemaInput extends Record<string, any> = RootSearchSchema, TSearchSchema extends Record<string, any> = RootSearchSchema, TSearchSchemaUsed extends Record<string, any> = RootSearchSchema, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = unknown, TLoaderData = [TLoaderDataReturn] extends [never] ? undefined : TLoaderDataReturn>(options?: Omit<RouteOptions<any, "__root__", "", TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TSearchSchemaUsed, TSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TRouterContext, Assign<TRouterContext, TRouteContext>, TLoaderDeps, TLoaderDataReturn, TLoaderData>, "path" | "id" | "caseSensitive" | "stringifyParams" | "parseParams" | "getParentRoute"> | undefined) => RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderData, [TLoaderData] extends [never] ? undefined : TLoaderData>;
289
289
  /**
290
290
  * @deprecated Use the `createRootRouteWithContext` function instead.
291
291
  */
@@ -358,7 +358,7 @@ export type RouteMask<TRouteTree extends AnyRoute> = {
358
358
  };
359
359
  export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends RoutePaths<TRouteTree>, TTo extends string>(opts: {
360
360
  routeTree: TRouteTree;
361
- } & ToSubOptions<TRouteTree, TFrom, TTo>): RouteMask<TRouteTree>;
361
+ } & ToSubOptions<Router<TRouteTree, 'never'>, TFrom, TTo>): RouteMask<TRouteTree>;
362
362
  /**
363
363
  * @deprecated Use `ErrorComponentProps` instead.
364
364
  */
@@ -1,21 +1,38 @@
1
1
  import type { AnyRoute } from './route.cjs';
2
+ import type { AnyRouter, TrailingSlashOption } from './router.cjs';
2
3
  import type { UnionToIntersection, UnionToTuple } from './utils.cjs';
3
4
  export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
4
5
  types: {
5
6
  children: infer TChildren;
6
7
  };
7
8
  } ? TChildren extends ReadonlyArray<any> ? ParseRoute<TChildren[number], TAcc | TChildren[number]> : TAcc : TAcc;
8
- export type RouteLeaves<TRouteTree> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? TRoute['types']['children'] extends ReadonlyArray<any> ? never : TRoute['fullPath'] : never : never;
9
+ export type ParseRouteWithoutBranches<TRouteTree> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? TRoute['types']['children'] extends ReadonlyArray<any> ? '/' extends TRoute['types']['children'][number]['path'] ? never : TRoute : TRoute : never : never;
9
10
  export type RoutesById<TRouteTree extends AnyRoute> = {
10
11
  [K in ParseRoute<TRouteTree> as K['id']]: K;
11
12
  };
12
13
  export type RouteById<TRouteTree extends AnyRoute, TId> = Extract<RoutesById<TRouteTree>[TId], AnyRoute>;
13
14
  export type RouteIds<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree>['id'];
15
+ export type CatchAllPaths<TRouteTree extends AnyRoute> = Record<'.' | '..' | '', ParseRoute<TRouteTree>>;
14
16
  export type RoutesByPath<TRouteTree extends AnyRoute> = {
15
17
  [K in ParseRoute<TRouteTree> as K['fullPath']]: K;
16
- } & Record<'.' | '..', ParseRoute<TRouteTree>>;
18
+ } & CatchAllPaths<TRouteTree>;
17
19
  export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<string extends TPath ? ParseRoute<TRouteTree> : RoutesByPath<TRouteTree>[TPath], AnyRoute>;
18
20
  export type RoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree>['fullPath'] | '/';
21
+ export type RouteToPathAlwaysTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] : TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : `${TRoute['fullPath']}/`;
22
+ export type RouteToPathNeverTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : TRoute['fullPath'] extends `${infer TRest}/` ? TRest : TRoute['fullPath'] : TRoute['fullPath'];
23
+ export type RouteToPathPreserveTrailingSlash<TRoute extends AnyRoute> = RouteToPathNeverTrailingSlash<TRoute> | RouteToPathAlwaysTrailingSlash<TRoute>;
24
+ export type RouteToPathByTrailingSlashOption<TRoute extends AnyRoute> = {
25
+ always: RouteToPathAlwaysTrailingSlash<TRoute>;
26
+ preserve: RouteToPathPreserveTrailingSlash<TRoute>;
27
+ never: RouteToPathNeverTrailingSlash<TRoute>;
28
+ };
29
+ export type TrailingSlashOptionByRouter<TRouter extends AnyRouter> = TrailingSlashOption extends TRouter['options']['trailingSlash'] ? 'never' : NonNullable<TRouter['options']['trailingSlash']>;
30
+ export type RouteToByRouter<TRouter extends AnyRouter, TRoute extends AnyRoute> = RouteToPathByTrailingSlashOption<TRoute>[TrailingSlashOptionByRouter<TRouter>];
31
+ export type RouteToPath<TRouter extends AnyRouter, TRouteTree extends AnyRoute> = ParseRouteWithoutBranches<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? RouteToByRouter<TRouter, TRoute> : never : never;
32
+ export type RoutesByToPath<TRouter extends AnyRouter> = {
33
+ [TRoute in ParseRouteWithoutBranches<TRouter['routeTree']> as RouteToByRouter<TRouter, TRoute>]: TRoute;
34
+ } & CatchAllPaths<TRouter['routeTree']>;
35
+ export type RouteByToPath<TRouter extends AnyRouter, TTo> = Extract<string extends TTo ? ParseRouteWithoutBranches<TRouter['routeTree']> : RoutesByToPath<TRouter>[TTo], AnyRoute>;
19
36
  export type RoutePathsAutoComplete<TRouteTree extends AnyRoute, T> = (string extends T ? T & {} : T) | RoutePaths<TRouteTree>;
20
37
  type UnionizeCollisions<T, U> = {
21
38
  [P in keyof T & keyof U]: T[P] extends U[P] ? T[P] : T[P] | U[P];