@tanstack/react-router 1.35.3 → 1.35.6

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.
@@ -33,7 +33,7 @@ export type RoutePathOptionsIntersection<TCustomId, TPath> = {
33
33
  path: TPath;
34
34
  id: TCustomId;
35
35
  };
36
- export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = {}, TFullSearchSchemaInput = TSearchSchemaUsed, TFullSearchSchema = TSearchSchema, TParams = AnyPathParams, TAllParams = TParams, TRouteContextReturn = RouteContext, TRouteContext = RouteContext, TRouterContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & UpdatableRouteOptions<NoInfer<TCustomId>, NoInfer<TAllParams>, NoInfer<TFullSearchSchema>, NoInfer<TLoaderData>, NoInfer<TAllContext>, NoInfer<TRouteContext>, NoInfer<TLoaderDeps>>;
36
+ export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = AnyPathParams, TAllParams = TParams, TRouteContextReturn = RouteContext, TRouteContext = RouteContext, TRouterContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & UpdatableRouteOptions<NoInfer<TCustomId>, NoInfer<TAllParams>, NoInfer<TFullSearchSchema>, NoInfer<TLoaderData>, NoInfer<TAllContext>, NoInfer<TRouteContext>, NoInfer<TLoaderDeps>>;
37
37
  export type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
38
38
  export type FileBaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn = RouteContext, TRouteContext = RouteContext, TRouterContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}> = {
39
39
  validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>;
@@ -50,7 +50,7 @@ export type FileBaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TPath
50
50
  stringifyParams?: never;
51
51
  parseParams?: never;
52
52
  });
53
- export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = {}, TFullSearchSchemaInput = TSearchSchemaUsed, TFullSearchSchema = TSearchSchema, TParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn = RouteContext, TRouteContext = RouteContext, TRouterContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TParentRoute, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & {
53
+ export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn = RouteContext, TRouteContext = RouteContext, TRouterContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TParentRoute, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & {
54
54
  getParentRoute: () => TParentRoute;
55
55
  };
56
56
  type BeforeLoadFn<in out TFullSearchSchema, in out TParentRoute extends AnyRoute, in out TAllParams, TRouteContextReturn, in out TRouterContext = AnyContext, in out TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>> = (opts: {
@@ -169,8 +169,8 @@ export type InferFullSearchSchemaInput<TRoute> = TRoute extends {
169
169
  };
170
170
  } ? TFullSearchSchemaInput : {};
171
171
  export type ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : TSearchSchema;
172
- export type ResolveFullSearchSchema<TParentRoute extends AnyRoute, TSearchSchema> = unknown extends TParentRoute ? Omit<TSearchSchema, keyof RootSearchSchema> : Assign<TParentRoute['id'] extends RootRouteId ? Omit<TParentRoute['types']['searchSchema'], keyof RootSearchSchema> : TParentRoute['types']['fullSearchSchema'], TSearchSchema>;
173
- export type ResolveFullSearchSchemaInput<TParentRoute extends AnyRoute, TSearchSchemaUsed> = unknown extends TParentRoute ? Omit<TSearchSchemaUsed, keyof RootSearchSchema> : Assign<TParentRoute['id'] extends RootRouteId ? Omit<TParentRoute['types']['searchSchemaInput'], keyof RootSearchSchema> : TParentRoute['types']['fullSearchSchemaInput'], TSearchSchemaUsed>;
172
+ export type ResolveFullSearchSchema<TParentRoute extends AnyRoute, TSearchSchema> = unknown extends TParentRoute ? TSearchSchema : Assign<TParentRoute['types']['fullSearchSchema'], TSearchSchema>;
173
+ export type ResolveFullSearchSchemaInput<TParentRoute extends AnyRoute, TSearchSchemaUsed> = unknown extends TParentRoute ? TSearchSchemaUsed : Assign<TParentRoute['types']['fullSearchSchemaInput'], TSearchSchemaUsed>;
174
174
  export type ResolveRouteContext<TRouteContextReturn> = [
175
175
  TRouteContextReturn
176
176
  ] extends [never] ? RouteContext : TRouteContextReturn;
@@ -230,7 +230,7 @@ export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']
230
230
  }
231
231
  export declare class Route<in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchSchemaInput = Record<string, unknown>, in out TSearchSchema = {}, in out TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, in out TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, in out TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, in out TParams = Record<ParsePathParams<TPath>, string>, in out TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, in out TRouteContext = ResolveRouteContext<TRouteContextReturn>, in out TAllContext = Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>, in out TRouterContext = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>, in out TChildren = unknown> {
232
232
  isRoot: TParentRoute extends Route<any> ? true : false;
233
- options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>;
233
+ options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>;
234
234
  parentRoute: TParentRoute;
235
235
  id: TId;
236
236
  path: TPath;
@@ -244,7 +244,7 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
244
244
  /**
245
245
  * @deprecated Use the `createRoute` function instead.
246
246
  */
247
- constructor(options?: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>);
247
+ constructor(options?: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>);
248
248
  types: {
249
249
  parentRoute: TParentRoute;
250
250
  path: TPath;
@@ -295,14 +295,13 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
295
295
  }) => TSelected;
296
296
  useNavigate: () => UseNavigateResult<string>;
297
297
  }
298
- 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 = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams = Record<ParsePathParams<TPath>, string>, TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TAllContext = Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>, TRouterContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, 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>;
298
+ 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 = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams = Record<ParsePathParams<TPath>, string>, TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TAllContext = Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>, TRouterContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, TChildren = unknown>(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, 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>;
299
299
  export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
300
- export type RootRouteOptions<TSearchSchemaInput = RootSearchSchema, TSearchSchema = RootSearchSchema, TSearchSchemaUsed = RootSearchSchema, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TRouterContext = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>> = Omit<RouteOptions<any, // TParentRoute
300
+ export type RootRouteOptions<TSearchSchemaInput = {}, TSearchSchema = {}, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TRouterContext = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>> = Omit<RouteOptions<any, // TParentRoute
301
301
  RootRouteId, // TCustomId
302
302
  '', // TPath
303
303
  TSearchSchemaInput, // TSearchSchemaInput
304
304
  TSearchSchema, // TSearchSchema
305
- TSearchSchemaUsed, TSearchSchemaUsed, //TFullSearchSchemaInput
306
305
  TSearchSchema, // TFullSearchSchema
307
306
  {}, // TParams
308
307
  {}, // TAllParams
@@ -311,15 +310,12 @@ TRouteContext, // TRouteContext
311
310
  TRouterContext, Assign<TRouterContext, TRouteContext>, // TAllContext
312
311
  TLoaderDeps, TLoaderDataReturn, // TLoaderDataReturn,
313
312
  TLoaderData>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>;
314
- 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 = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>>(options?: RootRouteOptions<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>) => RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderData, ResolveLoaderData<TLoaderData>>;
313
+ export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TSearchSchemaInput = {}, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = ResolveRouteContext<TRouteContextReturn>, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>>(options?: RootRouteOptions<TSearchSchemaInput, TSearchSchema, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>) => RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderData, ResolveLoaderData<TLoaderData>>;
315
314
  /**
316
315
  * @deprecated Use the `createRootRouteWithContext` function instead.
317
316
  */
318
317
  export declare const rootRouteWithContext: typeof createRootRouteWithContext;
319
- export type RootSearchSchema = {
320
- __TRootSearchSchema__: '__TRootSearchSchema__';
321
- };
322
- export declare class RootRoute<in out TSearchSchemaInput = RootSearchSchema, in out TSearchSchema = RootSearchSchema, in out TSearchSchemaUsed = RootSearchSchema, TRouteContextReturn = RouteContext, in out TRouteContext = ResolveRouteContext<TRouteContextReturn>, in out TRouterContext = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>> extends Route<any, // TParentRoute
318
+ export declare class RootRoute<in out TSearchSchemaInput = {}, in out TSearchSchema = {}, in out TSearchSchemaUsed = {}, TRouteContextReturn = RouteContext, in out TRouteContext = ResolveRouteContext<TRouteContextReturn>, in out TRouterContext = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>> extends Route<any, // TParentRoute
323
319
  '/', // TPath
324
320
  '/', // TFullPath
325
321
  string, // TCustomId
@@ -338,16 +334,14 @@ TLoaderDeps, TLoaderDataReturn, TLoaderData, any> {
338
334
  /**
339
335
  * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
340
336
  */
341
- constructor(options?: RootRouteOptions<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>);
337
+ constructor(options?: RootRouteOptions<TSearchSchemaInput, TSearchSchema, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>);
342
338
  }
343
- export declare function createRootRoute<TSearchSchemaInput = RootSearchSchema, TSearchSchema = RootSearchSchema, TSearchSchemaUsed = RootSearchSchema, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TRouterContext = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>>(options?: Omit<RouteOptions<any, // TParentRoute
339
+ export declare function createRootRoute<TSearchSchemaInput = {}, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TRouterContext = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>>(options?: Omit<RouteOptions<any, // TParentRoute
344
340
  RootRouteId, // TCustomId
345
341
  '', // TPath
346
342
  TSearchSchemaInput, // TSearchSchemaInput
347
343
  TSearchSchema, // TSearchSchema
348
- TSearchSchemaUsed, TSearchSchemaUsed, // TFullSearchSchemaInput
349
- TSearchSchema, // TFullSearchSchema
350
- {}, // TParams
344
+ TSearchSchema, {}, // TParams
351
345
  {}, // TAllParams
352
346
  TRouteContextReturn, // TRouteContextReturn
353
347
  TRouteContext, // TRouteContext
@@ -399,7 +393,7 @@ export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
399
393
  export type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>;
400
394
  export type ErrorRouteComponent = RouteComponent<ErrorComponentProps>;
401
395
  export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>;
402
- export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = {}, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContextReturn = AnyContext, TRouteContext = RouteContext, TAllContext = Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>, TRouterContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, TChildren = unknown> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren> {
403
- constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'>);
396
+ export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = {}, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContextReturn = AnyContext, TRouteContext = RouteContext, TAllContext = ResolveAllContext<TParentRoute, TRouteContext>, TRouterContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, TChildren = unknown> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren> {
397
+ constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'>);
404
398
  }
405
399
  export {};
@@ -1,4 +1,4 @@
1
- import { AnyRoute, RootSearchSchema } from './route.cjs';
1
+ import { AnyRoute } from './route.cjs';
2
2
  import { AnyRouter, TrailingSlashOption } from './router.cjs';
3
3
  import { MergeUnion } from './utils.cjs';
4
4
 
@@ -34,8 +34,8 @@ export type RoutesByToPath<TRouter extends AnyRouter> = {
34
34
  [TRoute in ParseRouteWithoutBranches<TRouter['routeTree']> as RouteToByRouter<TRouter, TRoute>]: TRoute;
35
35
  };
36
36
  export type RouteByToPath<TRouter extends AnyRouter, TTo> = Extract<RoutesByToPath<TRouter>[TTo], AnyRoute>;
37
- export type FullSearchSchema<TRouteTree extends AnyRoute> = MergeUnion<Exclude<ParseRoute<TRouteTree>['types']['fullSearchSchema'], RootSearchSchema>>;
38
- export type FullSearchSchemaInput<TRouteTree extends AnyRoute> = MergeUnion<Exclude<ParseRoute<TRouteTree>['types']['fullSearchSchemaInput'], RootSearchSchema>>;
37
+ export type FullSearchSchema<TRouteTree extends AnyRoute> = MergeUnion<ParseRoute<TRouteTree>['types']['fullSearchSchema']>;
38
+ export type FullSearchSchemaInput<TRouteTree extends AnyRoute> = MergeUnion<ParseRoute<TRouteTree>['types']['fullSearchSchemaInput']>;
39
39
  export type AllParams<TRouteTree extends AnyRoute> = MergeUnion<ParseRoute<TRouteTree>['types']['allParams']>;
40
40
  export type AllContext<TRouteTree extends AnyRoute> = MergeUnion<ParseRoute<TRouteTree>['types']['allContext']>;
41
41
  export type AllLoaderData<TRouteTree extends AnyRoute> = MergeUnion<ParseRoute<TRouteTree>['types']['loaderData']>;
@@ -398,24 +398,33 @@ class Router {
398
398
  };
399
399
  this.buildLocation = (opts) => {
400
400
  const build = (dest = {}, matches) => {
401
- var _a, _b, _c, _d;
402
- let fromPath = this.latestLocation.pathname;
403
- let fromSearch = dest.fromSearch || this.latestLocation.search;
404
- const fromMatches = this.matchRoutes(
405
- this.latestLocation.pathname,
406
- fromSearch
401
+ var _a, _b, _c;
402
+ const latestLocation = dest._fromLocation ?? this.latestLocation;
403
+ let fromPath = latestLocation.pathname;
404
+ let fromSearch = dest.fromSearch || latestLocation.search;
405
+ const fromMatches = this.matchRoutes(latestLocation.pathname, fromSearch);
406
+ const fromMatch = dest.from != null ? fromMatches.find(
407
+ (d) => path.matchPathname(this.basepath, path.trimPathRight(d.pathname), {
408
+ to: dest.from,
409
+ caseSensitive: false,
410
+ fuzzy: false
411
+ })
412
+ ) : void 0;
413
+ fromPath = (fromMatch == null ? void 0 : fromMatch.pathname) || fromPath;
414
+ invariant(
415
+ dest.from == null || fromMatch != null,
416
+ "Could not find match for from: " + dest.from
407
417
  );
408
- fromPath = ((_a = fromMatches.find((d) => d.id === dest.from)) == null ? void 0 : _a.pathname) || fromPath;
409
- fromSearch = ((_b = utils.last(fromMatches)) == null ? void 0 : _b.search) || this.latestLocation.search;
418
+ fromSearch = ((_a = utils.last(fromMatches)) == null ? void 0 : _a.search) || this.latestLocation.search;
410
419
  const stayingMatches = matches == null ? void 0 : matches.filter(
411
420
  (d) => fromMatches.find((e) => e.routeId === d.routeId)
412
421
  );
413
- const fromRouteByFromPathRouteId = this.routesById[(_c = stayingMatches == null ? void 0 : stayingMatches.find((d) => d.pathname === fromPath)) == null ? void 0 : _c.routeId];
422
+ const fromRouteByFromPathRouteId = this.routesById[(_b = stayingMatches == null ? void 0 : stayingMatches.find((d) => d.pathname === fromPath)) == null ? void 0 : _b.routeId];
414
423
  let pathname = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(
415
424
  fromPath,
416
425
  (fromRouteByFromPathRouteId == null ? void 0 : fromRouteByFromPathRouteId.to) ?? fromPath
417
426
  );
418
- const prevParams = { ...(_d = utils.last(fromMatches)) == null ? void 0 : _d.params };
427
+ const prevParams = { ...(_c = utils.last(fromMatches)) == null ? void 0 : _c.params };
419
428
  let nextParams = (dest.params ?? true) === true ? prevParams : { ...prevParams, ...utils.functionalUpdate(dest.params, prevParams) };
420
429
  if (Object.keys(nextParams).length > 0) {
421
430
  matches == null ? void 0 : matches.map((d) => this.looseRoutesById[d.routeId].options.stringifyParams).filter(Boolean).forEach((fn) => {
@@ -479,9 +488,10 @@ class Router {
479
488
  return false;
480
489
  });
481
490
  if (foundMask) {
491
+ const { from, ...maskProps } = foundMask;
482
492
  maskedDest = {
483
493
  ...utils.pick(opts, ["from"]),
484
- ...foundMask,
494
+ ...maskProps,
485
495
  params
486
496
  };
487
497
  maskedNext = build(maskedDest);
@@ -842,7 +852,7 @@ class Router {
842
852
  preload: !!preload,
843
853
  context: parentContext,
844
854
  location,
845
- navigate: (opts) => this.navigate({ ...opts, from: match.pathname }),
855
+ navigate: (opts) => this.navigate({ ...opts, _fromLocation: location }),
846
856
  buildLocation: this.buildLocation,
847
857
  cause: preload ? "preload" : match.cause
848
858
  })) ?? {};
@@ -884,7 +894,7 @@ class Router {
884
894
  abortController: match.abortController,
885
895
  context: match.context,
886
896
  location,
887
- navigate: (opts) => this.navigate({ ...opts, from: match.pathname }),
897
+ navigate: (opts) => this.navigate({ ...opts, _fromLocation: location }),
888
898
  cause: preload ? "preload" : match.cause,
889
899
  route
890
900
  };
@@ -1116,9 +1126,8 @@ class Router {
1116
1126
  } catch (err) {
1117
1127
  if (redirects.isRedirect(err)) {
1118
1128
  return await this.preloadRoute({
1119
- fromSearch: next.search,
1120
- from: next.pathname,
1121
- ...err
1129
+ ...err,
1130
+ _fromLocation: next
1122
1131
  });
1123
1132
  }
1124
1133
  console.error(err);