@tanstack/router-core 0.0.1-beta.30 → 0.0.1-beta.33

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.
@@ -16,63 +16,6 @@ interface FrameworkGenerics {
16
16
  }
17
17
  type GetFrameworkGeneric<U> = U extends keyof FrameworkGenerics ? FrameworkGenerics[U] : any;
18
18
 
19
- interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
20
- matchId: string;
21
- pathname: string;
22
- params: TRouteInfo['allParams'];
23
- parentMatch?: RouteMatch;
24
- childMatches: RouteMatch[];
25
- routeSearch: TRouteInfo['searchSchema'];
26
- search: TRouteInfo['fullSearchSchema'];
27
- status: 'idle' | 'loading' | 'success' | 'error';
28
- updatedAt?: number;
29
- error?: unknown;
30
- isInvalid: boolean;
31
- getIsInvalid: () => boolean;
32
- loaderData: TRouteInfo['loaderData'];
33
- routeLoaderData: TRouteInfo['routeLoaderData'];
34
- isFetching: boolean;
35
- invalidAt: number;
36
- __: {
37
- component?: GetFrameworkGeneric<'Component'>;
38
- errorComponent?: GetFrameworkGeneric<'ErrorComponent'>;
39
- pendingComponent?: GetFrameworkGeneric<'Component'>;
40
- loadPromise?: Promise<void>;
41
- componentsPromise?: Promise<void>;
42
- dataPromise?: Promise<TRouteInfo['routeLoaderData']>;
43
- onExit?: void | ((matchContext: {
44
- params: TRouteInfo['allParams'];
45
- search: TRouteInfo['fullSearchSchema'];
46
- }) => void);
47
- abortController: AbortController;
48
- latestId: string;
49
- validate: () => void;
50
- notify: () => void;
51
- resolve: () => void;
52
- };
53
- cancel: () => void;
54
- load: (loaderOpts?: {
55
- preload: true;
56
- maxAge: number;
57
- gcMaxAge: number;
58
- } | {
59
- preload?: false;
60
- maxAge?: never;
61
- gcMaxAge?: never;
62
- }) => Promise<TRouteInfo['routeLoaderData']>;
63
- fetch: (opts?: {
64
- maxAge?: number;
65
- }) => Promise<TRouteInfo['routeLoaderData']>;
66
- invalidate: () => void;
67
- hasLoaders: () => boolean;
68
- }
69
- declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
70
- parentMatch?: RouteMatch<any, any>;
71
- matchId: string;
72
- params: TRouteInfo['allParams'];
73
- pathname: string;
74
- }): RouteMatch<TAllRouteInfo, TRouteInfo>;
75
-
76
19
  type NoInfer<T> = [T][T extends any ? 0 : never];
77
20
  type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N;
78
21
  type IsAnyBoolean<T> = 1 extends 0 & T ? true : false;
@@ -228,7 +171,7 @@ type Listener = (router: Router<any, any, any>) => void;
228
171
  type ListenerFn = () => void;
229
172
  interface BuildNextOptions {
230
173
  to?: string | number | null;
231
- params?: true | Updater<Record<string, any>>;
174
+ params?: true | Updater<unknown>;
232
175
  search?: true | Updater<unknown>;
233
176
  hash?: true | Updater<string>;
234
177
  state?: LocationState;
@@ -250,14 +193,15 @@ interface MatchLocation {
250
193
  fromCurrent?: boolean;
251
194
  }
252
195
  interface MatchRouteOptions {
253
- pending: boolean;
196
+ pending?: boolean;
254
197
  caseSensitive?: boolean;
198
+ fuzzy?: boolean;
255
199
  }
256
200
  interface DehydratedRouterState extends Pick<RouterState, 'status' | 'location' | 'lastUpdated' | 'location'> {
257
201
  matches: DehydratedRouteMatch[];
258
202
  }
259
203
  interface DehydratedRouter<TRouterContext = unknown> {
260
- location: Router['location'];
204
+ location: Router['__location'];
261
205
  state: DehydratedRouterState;
262
206
  context: TRouterContext;
263
207
  }
@@ -274,7 +218,7 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
274
218
  options: PickAsRequired<RouterOptions<TRouteConfig, TRouterContext>, 'stringifySearch' | 'parseSearch' | 'context'>;
275
219
  basepath: string;
276
220
  listeners: Listener[];
277
- location: Location<TAllRouteInfo['fullSearchSchema']>;
221
+ __location: Location<TAllRouteInfo['fullSearchSchema']>;
278
222
  navigateTimeout?: Timeout;
279
223
  nextAction?: 'push' | 'replace';
280
224
  state: RouterState<TAllRouteInfo['fullSearchSchema']>;
@@ -333,96 +277,62 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
333
277
  }
334
278
  declare function createRouter<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>, TRouterContext = unknown>(userOptions?: RouterOptions<TRouteConfig, TRouterContext>): Router<TRouteConfig, TAllRouteInfo, TRouterContext>;
335
279
 
336
- interface AnyRoute extends Route<any, any, any> {
337
- }
338
- interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo, TRouterContext = unknown> {
339
- routeInfo: TRouteInfo;
340
- routeId: TRouteInfo['id'];
341
- routeRouteId: TRouteInfo['routeId'];
342
- routePath: TRouteInfo['path'];
343
- fullPath: TRouteInfo['fullPath'];
344
- parentRoute?: AnyRoute;
345
- childRoutes?: AnyRoute[];
346
- options: RouteOptions;
347
- router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo, TRouterContext>;
348
- buildLink: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>) => LinkInfo;
349
- matchRoute: <TTo extends string = '.', TResolved extends string = ResolveRelativePath<TRouteInfo['id'], TTo>>(matchLocation: CheckRelativePath<TAllRouteInfo, TRouteInfo['fullPath'], NoInfer<TTo>> & Omit<ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>, opts?: MatchRouteOptions) => RouteInfoByPath<TAllRouteInfo, TResolved>['allParams'];
350
- navigate: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>) => Promise<void>;
351
- action: unknown extends TRouteInfo['actionResponse'] ? Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']> | undefined : Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']>;
352
- loader: unknown extends TRouteInfo['routeLoaderData'] ? Action<LoaderContext<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams']>, TRouteInfo['routeLoaderData']> | undefined : Loader<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams'], TRouteInfo['routeLoaderData']>;
353
- }
354
- declare function createRoute<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo, TRouterContext = unknown>(routeConfig: RouteConfig, options: TRouteInfo['options'], parent: undefined | Route<TAllRouteInfo, any>, router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo, TRouterContext>): Route<TAllRouteInfo, TRouteInfo, TRouterContext>;
355
-
356
- interface AnyAllRouteInfo {
357
- routeConfig: AnyRouteConfig;
358
- routeInfo: AnyRouteInfo;
359
- routeInfoById: Record<string, AnyRouteInfo>;
360
- routeInfoByFullPath: Record<string, AnyRouteInfo>;
361
- routeIds: any;
362
- routePaths: any;
363
- fullSearchSchema: Record<string, any>;
364
- }
365
- interface DefaultAllRouteInfo {
366
- routeConfig: RouteConfig;
367
- routeInfo: RouteInfo;
368
- routeInfoById: Record<string, RouteInfo>;
369
- routeInfoByFullPath: Record<string, RouteInfo>;
370
- routeIds: string;
371
- routePaths: string;
372
- fullSearchSchema: AnySearchSchema;
373
- }
374
- interface AllRouteInfo<TRouteConfig extends AnyRouteConfig = RouteConfig> extends RoutesInfoInner<TRouteConfig, ParseRouteConfig<TRouteConfig>> {
375
- }
376
- type ParseRouteConfig<TRouteConfig = AnyRouteConfig> = TRouteConfig extends AnyRouteConfig ? RouteConfigRoute<TRouteConfig> | ParseRouteChildren<TRouteConfig> : never;
377
- type ParseRouteChildren<TRouteConfig> = TRouteConfig extends AnyRouteConfigWithChildren<infer TChildren> ? unknown extends TChildren ? never : TChildren extends AnyRouteConfig[] ? Values<{
378
- [TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
379
- }> : never : never;
380
- type ParseRouteChild<TRouteConfig, TId> = TRouteConfig & {
381
- id: TId;
382
- } extends AnyRouteConfig ? ParseRouteConfig<TRouteConfig> : never;
383
- type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer TParentRouteLoaderData, infer TRouteLoaderData, infer TParentLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TRouteId ? never : RouteInfo<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
384
- interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
385
- '/': TRouteInfo;
386
- } & {
387
- [TInfo in TRouteInfo as TInfo['id']]: TInfo;
388
- }, TRouteInfoByFullPath = {
389
- '/': TRouteInfo;
390
- } & {
391
- [TInfo in TRouteInfo as TInfo['fullPath'] extends RootRouteId ? never : string extends TInfo['fullPath'] ? never : TInfo['fullPath']]: TInfo;
392
- }> {
393
- routeConfig: TRouteConfig;
394
- routeInfo: TRouteInfo;
395
- routeInfoById: TRouteInfoById;
396
- routeInfoByFullPath: TRouteInfoByFullPath;
397
- routeIds: keyof TRouteInfoById;
398
- routePaths: keyof TRouteInfoByFullPath;
399
- fullSearchSchema: Partial<UnionToIntersection<TRouteInfo['fullSearchSchema']>>;
400
- }
401
- interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
402
- }
403
- interface RouteInfo<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TParentLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends AnyPathParams = {}, TAllParams extends AnyPathParams = {}> {
404
- id: TId;
405
- routeId: TRouteId;
406
- path: TPath;
407
- fullPath: TFullPath;
408
- parentRouteLoaderData: TParentRouteLoaderData;
409
- routeLoaderData: TRouteLoaderData;
410
- parentLoaderData: TParentLoaderData;
411
- loaderData: TLoaderData;
412
- actionPayload: TActionPayload;
413
- actionResponse: TActionResponse;
414
- searchSchema: TSearchSchema;
415
- fullSearchSchema: TFullSearchSchema;
416
- parentParams: TParentParams;
417
- params: TParams;
418
- allParams: TAllParams;
419
- options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
280
+ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
281
+ matchId: string;
282
+ pathname: string;
283
+ params: TRouteInfo['allParams'];
284
+ parentMatch?: RouteMatch;
285
+ childMatches: RouteMatch[];
286
+ routeSearch: TRouteInfo['searchSchema'];
287
+ search: Expand<TAllRouteInfo['fullSearchSchema'] & TRouteInfo['fullSearchSchema']>;
288
+ status: 'idle' | 'loading' | 'success' | 'error';
289
+ updatedAt?: number;
290
+ error?: unknown;
291
+ isInvalid: boolean;
292
+ getIsInvalid: () => boolean;
293
+ loaderData: TRouteInfo['loaderData'];
294
+ routeLoaderData: TRouteInfo['routeLoaderData'];
295
+ isFetching: boolean;
296
+ invalidAt: number;
297
+ __: {
298
+ component?: GetFrameworkGeneric<'Component'>;
299
+ errorComponent?: GetFrameworkGeneric<'ErrorComponent'>;
300
+ pendingComponent?: GetFrameworkGeneric<'Component'>;
301
+ loadPromise?: Promise<void>;
302
+ componentsPromise?: Promise<void>;
303
+ dataPromise?: Promise<TRouteInfo['routeLoaderData']>;
304
+ onExit?: void | ((matchContext: {
305
+ params: TRouteInfo['allParams'];
306
+ search: TRouteInfo['fullSearchSchema'];
307
+ }) => void);
308
+ abortController: AbortController;
309
+ latestId: string;
310
+ validate: () => void;
311
+ notify: () => void;
312
+ resolve: () => void;
313
+ };
314
+ cancel: () => void;
315
+ load: (loaderOpts?: {
316
+ preload: true;
317
+ maxAge: number;
318
+ gcMaxAge: number;
319
+ } | {
320
+ preload?: false;
321
+ maxAge?: never;
322
+ gcMaxAge?: never;
323
+ }) => Promise<TRouteInfo['routeLoaderData']>;
324
+ fetch: (opts?: {
325
+ maxAge?: number;
326
+ }) => Promise<TRouteInfo['routeLoaderData']>;
327
+ invalidate: () => void;
328
+ hasLoaders: () => boolean;
420
329
  }
421
- type RoutesById<TAllRouteInfo extends AnyAllRouteInfo> = {
422
- [K in keyof TAllRouteInfo['routeInfoById']]: Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][K]>;
423
- };
424
- type RouteInfoById<TAllRouteInfo extends AnyAllRouteInfo, TId> = TId extends keyof TAllRouteInfo['routeInfoById'] ? IsAny<TAllRouteInfo['routeInfoById'][TId]['id'], RouteInfo, TAllRouteInfo['routeInfoById'][TId]> : never;
425
- type RouteInfoByPath<TAllRouteInfo extends AnyAllRouteInfo, TPath> = TPath extends keyof TAllRouteInfo['routeInfoByFullPath'] ? IsAny<TAllRouteInfo['routeInfoByFullPath'][TPath]['id'], RouteInfo, TAllRouteInfo['routeInfoByFullPath'][TPath]> : never;
330
+ declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
331
+ parentMatch?: RouteMatch<any, any>;
332
+ matchId: string;
333
+ params: TRouteInfo['allParams'];
334
+ pathname: string;
335
+ }): RouteMatch<TAllRouteInfo, TRouteInfo>;
426
336
 
427
337
  declare const rootRouteId: "__root__";
428
338
  type RootRouteId = typeof rootRouteId;
@@ -520,6 +430,100 @@ type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? Tr
520
430
  type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
521
431
  declare const createRouteConfig: CreateRouteConfigFn<true>;
522
432
 
433
+ interface AnyRoute extends Route<any, any, any> {
434
+ }
435
+ interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo, TRouterContext = unknown> {
436
+ routeInfo: TRouteInfo;
437
+ routeId: TRouteInfo['id'];
438
+ routeRouteId: TRouteInfo['routeId'];
439
+ routePath: TRouteInfo['path'];
440
+ fullPath: TRouteInfo['fullPath'];
441
+ parentRoute?: AnyRoute;
442
+ childRoutes?: AnyRoute[];
443
+ options: RouteOptions;
444
+ router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo, TRouterContext>;
445
+ buildLink: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>) => LinkInfo;
446
+ matchRoute: <TTo extends string = '.', TResolved extends string = ResolveRelativePath<TRouteInfo['id'], TTo>>(matchLocation: CheckRelativePath<TAllRouteInfo, TRouteInfo['fullPath'], NoInfer<TTo>> & Omit<ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>, opts?: MatchRouteOptions) => RouteInfoByPath<TAllRouteInfo, TResolved>['allParams'];
447
+ navigate: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>) => Promise<void>;
448
+ action: unknown extends TRouteInfo['actionResponse'] ? Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']> | undefined : Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']>;
449
+ loader: unknown extends TRouteInfo['routeLoaderData'] ? Action<LoaderContext<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams']>, TRouteInfo['routeLoaderData']> | undefined : Loader<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams'], TRouteInfo['routeLoaderData']>;
450
+ }
451
+ declare function createRoute<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo, TRouterContext = unknown>(routeConfig: RouteConfig, options: TRouteInfo['options'], parent: undefined | Route<TAllRouteInfo, any>, router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo, TRouterContext>): Route<TAllRouteInfo, TRouteInfo, TRouterContext>;
452
+
453
+ interface AnyAllRouteInfo {
454
+ routeConfig: AnyRouteConfig;
455
+ routeInfo: AnyRouteInfo;
456
+ routeInfoById: Record<string, AnyRouteInfo>;
457
+ routeInfoByFullPath: Record<string, AnyRouteInfo>;
458
+ routeIds: any;
459
+ routePaths: any;
460
+ fullSearchSchema: Record<string, any>;
461
+ allParams: Record<string, any>;
462
+ }
463
+ interface DefaultAllRouteInfo {
464
+ routeConfig: RouteConfig;
465
+ routeInfo: RouteInfo;
466
+ routeInfoById: Record<string, RouteInfo>;
467
+ routeInfoByFullPath: Record<string, RouteInfo>;
468
+ routeIds: string;
469
+ routePaths: string;
470
+ fullSearchSchema: AnySearchSchema;
471
+ allParams: AnyPathParams;
472
+ }
473
+ interface AllRouteInfo<TRouteConfig extends AnyRouteConfig = RouteConfig> extends RoutesInfoInner<TRouteConfig, ParseRouteConfig<TRouteConfig>> {
474
+ }
475
+ type ParseRouteConfig<TRouteConfig = AnyRouteConfig> = TRouteConfig extends AnyRouteConfig ? RouteConfigRoute<TRouteConfig> | ParseRouteChildren<TRouteConfig> : never;
476
+ type ParseRouteChildren<TRouteConfig> = TRouteConfig extends AnyRouteConfigWithChildren<infer TChildren> ? unknown extends TChildren ? never : TChildren extends AnyRouteConfig[] ? Values<{
477
+ [TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
478
+ }> : never : never;
479
+ type ParseRouteChild<TRouteConfig, TId> = TRouteConfig & {
480
+ id: TId;
481
+ } extends AnyRouteConfig ? ParseRouteConfig<TRouteConfig> : never;
482
+ type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer TParentRouteLoaderData, infer TRouteLoaderData, infer TParentLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TRouteId ? never : RouteInfo<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
483
+ interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
484
+ '/': TRouteInfo;
485
+ } & {
486
+ [TInfo in TRouteInfo as TInfo['id']]: TInfo;
487
+ }, TRouteInfoByFullPath = {
488
+ '/': TRouteInfo;
489
+ } & {
490
+ [TInfo in TRouteInfo as TInfo['fullPath'] extends RootRouteId ? never : string extends TInfo['fullPath'] ? never : TInfo['fullPath']]: TInfo;
491
+ }> {
492
+ routeConfig: TRouteConfig;
493
+ routeInfo: TRouteInfo;
494
+ routeInfoById: TRouteInfoById;
495
+ routeInfoByFullPath: TRouteInfoByFullPath;
496
+ routeIds: keyof TRouteInfoById;
497
+ routePaths: keyof TRouteInfoByFullPath;
498
+ fullSearchSchema: Partial<UnionToIntersection<TRouteInfo['fullSearchSchema']>>;
499
+ allParams: Partial<UnionToIntersection<TRouteInfo['allParams']>>;
500
+ }
501
+ interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
502
+ }
503
+ interface RouteInfo<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = '/', TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TParentLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends AnyPathParams = {}, TAllParams extends AnyPathParams = {}> {
504
+ id: TId;
505
+ routeId: TRouteId;
506
+ path: TPath;
507
+ fullPath: TFullPath;
508
+ parentRouteLoaderData: TParentRouteLoaderData;
509
+ routeLoaderData: TRouteLoaderData;
510
+ parentLoaderData: TParentLoaderData;
511
+ loaderData: TLoaderData;
512
+ actionPayload: TActionPayload;
513
+ actionResponse: TActionResponse;
514
+ searchSchema: TSearchSchema;
515
+ fullSearchSchema: TFullSearchSchema;
516
+ parentParams: TParentParams;
517
+ params: TParams;
518
+ allParams: TAllParams;
519
+ options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
520
+ }
521
+ type RoutesById<TAllRouteInfo extends AnyAllRouteInfo> = {
522
+ [K in keyof TAllRouteInfo['routeInfoById']]: Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][K]>;
523
+ };
524
+ type RouteInfoById<TAllRouteInfo extends AnyAllRouteInfo, TId> = TId extends keyof TAllRouteInfo['routeInfoById'] ? IsAny<TAllRouteInfo['routeInfoById'][TId]['id'], RouteInfo, TAllRouteInfo['routeInfoById'][TId]> : never;
525
+ type RouteInfoByPath<TAllRouteInfo extends AnyAllRouteInfo, TPath> = TPath extends keyof TAllRouteInfo['routeInfoByFullPath'] ? IsAny<TAllRouteInfo['routeInfoByFullPath'][TPath]['id'], RouteInfo, TAllRouteInfo['routeInfoByFullPath'][TPath]> : never;
526
+
523
527
  type LinkInfo = {
524
528
  type: 'external';
525
529
  href: string;
@@ -533,7 +537,6 @@ type LinkInfo = {
533
537
  isActive: boolean;
534
538
  disabled?: boolean;
535
539
  };
536
- type StartsWith<A, B> = A extends `${B extends string ? B : never}${infer _}` ? true : false;
537
540
  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;
538
541
  type Split<S, TIncludeTrailingSlash = true> = S extends unknown ? string extends S ? string[] : S extends string ? CleanPath<S> extends '' ? [] : TIncludeTrailingSlash extends true ? CleanPath<S> extends `${infer T}/` ? [...Split<T>, '/'] : CleanPath<S> extends `/${infer U}` ? Split<U> : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : [S] : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : S extends string ? [S] : never : never : never;
539
542
  type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends `$${infer V}` ? V : never : never;
@@ -558,22 +561,18 @@ type ToOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFro
558
561
  state?: LocationState;
559
562
  from?: TFrom;
560
563
  } & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
561
- type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema'], TToSchema = RouteInfoByPath<TAllRouteInfo, TTo>['fullSearchSchema']> = StartsWith<TFrom, TTo> extends true ? {
562
- search?: SearchReducer<TFromSchema, TToSchema>;
563
- } : keyof PickRequired<TToSchema> extends never ? {
564
- search?: SearchReducer<TFromSchema, TToSchema>;
564
+ type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = Expand<UnionToIntersection<TAllRouteInfo['fullSearchSchema'] & RouteInfoByPath<TAllRouteInfo, TFrom> extends never ? {} : RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema']>>, TToSchema = Partial<RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema']> & Omit<RouteInfoByPath<TAllRouteInfo, TTo>['fullSearchSchema'], keyof PickRequired<RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema']>>, TFromFullSchema = Expand<UnionToIntersection<TAllRouteInfo['fullSearchSchema'] & TFromSchema>>, TToFullSchema = Expand<UnionToIntersection<TAllRouteInfo['fullSearchSchema'] & TToSchema>>> = keyof PickRequired<TToSchema> extends never ? {
565
+ search?: true | SearchReducer<TFromFullSchema, TToFullSchema>;
565
566
  } : {
566
- search: SearchReducer<TFromSchema, TToSchema>;
567
+ search: SearchReducer<TFromFullSchema, TToFullSchema>;
567
568
  };
568
569
  type SearchReducer<TFrom, TTo> = {
569
570
  [TKey in keyof TTo]: TTo[TKey];
570
571
  } | ((current: TFrom) => TTo);
571
- type PathParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromParams = RouteInfoByPath<TAllRouteInfo, TFrom>['allParams'], TToParams = RouteInfoByPath<TAllRouteInfo, TTo>['allParams']> = StartsWith<TFrom, TTo> extends true ? {
572
- params?: ParamsReducer<TFromParams, TToParams>;
573
- } : AnyPathParams extends TToParams ? {
574
- params?: ParamsReducer<TFromParams, Record<string, never>>;
572
+ type PathParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = Expand<UnionToIntersection<RouteInfoByPath<TAllRouteInfo, TFrom> extends never ? {} : RouteInfoByPath<TAllRouteInfo, TFrom>['allParams']>>, TToSchema = Partial<RouteInfoByPath<TAllRouteInfo, TFrom>['allParams']> & Omit<RouteInfoByPath<TAllRouteInfo, TTo>['allParams'], keyof PickRequired<RouteInfoByPath<TAllRouteInfo, TFrom>['allParams']>>, TFromFullParams = Expand<UnionToIntersection<TAllRouteInfo['allParams'] & TFromSchema>>, TToFullParams = Expand<UnionToIntersection<TAllRouteInfo['allParams'] & TToSchema>>> = keyof PickRequired<TToSchema> extends never ? {
573
+ params?: ParamsReducer<TFromFullParams, TToFullParams>;
575
574
  } : {
576
- params: ParamsReducer<TFromParams, TToParams>;
575
+ params: ParamsReducer<TFromFullParams, TToFullParams>;
577
576
  };
578
577
  type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
579
578
  type ToPathOption<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = TTo | RelativeToPathAutoComplete<TAllRouteInfo['routePaths'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
@@ -1343,7 +1343,7 @@
1343
1343
  validate: () => {
1344
1344
  var _routeMatch$parentMat, _routeMatch$parentMat2;
1345
1345
  // Validate the search params and stabilize them
1346
- const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.location.search;
1346
+ const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.__location.search;
1347
1347
  try {
1348
1348
  var _validator;
1349
1349
  const prevSearch = routeMatch.routeSearch;
@@ -1581,7 +1581,7 @@
1581
1581
  basepath: '',
1582
1582
  routeTree: undefined,
1583
1583
  routesById: {},
1584
- location: undefined,
1584
+ __location: undefined,
1585
1585
  //
1586
1586
  resolveNavigation: () => {},
1587
1587
  matchCache: {},
@@ -1614,7 +1614,7 @@
1614
1614
  },
1615
1615
  dehydrate: () => {
1616
1616
  return {
1617
- location: router.location,
1617
+ location: router.__location,
1618
1618
  state: _extends({}, pick(router.state, ['status', 'location', 'lastUpdated', 'location']), {
1619
1619
  matches: router.state.matches.map(match => pick(match, ['matchId', 'status', 'routeLoaderData', 'loaderData', 'isInvalid', 'invalidAt']))
1620
1620
  }),
@@ -1623,13 +1623,13 @@
1623
1623
  },
1624
1624
  hydrate: dehydratedState => {
1625
1625
  // Update the location
1626
- router.location = dehydratedState.location;
1626
+ router.__location = dehydratedState.location;
1627
1627
 
1628
1628
  // Update the context
1629
1629
  router.options.context = dehydratedState.context;
1630
1630
 
1631
1631
  // Match the routes
1632
- const matches = router.matchRoutes(router.location.pathname, {
1632
+ const matches = router.matchRoutes(router.__location.pathname, {
1633
1633
  strictParseParams: true
1634
1634
  });
1635
1635
  matches.forEach((match, index) => {
@@ -1651,14 +1651,14 @@
1651
1651
 
1652
1652
  // If the current location isn't updated, trigger a navigation
1653
1653
  // to the current location. Otherwise, load the current location.
1654
- if (next.href !== router.location.href) {
1654
+ if (next.href !== router.__location.href) {
1655
1655
  router.__.commitLocation(next, true);
1656
1656
  }
1657
1657
  if (!router.state.matches.length) {
1658
1658
  router.load();
1659
1659
  }
1660
1660
  const unsub = router.history.listen(event => {
1661
- router.load(router.__.parseLocation(event.location, router.location));
1661
+ router.load(router.__.parseLocation(event.location, router.__location));
1662
1662
  });
1663
1663
 
1664
1664
  // addEventListener does not exist in React Native, but window does
@@ -1682,12 +1682,12 @@
1682
1682
  },
1683
1683
  update: opts => {
1684
1684
  const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1685
- if (!router.location || newHistory) {
1685
+ if (!router.__location || newHistory) {
1686
1686
  if (opts != null && opts.history) {
1687
1687
  router.history = opts.history;
1688
1688
  }
1689
- router.location = router.__.parseLocation(router.history.location);
1690
- router.state.location = router.location;
1689
+ router.__location = router.__.parseLocation(router.history.location);
1690
+ router.state.location = router.__location;
1691
1691
  }
1692
1692
  Object.assign(router.options, opts);
1693
1693
  const {
@@ -1712,28 +1712,28 @@
1712
1712
  router.startedLoadingAt = id;
1713
1713
  if (next) {
1714
1714
  // Ingest the new location
1715
- router.location = next;
1715
+ router.__location = next;
1716
1716
  }
1717
1717
 
1718
1718
  // Cancel any pending matches
1719
1719
  router.cancelMatches();
1720
1720
 
1721
1721
  // Match the routes
1722
- const matches = router.matchRoutes(router.location.pathname, {
1722
+ const matches = router.matchRoutes(router.__location.pathname, {
1723
1723
  strictParseParams: true
1724
1724
  });
1725
1725
  if (typeof document !== 'undefined') {
1726
1726
  router.state = _extends({}, router.state, {
1727
1727
  pending: {
1728
1728
  matches: matches,
1729
- location: router.location
1729
+ location: router.__location
1730
1730
  },
1731
1731
  status: 'loading'
1732
1732
  });
1733
1733
  } else {
1734
1734
  router.state = _extends({}, router.state, {
1735
1735
  matches: matches,
1736
- location: router.location,
1736
+ location: router.__location,
1737
1737
  status: 'loading'
1738
1738
  });
1739
1739
  }
@@ -1817,7 +1817,7 @@
1817
1817
  }
1818
1818
  });
1819
1819
  router.state = _extends({}, router.state, {
1820
- location: router.location,
1820
+ location: router.__location,
1821
1821
  matches,
1822
1822
  pending: undefined,
1823
1823
  status: 'idle'
@@ -1846,7 +1846,7 @@
1846
1846
  },
1847
1847
  loadRoute: async function loadRoute(navigateOpts) {
1848
1848
  if (navigateOpts === void 0) {
1849
- navigateOpts = router.location;
1849
+ navigateOpts = router.__location;
1850
1850
  }
1851
1851
  const next = router.buildNext(navigateOpts);
1852
1852
  const matches = router.matchRoutes(next.pathname, {
@@ -1858,7 +1858,7 @@
1858
1858
  preloadRoute: async function preloadRoute(navigateOpts, loaderOpts) {
1859
1859
  var _ref3, _ref4, _loaderOpts$maxAge, _ref5, _ref6, _loaderOpts$gcMaxAge;
1860
1860
  if (navigateOpts === void 0) {
1861
- navigateOpts = router.location;
1861
+ navigateOpts = router.__location;
1862
1862
  }
1863
1863
  const next = router.buildNext(navigateOpts);
1864
1864
  const matches = router.matchRoutes(next.pathname, {
@@ -1943,14 +1943,15 @@
1943
1943
  },
1944
1944
  loadMatches: async (resolvedMatches, loaderOpts) => {
1945
1945
  const matchPromises = resolvedMatches.map(async match => {
1946
+ var _search$__data;
1946
1947
  // Validate the match (loads search params etc)
1947
1948
  match.__.validate();
1948
- match.load(loaderOpts);
1949
1949
  const search = match.search;
1950
- if (search.__data && search.__data.matchId !== match.matchId) {
1950
+ if ((_search$__data = search.__data) != null && _search$__data.matchId && search.__data.matchId !== match.matchId) {
1951
1951
  return;
1952
1952
  }
1953
- if (match.__.loadPromise) {
1953
+ match.load(loaderOpts);
1954
+ if (match.status !== 'success' && match.__.loadPromise) {
1954
1955
  // Wait for the first sign of activity from the match
1955
1956
  await match.__.loadPromise;
1956
1957
  }
@@ -2238,11 +2239,9 @@
2238
2239
  if (dest === void 0) {
2239
2240
  dest = {};
2240
2241
  }
2241
- // const resolvedFrom: Location = {
2242
- // ...router.location,
2243
- const fromPathname = dest.fromCurrent ? router.location.pathname : (_dest$from = dest.from) != null ? _dest$from : router.location.pathname;
2242
+ const fromPathname = dest.fromCurrent ? router.__location.pathname : (_dest$from = dest.from) != null ? _dest$from : router.__location.pathname;
2244
2243
  let pathname = resolvePath((_router$basepath = router.basepath) != null ? _router$basepath : '/', fromPathname, "" + ((_dest$to = dest.to) != null ? _dest$to : '.'));
2245
- const fromMatches = router.matchRoutes(router.location.pathname, {
2244
+ const fromMatches = router.matchRoutes(router.__location.pathname, {
2246
2245
  strictParseParams: true
2247
2246
  });
2248
2247
  const toMatches = router.matchRoutes(pathname);
@@ -2256,7 +2255,7 @@
2256
2255
  pathname = interpolatePath(pathname, nextParams != null ? nextParams : {});
2257
2256
 
2258
2257
  // Pre filters first
2259
- const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.location.search) : router.location.search;
2258
+ const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.__location.search) : router.__location.search;
2260
2259
 
2261
2260
  // Then the link/navigate function
2262
2261
  const destSearch = dest.search === true ? preFilteredSearch // Preserve resolvedFrom true
@@ -2266,15 +2265,15 @@
2266
2265
 
2267
2266
  // Then post filters
2268
2267
  const postFilteredSearch = (_dest$__postSearchFil = dest.__postSearchFilters) != null && _dest$__postSearchFil.length ? dest.__postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
2269
- const search = replaceEqualDeep(router.location.search, postFilteredSearch);
2268
+ const search = replaceEqualDeep(router.__location.search, postFilteredSearch);
2270
2269
  const searchStr = router.options.stringifySearch(search);
2271
- let hash = dest.hash === true ? router.location.hash : functionalUpdate(dest.hash, router.location.hash);
2270
+ let hash = dest.hash === true ? router.__location.hash : functionalUpdate(dest.hash, router.__location.hash);
2272
2271
  hash = hash ? "#" + hash : '';
2273
2272
  return {
2274
2273
  pathname,
2275
2274
  search,
2276
2275
  searchStr,
2277
- state: router.location.state,
2276
+ state: router.__location.state,
2278
2277
  hash,
2279
2278
  href: "" + pathname + searchStr + hash,
2280
2279
  key: dest.key