@tanstack/router-core 0.0.1-beta.152 → 0.0.1-beta.153

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.
@@ -96,83 +96,26 @@ declare function replaceEqualDeep<T>(prev: any, _next: T): T;
96
96
  declare function isPlainObject(o: any): boolean;
97
97
  declare function partialDeepEqual(a: any, b: any): boolean;
98
98
 
99
- interface AnyRoutesInfo {
100
- routeTree: AnyRoute;
101
- routeUnion: AnyRoute;
102
- routesById: Record<string, AnyRoute>;
103
- routesByFullPath: Record<string, AnyRoute>;
104
- routeIds: any;
105
- routePaths: any;
106
- routeIntersection: AnyRoute;
107
- fullSearchSchema: Record<string, any>;
108
- allParams: Record<string, any>;
109
- }
110
- interface DefaultRoutesInfo {
111
- routeTree: AnyRoute;
112
- routeUnion: AnyRoute;
113
- routesById: Record<string, Route>;
114
- routesByFullPath: Record<string, Route>;
115
- routeIds: string;
116
- routePaths: string;
117
- routeIntersection: AnyRoute;
118
- fullSearchSchema: AnySearchSchema;
119
- allParams: AnyPathParams;
120
- }
121
- interface RoutesInfo<TRouteTree extends AnyRoute = Route> extends RoutesInfoInner<TRouteTree, ParseRoute<TRouteTree>> {
122
- }
123
- interface RoutesInfoInner<TRouteTree extends AnyRoute, TRouteUnion extends AnyRoute = Route, TRoutesById = {
124
- '/': TRouteUnion;
125
- } & {
126
- [TRoute in TRouteUnion as TRoute['id']]: TRoute;
127
- }, TRoutesByFullPath = {
128
- '/': TRouteUnion;
129
- } & {
130
- [TRoute in TRouteUnion as TRoute['fullPath'] extends RootRouteId ? never : string extends TRoute['fullPath'] ? never : `${TRoute['fullPath']}/` extends keyof TRoutesById ? never : TRoute['fullPath'] extends `${infer Trimmed}/` ? Trimmed : TRoute['fullPath']]: TRoute;
131
- }> {
132
- routeTree: TRouteTree;
133
- routeUnion: TRouteUnion;
134
- routesById: TRoutesById;
135
- routesByFullPath: TRoutesByFullPath;
136
- routeIds: keyof TRoutesById;
137
- routePaths: keyof TRoutesByFullPath;
138
- routeIntersection: Route<TRouteUnion['__types']['parentRoute'], // TParentRoute,
139
- TRouteUnion['__types']['path'], // TPath,
140
- TRouteUnion['__types']['fullPath'], // TFullPath,
141
- TRouteUnion['__types']['customId'], // TCustomId,
142
- TRouteUnion['__types']['id'], // TId,
143
- TRouteUnion['__types']['loader'], // TId,
144
- // TId,
145
- MergeUnion<TRouteUnion['__types']['searchSchema']> & {}, // TSearchSchema,
146
- // TSearchSchema,
147
- MergeUnion<TRouteUnion['__types']['fullSearchSchema']> & {}, // TFullSearchSchema,
148
- MergeUnion<TRouteUnion['__types']['params']>, // TParams,
149
- MergeUnion<TRouteUnion['__types']['allParams']>, // TAllParams,
150
- MergeUnion<TRouteUnion['__types']['parentContext']>, // TParentContext,
151
- MergeUnion<TRouteUnion['__types']['allParentContext']>, // TAllParentContext,
152
- // TAllParentContext,
153
- MergeUnion<TRouteUnion['__types']['routeContext']> & {}, // TRouteContext,
154
- // TRouteContext,
155
- MergeUnion<TRouteUnion['__types']['context']> & {}, // TContext,
156
- // TContext,
157
- MergeUnion<TRouteUnion['__types']['routerContext']> & {}, // TRouterContext,
158
- TRouteUnion['__types']['children'], // TChildren,
159
- TRouteUnion['__types']['routesInfo']>;
160
- fullSearchSchema: Partial<MergeUnion<TRouteUnion['__types']['fullSearchSchema']>>;
161
- allParams: Partial<MergeUnion<TRouteUnion['__types']['allParams']>>;
162
- }
163
- type ParseRoute<TRouteTree> = TRouteTree extends AnyRoute ? TRouteTree | ParseRouteChildren<TRouteTree> : never;
164
- type ParseRouteChildren<TRouteTree> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? Values<{
165
- [TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
166
- }> : never : never;
167
- type ParseRouteChild<TRoute, TId> = TRoute extends AnyRoute ? ParseRoute<TRoute> : never;
168
- type RoutesById<TRoutesInfo extends AnyRoutesInfo> = {
169
- [K in keyof TRoutesInfo['routesById']]: TRoutesInfo['routesById'][K];
99
+ type ParseRoute<TRouteTree extends AnyRoute> = TRouteTree | ParseRouteChildren<TRouteTree>;
100
+ type ParseRouteChildren<TRouteTree extends AnyRoute> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? {
101
+ [TId in TChildren[number]['id'] as string]: ParseRoute<TChildren[number]>;
102
+ }[string] : never : never;
103
+ type RoutesById<TRouteTree extends AnyRoute> = {
104
+ [K in ParseRoute<TRouteTree>['id'] as K['id']]: K;
170
105
  };
171
- type RouteById<TRoutesInfo extends AnyRoutesInfo, TId> = TId extends keyof TRoutesInfo['routesById'] ? IsAny<TRoutesInfo['routesById'][TId]['id'], Route, TRoutesInfo['routesById'][TId]> : never;
172
- type RoutesByPath<TRoutesInfo extends AnyRoutesInfo> = {
173
- [K in keyof TRoutesInfo['routesByFullPath']]: TRoutesInfo['routesByFullPath'][K];
106
+ type RouteById<TRouteTree extends AnyRoute, TId> = Extract<ParseRoute<TRouteTree>, {
107
+ id: TId;
108
+ }>;
109
+ type RouteIds<TRouteTree extends AnyRoute> = AnyRoute extends TRouteTree ? string : ParseRoute<TRouteTree>['id'];
110
+ type RoutesByPath<TRouteTree extends AnyRoute> = {
111
+ [K in ParseRoute<TRouteTree>['fullPath'] as K['fullPath']]: K;
174
112
  };
175
- type RouteByPath<TRoutesInfo extends AnyRoutesInfo, TPath> = TPath extends keyof TRoutesInfo['routesByFullPath'] ? IsAny<TRoutesInfo['routesByFullPath'][TPath]['id'], Route, TRoutesInfo['routesByFullPath'][TPath]> : never;
113
+ type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<ParseRoute<TRouteTree>, {
114
+ fullPath: TPath;
115
+ }>;
116
+ type RoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree>['fullPath'] | '/';
117
+ type FullSearchSchema<TRouteTree extends AnyRoute> = MergeUnion<ParseRoute<TRouteTree>['__types']['fullSearchSchema']> & {};
118
+ type AllParams<TRouteTree extends AnyRoute> = MergeUnion<ParseRoute<TRouteTree>['__types']['allParams']>;
176
119
 
177
120
  declare global {
178
121
  interface Window {
@@ -181,20 +124,18 @@ declare global {
181
124
  }
182
125
  interface Register {
183
126
  }
184
- type AnyRouter = Router<any, any, any>;
185
- type RegisteredRouterPair = Register extends {
127
+ type AnyRouter = Router<any, any>;
128
+ type RegisteredRouter = Register extends {
186
129
  router: infer TRouter extends AnyRouter;
187
- } ? [TRouter, TRouter['types']['RoutesInfo']] : [Router, AnyRoutesInfo];
188
- type RegisteredRouter = RegisteredRouterPair[0];
189
- type RegisteredRoutesInfo = RegisteredRouterPair[1];
130
+ } ? TRouter : Router;
190
131
  interface LocationState {
191
132
  }
192
- interface ParsedLocation<TSearchObj extends AnySearchSchema = {}, TState extends LocationState = LocationState> {
133
+ interface ParsedLocation<TSearchObj extends AnySearchSchema = {}> {
193
134
  href: string;
194
135
  pathname: string;
195
136
  search: TSearchObj;
196
137
  searchStr: string;
197
- state: TState;
138
+ state: LocationState;
198
139
  hash: string;
199
140
  key?: string;
200
141
  }
@@ -210,7 +151,7 @@ type HydrationCtx = {
210
151
  router: DehydratedRouter;
211
152
  payload: Record<string, any>;
212
153
  };
213
- interface RouteMatch<TRoutesInfo extends AnyRoutesInfo = DefaultRoutesInfo, TRoute extends AnyRoute = Route> {
154
+ interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRoute extends AnyRoute = Route> {
214
155
  id: string;
215
156
  key?: string;
216
157
  routeId: string;
@@ -231,11 +172,11 @@ interface RouteMatch<TRoutesInfo extends AnyRoutesInfo = DefaultRoutesInfo, TRou
231
172
  routeContext: TRoute['__types']['routeContext'];
232
173
  context: TRoute['__types']['context'];
233
174
  routeSearch: TRoute['__types']['searchSchema'];
234
- search: TRoutesInfo['fullSearchSchema'] & TRoute['__types']['fullSearchSchema'];
175
+ search: FullSearchSchema<TRouteTree> & TRoute['__types']['fullSearchSchema'];
235
176
  fetchedAt: number;
236
177
  abortController: AbortController;
237
178
  }
238
- type AnyRouteMatch = RouteMatch<AnyRoutesInfo, AnyRoute>;
179
+ type AnyRouteMatch = RouteMatch<AnyRoute, AnyRoute>;
239
180
  type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends TRouteTree['__types']['routerContext'] ? {
240
181
  context?: TRouteTree['__types']['routerContext'];
241
182
  } : {
@@ -269,16 +210,16 @@ interface RouterOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<
269
210
  dehydrate?: () => TDehydrated;
270
211
  hydrate?: (dehydrated: TDehydrated) => void;
271
212
  }
272
- interface RouterState<TRoutesInfo extends AnyRoutesInfo = AnyRoutesInfo, TState extends LocationState = LocationState> {
213
+ interface RouterState<TRouteTree extends AnyRoute = AnyRoute> {
273
214
  status: 'idle' | 'pending';
274
215
  isFetching: boolean;
275
- matchesById: Record<string, RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>>;
216
+ matchesById: Record<string, RouteMatch<any, any>>;
276
217
  matchIds: string[];
277
218
  pendingMatchIds: string[];
278
- matches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
279
- pendingMatches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
280
- location: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
281
- resolvedLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
219
+ matches: RouteMatch<any, any>[];
220
+ pendingMatches: RouteMatch<any, any>[];
221
+ location: ParsedLocation<FullSearchSchema<TRouteTree>>;
222
+ resolvedLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
282
223
  lastUpdated: number;
283
224
  }
284
225
  type ListenerFn = () => void;
@@ -313,24 +254,23 @@ interface DehydratedRouter {
313
254
  }
314
255
  type RouterConstructorOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TDehydrated>, 'context'> & RouterContextOptions<TRouteTree>;
315
256
  declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent"];
316
- declare class Router<TRouteTree extends AnyRoute = AnyRoute, TRoutesInfo extends AnyRoutesInfo = RoutesInfo<TRouteTree>, TDehydrated extends Record<string, any> = Record<string, any>> {
257
+ declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated extends Record<string, any> = Record<string, any>> {
317
258
  #private;
318
259
  types: {
319
260
  RootRoute: TRouteTree;
320
- RoutesInfo: TRoutesInfo;
321
261
  };
322
262
  options: PickAsRequired<RouterOptions<TRouteTree, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
323
263
  history: RouterHistory;
324
264
  basepath: string;
325
- routeTree: RootRoute;
326
- routesById: RoutesById<TRoutesInfo>;
327
- routesByPath: RoutesByPath<TRoutesInfo>;
328
- flatRoutes: TRoutesInfo['routesByFullPath'][keyof TRoutesInfo['routesByFullPath']][];
265
+ routeTree: TRouteTree;
266
+ routesById: RoutesById<TRouteTree>;
267
+ routesByPath: RoutesByPath<TRouteTree>;
268
+ flatRoutes: ParseRoute<TRouteTree>[];
329
269
  navigateTimeout: undefined | Timeout;
330
270
  nextAction: undefined | 'push' | 'replace';
331
271
  navigationPromise: undefined | Promise<void>;
332
- __store: Store<RouterState<TRoutesInfo>>;
333
- state: RouterState<TRoutesInfo>;
272
+ __store: Store<RouterState<TRouteTree>>;
273
+ state: RouterState<TRouteTree>;
334
274
  dehydratedData?: TDehydrated;
335
275
  constructor(options: RouterConstructorOptions<TRouteTree, TDehydrated>);
336
276
  reset: () => void;
@@ -347,32 +287,32 @@ declare class Router<TRouteTree extends AnyRoute = AnyRoute, TRoutesInfo extends
347
287
  next?: ParsedLocation;
348
288
  throwOnError?: boolean;
349
289
  }) => Promise<void>;
350
- getRoute: <TId extends keyof TRoutesInfo["routesById"]>(id: TId) => TRoutesInfo["routesById"][TId];
290
+ getRoute: (id: string) => Route;
351
291
  preloadRoute: (navigateOpts?: BuildNextOptions & {
352
292
  maxAge?: number;
353
- }) => Promise<RouteMatch<TRoutesInfo, TRoutesInfo["routeIntersection"]>[]>;
293
+ }) => Promise<RouteMatch<TRouteTree, ParseRoute<TRouteTree>>[]>;
354
294
  cleanMatches: () => void;
355
295
  matchRoutes: (pathname: string, locationSearch: AnySearchSchema, opts?: {
356
296
  throwOnError?: boolean;
357
297
  debug?: boolean;
358
- }) => RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
298
+ }) => RouteMatch<TRouteTree, ParseRoute<TRouteTree>>[];
359
299
  loadMatches: (resolvedMatches: AnyRouteMatch[], opts?: {
360
300
  preload?: boolean;
361
301
  maxAge?: number;
362
302
  }) => Promise<void>;
363
303
  reload: () => Promise<void>;
364
304
  resolvePath: (from: string, path: string) => string;
365
- navigate: <TFrom extends string = "/", TTo extends string = "">({ from, to, search, hash, replace, params, }: NavigateOptions<TRoutesInfo, TFrom, TTo>) => Promise<void>;
366
- matchRoute: <TFrom extends string = "/", TTo extends string = "", TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRoutesInfo, TFrom, TTo, ResolveRelativePath<TFrom, NoInfer<TTo>>>, opts?: MatchRouteOptions) => false | TRoutesInfo["routesById"][TResolved]["__types"]["allParams"];
367
- buildLink: <TFrom extends string = "/", TTo extends string = "">({ from, to, search, params, hash, target, replace, activeOptions, preload, preloadDelay: userPreloadDelay, disabled, }: LinkOptions<TRoutesInfo, TFrom, TTo>) => LinkInfo;
305
+ navigate: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "">({ from, to, search, hash, replace, params, }: NavigateOptions<TRouteTree, TFrom, TTo>) => Promise<void>;
306
+ matchRoute: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "", TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRouteTree, TFrom, TTo, ResolveRelativePath<TFrom, NoInfer<TTo>>>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>["__types"]["allParams"];
307
+ buildLink: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "">({ from, to, search, params, hash, target, replace, activeOptions, preload, preloadDelay: userPreloadDelay, disabled, }: LinkOptions<TRouteTree, TFrom, TTo>) => LinkInfo;
368
308
  dehydrate: () => DehydratedRouter;
369
309
  hydrate: (__do_not_use_server_ctx?: HydrationCtx) => Promise<void>;
370
310
  injectedHtml: (string | (() => Promise<string> | string))[];
371
311
  injectHtml: (html: string | (() => Promise<string> | string)) => Promise<void>;
372
312
  dehydrateData: <T>(key: any, getData: T | (() => T | Promise<T>)) => () => T | undefined;
373
313
  hydrateData: <T = unknown>(key: any) => T | undefined;
374
- getRouteMatch: (id: string) => undefined | RouteMatch<TRoutesInfo, AnyRoute>;
375
- setRouteMatch: (id: string, updater: (prev: RouteMatch<TRoutesInfo, AnyRoute>) => RouteMatch<TRoutesInfo, AnyRoute>) => void;
314
+ getRouteMatch: (id: string) => undefined | RouteMatch<TRouteTree, AnyRoute>;
315
+ setRouteMatch: (id: string, updater: (prev: RouteMatch<TRouteTree, AnyRoute>) => RouteMatch<TRouteTree, AnyRoute>) => void;
376
316
  setRouteMatchData: (id: string, updater: (prev: any) => any, opts?: {
377
317
  updatedAt?: number;
378
318
  maxAge?: number;
@@ -387,10 +327,10 @@ declare class Router<TRouteTree extends AnyRoute = AnyRoute, TRoutesInfo extends
387
327
  }) => boolean;
388
328
  }
389
329
  type AnyRedirect = Redirect<any, any, any>;
390
- type Redirect<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = NavigateOptions<TRoutesInfo, TFrom, TTo> & {
330
+ type Redirect<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = NavigateOptions<TRouteTree, TFrom, TTo> & {
391
331
  code?: number;
392
332
  };
393
- declare function redirect<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''>(opts: Redirect<TRoutesInfo, TFrom, TTo>): Redirect<TRoutesInfo, TFrom, TTo>;
333
+ declare function redirect<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''>(opts: Redirect<TRouteTree, TFrom, TTo>): Redirect<TRouteTree, TFrom, TTo>;
394
334
  declare function isRedirect(obj: any): obj is AnyRedirect;
395
335
  declare class SearchParamError extends Error {
396
336
  }
@@ -432,11 +372,11 @@ type MetaOptions = keyof PickRequired<RouteMeta> extends never ? {
432
372
  meta: RouteMeta;
433
373
  };
434
374
  type AnyRouteProps = RouteProps<any, any, any, any, any>;
435
- type ComponentPropsFromRoute<TRoute> = TRoute extends Route<infer TParentRoute, infer TPath, infer TFullPath, infer TCustomId, infer TId, infer TLoader, infer TSearchSchema, infer TFullSearchSchema, infer TParams, infer TAllParams, infer TParentContext, infer TAllParentContext, infer TRouteContext, infer TContext, infer TRouterContext, infer TChildren, infer TRoutesInfo> ? RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext> : never;
375
+ type ComponentPropsFromRoute<TRoute> = TRoute extends Route<infer TParentRoute, infer TPath, infer TFullPath, infer TCustomId, infer TId, infer TLoader, infer TSearchSchema, infer TFullSearchSchema, infer TParams, infer TAllParams, infer TParentContext, infer TAllParentContext, infer TRouteContext, infer TContext, infer TRouterContext, infer TChildren, infer TRouteTree> ? RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext> : never;
436
376
  type ComponentFromRoute<TRoute> = RegisteredRouteComponent<ComponentPropsFromRoute<TRoute>>;
437
377
  type RouteLoaderFromRoute<TRoute extends AnyRoute> = LoaderFn<TRoute['__types']['loader'], TRoute['__types']['searchSchema'], TRoute['__types']['fullSearchSchema'], TRoute['__types']['allParams'], TRoute['__types']['routeContext'], TRoute['__types']['context']>;
438
- type RouteProps<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams = AnyPathParams, TRouteContext = AnyContext, TContext = AnyContext> = {
439
- useMatch: () => RouteMatch<AnyRoutesInfo, AnyRoute>;
378
+ type RouteProps<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TContext extends AnyContext = AnyContext> = {
379
+ useMatch: () => RouteMatch<any, any>;
440
380
  useLoader: () => UseLoaderResult<TLoader>;
441
381
  useSearch: <TStrict extends boolean = true, TSearch = TFullSearchSchema, TSelected = TSearch>(opts?: {
442
382
  strict?: TStrict;
@@ -563,7 +503,6 @@ type InferFullSearchSchema<TRoute> = TRoute extends {
563
503
  type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = InferFullSearchSchema<TParentRoute> & TSearchSchema;
564
504
  interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
565
505
  }
566
- type AnyRouteWithRouterContext<TRouterContext extends AnyContext> = Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, TRouterContext, any, any>;
567
506
  type MergeParamsFromParent<T, U> = IsAny<T, U, T & U>;
568
507
  type UseLoaderResult<T> = T extends Record<PropertyKey, infer U> ? {
569
508
  [K in keyof T]: UseLoaderResultPromise<T[K]>;
@@ -591,9 +530,9 @@ type RouteConstraints = {
591
530
  TContext: AnyContext;
592
531
  TRouterContext: AnyContext;
593
532
  TChildren: unknown;
594
- TRoutesInfo: DefaultRoutesInfo;
533
+ TRouteTree: AnyRoute;
595
534
  };
596
- declare class Route<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>, TLoader = unknown, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Record<ParsePathParams<TPath>, string>, TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams>, TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['__types']['routeContext'], TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['__types']['context'], TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TContext extends RouteConstraints['TContext'] = MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TChildren extends RouteConstraints['TChildren'] = unknown, TRoutesInfo extends RouteConstraints['TRoutesInfo'] = DefaultRoutesInfo> {
535
+ declare class Route<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>, TLoader = unknown, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Record<ParsePathParams<TPath>, string>, TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams>, TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['__types']['routeContext'], TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['__types']['context'], TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TContext extends RouteConstraints['TContext'] = MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> {
597
536
  __types: {
598
537
  parentRoute: TParentRoute;
599
538
  path: TPath;
@@ -611,7 +550,7 @@ declare class Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyR
611
550
  routeContext: TRouteContext;
612
551
  context: TContext;
613
552
  children: TChildren;
614
- routesInfo: TRoutesInfo;
553
+ routeTree: TRouteTree;
615
554
  routerContext: TRouterContext;
616
555
  };
617
556
  isRoot: TParentRoute extends Route<any> ? true : false;
@@ -623,21 +562,21 @@ declare class Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyR
623
562
  to: TrimPathRight<TFullPath>;
624
563
  children?: TChildren;
625
564
  originalIndex?: number;
626
- router?: Router<TRoutesInfo['routeTree'], TRoutesInfo>;
565
+ router?: AnyRouter;
627
566
  rank: number;
628
567
  constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>);
629
568
  init: (opts: {
630
569
  originalIndex: number;
631
570
  router: AnyRouter;
632
571
  }) => void;
633
- addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TNewChildren, TRoutesInfo>;
572
+ addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TNewChildren, TRouteTree>;
634
573
  update: (options: UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => this;
635
574
  static __onInit: (route: typeof this$1) => void;
636
575
  }
637
576
  type AnyRootRoute = RootRoute<any, any, any, any>;
638
577
  declare class RouterContext<TRouterContext extends {}> {
639
578
  constructor();
640
- createRootRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", {}, TSearchSchema, {}, {}, AnyPathParams, AnyPathParams, AnyContext, AnyContext, RouteContext, AnyContext>, "caseSensitive" | "path" | "getParentRoute" | "stringifyParams" | "parseParams" | "id"> | undefined) => RootRoute<TLoader, TSearchSchema, TContext, TRouterContext>;
579
+ createRootRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", {}, TSearchSchema, {}, {}, AnyPathParams, AnyPathParams, AnyContext, AnyContext, RouteContext, AnyContext>, "caseSensitive" | "id" | "path" | "getParentRoute" | "stringifyParams" | "parseParams"> | undefined) => RootRoute<TLoader, TSearchSchema, TContext, TRouterContext>;
641
580
  }
642
581
  declare class RootRoute<TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext, TRouterContext extends {} = {}> extends Route<any, '/', '/', string, RootRouteId, TLoader, TSearchSchema, TSearchSchema, {}, {}, TRouterContext, TRouterContext, MergeParamsFromParent<TRouterContext, TContext>, MergeParamsFromParent<TRouterContext, TContext>, TRouterContext, any, any> {
643
582
  constructor(options?: Omit<RouteOptions<AnyRoute, RootRouteId, '', TLoader, TSearchSchema, {}>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>);
@@ -654,12 +593,13 @@ type Replace<S extends string, From extends string, To extends string> = S exten
654
593
  type TrimLeft<T extends string, S extends string> = T extends `${S}${infer U}` ? U : T;
655
594
  type TrimRight<T extends string, S extends string> = T extends `${infer U}${S}` ? U : T;
656
595
  type Trim<T extends string, S extends string> = TrimLeft<TrimRight<T, S>, S>;
596
+ type RemoveUnderScores<T extends string> = Replace<Replace<TrimRight<TrimLeft<T, '/_'>, '_'>, '_/', '/'>, '/_', '/'>;
657
597
  type ResolveFilePath<TParentRoute extends AnyRoute, TFilePath extends string> = TParentRoute['id'] extends RootRouteId ? TrimPathLeft<TFilePath> : Replace<TrimPathLeft<TFilePath>, TrimPathLeft<TParentRoute['__types']['customId']>, ''>;
658
598
  type FileRoutePath<TParentRoute extends AnyRoute, TFilePath extends string> = ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}` ? string : ResolveFilePath<TParentRoute, TFilePath>;
659
- declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends string = TFilePath, TPath extends string = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends string = ResolveFullPath<TParentRoute, TPath>> {
599
+ declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = TFilePath, TPath extends RouteConstraints['TPath'] = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, RemoveUnderScores<TPath>>> {
660
600
  path: TFilePath;
661
601
  constructor(path: TFilePath);
662
- createRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends (TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never) extends never ? AnyPathParams : Record<TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never, any> = (TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never) extends never ? AnyPathParams : Record<TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T_1 ? T_1 extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T_1 extends `$${infer L}` ? L : never : never : never, string>, TAllParams extends IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams> = IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams>, TParentContext extends TParentRoute["__types"]["routeContext"] = TParentRoute["__types"]["routeContext"], TAllParentContext extends TParentRoute["__types"]["context"] = TParentRoute["__types"]["context"], TRouteContext extends RouteContext = RouteContext, TContext extends IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext> = IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRoutesInfo extends DefaultRoutesInfo = DefaultRoutesInfo>(options: Omit<RouteOptions<TParentRoute, string, string, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext>, "path" | "getParentRoute" | "id"> & {
602
+ createRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<string, any> = (TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T ? T extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T extends `$${infer L}` ? L : never : never : never) extends never ? AnyPathParams : Record<TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> extends infer T ? T extends TrimLeft<TrimRight<Split<TPath, true>[number], "_">, "_"> ? T extends `$${infer L}` ? L : never : never : never, string>, TAllParams extends Record<string, any> = IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams>, TParentContext extends AnyContext = TParentRoute["__types"]["routeContext"], TAllParentContext extends string = TParentRoute["__types"]["context"], TRouteContext extends RouteContext = RouteContext, TContext extends AnyContext = IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options: Omit<RouteOptions<TParentRoute, string, string, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext>, "id" | "path" | "getParentRoute"> & {
663
603
  meta?: RouteMeta | undefined;
664
604
  } & {
665
605
  key?: false | GetKeyFn<TFullSearchSchema, TAllParams> | null | undefined;
@@ -692,7 +632,7 @@ declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute e
692
632
  params: TAllParams;
693
633
  search: TFullSearchSchema;
694
634
  }) => void) | undefined;
695
- }) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TChildren, TRoutesInfo>;
635
+ }) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TChildren, TRouteTree>;
696
636
  }
697
637
 
698
638
  type LinkInfo = {
@@ -729,16 +669,16 @@ type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, T
729
669
  ] ? `${TTo}${Join<RestPath>}` : never : (TFrom extends `/` ? never : SplitPaths extends [...Split<TFrom, false>, ...infer RestPath] ? Join<RestPath> extends {
730
670
  length: 0;
731
671
  } ? never : './' : never) | (TFrom extends `/` ? never : '../') | AllPaths;
732
- type NavigateOptions<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = ToOptions<TRoutesInfo, TFrom, TTo> & {
672
+ type NavigateOptions<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = ToOptions<TRouteTree, TFrom, TTo> & {
733
673
  replace?: boolean;
734
674
  };
735
- type ToOptions<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = '', TResolvedTo = ResolveRelativePath<TFrom, NoInfer<TTo>>> = {
736
- to?: ToPathOption<TRoutesInfo, TFrom, TTo>;
675
+ type ToOptions<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TResolvedTo = ResolveRelativePath<TFrom, NoInfer<TTo>>> = {
676
+ to?: ToPathOption<TRouteTree, TFrom, TTo>;
737
677
  hash?: Updater<string>;
738
678
  state?: LocationState;
739
679
  from?: TFrom;
740
- } & CheckPath<TRoutesInfo, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TRoutesInfo, TFrom, TResolvedTo> & PathParamOptions<TRoutesInfo, TFrom, TResolvedTo>;
741
- type SearchParamOptions<TRoutesInfo extends AnyRoutesInfo, TFrom, TTo, TFromSchema = UnionToIntersection<TRoutesInfo['fullSearchSchema'] & RouteByPath<TRoutesInfo, TFrom> extends never ? {} : RouteByPath<TRoutesInfo, TFrom>['__types']['fullSearchSchema']>, TToSchema = Partial<RouteByPath<TRoutesInfo, TFrom>['__types']['fullSearchSchema']> & Omit<RouteByPath<TRoutesInfo, TTo>['__types']['fullSearchSchema'], keyof PickRequired<RouteByPath<TRoutesInfo, TFrom>['__types']['fullSearchSchema']>>, TFromFullSchema = UnionToIntersection<TRoutesInfo['fullSearchSchema'] & TFromSchema>, TToFullSchema = UnionToIntersection<TRoutesInfo['fullSearchSchema'] & TToSchema>> = keyof PickRequired<TToSchema> extends never ? {
680
+ } & CheckPath<TRouteTree, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TRouteTree, TFrom, TResolvedTo> & PathParamOptions<TRouteTree, TFrom, TResolvedTo>;
681
+ type SearchParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TFromSchema = UnionToIntersection<FullSearchSchema<TRouteTree> & RouteByPath<TRouteTree, TFrom> extends never ? {} : RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']>, TToSchema = Partial<RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']> & Omit<RouteByPath<TRouteTree, TTo>['__types']['fullSearchSchema'], keyof PickRequired<RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']>>, TFromFullSchema = UnionToIntersection<FullSearchSchema<TRouteTree> & TFromSchema>, TToFullSchema = UnionToIntersection<FullSearchSchema<TRouteTree> & TToSchema>> = keyof PickRequired<TToSchema> extends never ? {
742
682
  search?: true | SearchReducer<TFromFullSchema, TToFullSchema>;
743
683
  } : {
744
684
  search: SearchReducer<TFromFullSchema, TToFullSchema>;
@@ -746,38 +686,38 @@ type SearchParamOptions<TRoutesInfo extends AnyRoutesInfo, TFrom, TTo, TFromSche
746
686
  type SearchReducer<TFrom, TTo> = {
747
687
  [TKey in keyof TTo]: TTo[TKey];
748
688
  } | ((current: TFrom) => TTo);
749
- type PathParamOptions<TRoutesInfo extends AnyRoutesInfo, TFrom, TTo, TFromSchema = UnionToIntersection<RouteByPath<TRoutesInfo, TFrom> extends never ? {} : RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']>, TToSchema = Partial<RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']> & Omit<RouteByPath<TRoutesInfo, TTo>['__types']['allParams'], keyof PickRequired<RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']>>, TFromFullParams = UnionToIntersection<TRoutesInfo['allParams'] & TFromSchema>, TToFullParams = UnionToIntersection<TRoutesInfo['allParams'] & TToSchema>> = keyof PickRequired<TToSchema> extends never ? {
689
+ type PathParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TFromSchema = UnionToIntersection<RouteByPath<TRouteTree, TFrom> extends never ? {} : RouteByPath<TRouteTree, TFrom>['__types']['allParams']>, TToSchema = Partial<RouteByPath<TRouteTree, TFrom>['__types']['allParams']> & Omit<RouteByPath<TRouteTree, TTo>['__types']['allParams'], keyof PickRequired<RouteByPath<TRouteTree, TFrom>['__types']['allParams']>>, TFromFullParams = UnionToIntersection<AllParams<TRouteTree> & TFromSchema>, TToFullParams = UnionToIntersection<AllParams<TRouteTree> & TToSchema>> = keyof PickRequired<TToSchema> extends never ? {
750
690
  params?: ParamsReducer<TFromFullParams, TToFullParams>;
751
691
  } : {
752
692
  params: ParamsReducer<TFromFullParams, TToFullParams>;
753
693
  };
754
694
  type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
755
- type ToPathOption<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<TRoutesInfo['routePaths'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
756
- type ToIdOption<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<TRoutesInfo['routeIds'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
695
+ type ToPathOption<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<RoutePaths<TRouteTree>, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
696
+ type ToIdOption<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<RouteIds<TRouteTree>, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
757
697
  interface ActiveOptions {
758
698
  exact?: boolean;
759
699
  includeHash?: boolean;
760
700
  includeSearch?: boolean;
761
701
  }
762
- type LinkOptions<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = NavigateOptions<TRoutesInfo, TFrom, TTo> & {
702
+ type LinkOptions<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = NavigateOptions<TRouteTree, TFrom, TTo> & {
763
703
  target?: HTMLAnchorElement['target'];
764
704
  activeOptions?: ActiveOptions;
765
705
  preload?: false | 'intent';
766
706
  preloadDelay?: number;
767
707
  disabled?: boolean;
768
708
  };
769
- type CheckRelativePath<TRoutesInfo extends AnyRoutesInfo, TFrom, TTo> = TTo extends string ? TFrom extends string ? ResolveRelativePath<TFrom, TTo> extends TRoutesInfo['routePaths'] ? {} : {
709
+ type CheckRelativePath<TRouteTree extends AnyRoute, TFrom, TTo> = TTo extends string ? TFrom extends string ? ResolveRelativePath<TFrom, TTo> extends RoutePaths<TRouteTree> ? {} : {
770
710
  Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<TFrom, TTo>}, which is not a valid route path.`;
771
- 'Valid Route Paths': TRoutesInfo['routePaths'];
711
+ 'Valid Route Paths': RoutePaths<TRouteTree>;
772
712
  } : {} : {};
773
- type CheckPath<TRoutesInfo extends AnyRoutesInfo, TPath, TPass> = Exclude<TPath, TRoutesInfo['routePaths']> extends never ? TPass : CheckPathError<TRoutesInfo, Exclude<TPath, TRoutesInfo['routePaths']>>;
774
- type CheckPathError<TRoutesInfo extends AnyRoutesInfo, TInvalids> = {
775
- to: TRoutesInfo['routePaths'];
713
+ type CheckPath<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<TPath, RoutePaths<TRouteTree>> extends never ? TPass : CheckPathError<TRouteTree, Exclude<TPath, RoutePaths<TRouteTree>>>;
714
+ type CheckPathError<TRouteTree extends AnyRoute, TInvalids> = {
715
+ to: RoutePaths<TRouteTree>;
776
716
  };
777
- type CheckId<TRoutesInfo extends AnyRoutesInfo, TPath, TPass> = Exclude<TPath, TRoutesInfo['routeIds']> extends never ? TPass : CheckIdError<TRoutesInfo, Exclude<TPath, TRoutesInfo['routeIds']>>;
778
- type CheckIdError<TRoutesInfo extends AnyRoutesInfo, TInvalids> = {
717
+ type CheckId<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<TPath, RouteIds<TRouteTree>> extends never ? TPass : CheckIdError<TRouteTree, Exclude<TPath, RouteIds<TRouteTree>>>;
718
+ type CheckIdError<TRouteTree extends AnyRoute, TInvalids> = {
779
719
  Error: `${TInvalids extends string ? TInvalids : never} is not a valid route ID.`;
780
- 'Valid Route IDs': TRoutesInfo['routeIds'];
720
+ 'Valid Route IDs': RouteIds<TRouteTree>;
781
721
  };
782
722
  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;
783
723
 
@@ -804,4 +744,4 @@ declare const defaultStringifySearch: (search: Record<string, any>) => string;
804
744
  declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
805
745
  declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
806
746
 
807
- export { ActiveOptions, AnyContext, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouteProps, AnyRouteWithRouterContext, AnyRouter, AnyRoutesInfo, AnySearchSchema, BaseRouteOptions, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, CleanPath, ComponentFromRoute, ComponentPropsFromRoute, DeepAwaited, DefaultRoutesInfo, DefinedPathParamWarning, DehydratedRouter, DehydratedRouterState, Expand, FileRoute, FileRoutePath, FileRoutesByPath, FromLocation, GetKeyFn, HydrationCtx, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, Join, Last, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderFn, LocationState, MatchLocation, MatchRouteOptions, MergeParamsFromParent, MergeUnion, MetaOptions, NavigateOptions, NoInfer, ParamsFallback, ParentParams, ParseParamsFn, ParseParamsObj, ParseParamsOption, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamError, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, PreloadableObj, Redirect, Register, RegisterRouteComponent, RegisterRouteErrorComponent, RegisteredRouteComponent, RegisteredRouteErrorComponent, RegisteredRouter, RegisteredRouterPair, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFilePath, ResolveFullPath, ResolveFullSearchSchema, ResolveId, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteConstraints, RouteContext, RouteLoaderFromRoute, RouteMatch, RouteMeta, RouteOptions, RoutePathOptions, RoutePathOptionsIntersection, RouteProps, Router, RouterConstructorOptions, RouterContext, RouterContextOptions, RouterHistory, RouterLocation, RouterOptions, RouterState, RoutesById, RoutesByPath, RoutesInfo, RoutesInfoInner, SearchFilter, SearchParamError, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, StreamedPromise, Timeout, ToIdOption, ToOptions, ToPathOption, Trim, TrimLeft, TrimPath, TrimPathLeft, TrimPathRight, TrimRight, UnionToIntersection, UnloaderFn, UpdatableRouteOptions, Updater, UseLoaderResult, UseLoaderResultPromise, ValueKeys, Values, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight };
747
+ export { ActiveOptions, AllParams, AnyContext, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouteProps, AnyRouter, AnySearchSchema, BaseRouteOptions, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, CleanPath, ComponentFromRoute, ComponentPropsFromRoute, DeepAwaited, DefinedPathParamWarning, DehydratedRouter, DehydratedRouterState, Expand, FileRoute, FileRoutePath, FileRoutesByPath, FromLocation, FullSearchSchema, GetKeyFn, HydrationCtx, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, Join, Last, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderFn, LocationState, MatchLocation, MatchRouteOptions, MergeParamsFromParent, MergeUnion, MetaOptions, NavigateOptions, NoInfer, ParamsFallback, ParentParams, ParseParamsFn, ParseParamsObj, ParseParamsOption, ParsePathParams, ParseRoute, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamError, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, PreloadableObj, Redirect, Register, RegisterRouteComponent, RegisterRouteErrorComponent, RegisteredRouteComponent, RegisteredRouteErrorComponent, RegisteredRouter, RelativeToPathAutoComplete, RemoveUnderScores, ResolveFilePath, ResolveFullPath, ResolveFullSearchSchema, ResolveId, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteConstraints, RouteContext, RouteIds, RouteLoaderFromRoute, RouteMatch, RouteMeta, RouteOptions, RoutePathOptions, RoutePathOptionsIntersection, RoutePaths, RouteProps, Router, RouterConstructorOptions, RouterContext, RouterContextOptions, RouterHistory, RouterLocation, RouterOptions, RouterState, RoutesById, RoutesByPath, SearchFilter, SearchParamError, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, StreamedPromise, Timeout, ToIdOption, ToOptions, ToPathOption, Trim, TrimLeft, TrimPath, TrimPathLeft, TrimPathRight, TrimRight, UnionToIntersection, UnloaderFn, UpdatableRouteOptions, Updater, UseLoaderResult, UseLoaderResultPromise, ValueKeys, Values, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight };
@@ -1525,11 +1525,12 @@
1525
1525
  const ctx = _ctx;
1526
1526
  this.dehydratedData = ctx.payload;
1527
1527
  this.options.hydrate?.(ctx.payload);
1528
+ const routerState = ctx.router.state;
1528
1529
  this.__store.setState(s => {
1529
1530
  return {
1530
1531
  ...s,
1531
- ...ctx.router.state,
1532
- resolvedLocation: ctx.router.state.location
1532
+ ...routerState,
1533
+ resolvedLocation: routerState.location
1533
1534
  };
1534
1535
  });
1535
1536
  await this.load();