@tanstack/router-core 0.0.1-alpha.9 → 0.0.1-beta.10

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.
@@ -55,6 +55,73 @@ declare function replaceEqualDeep(prev: any, next: any): any;
55
55
  declare function last<T>(arr: T[]): T | undefined;
56
56
  declare function warning(cond: any, message: string): cond is true;
57
57
  declare function functionalUpdate<TResult>(updater: Updater<TResult>, previous: TResult): TResult;
58
+ declare function pick<T, K extends keyof T>(parent: T, keys: K[]): Pick<T, K>;
59
+
60
+ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
61
+ matchId: string;
62
+ pathname: string;
63
+ params: TRouteInfo['params'];
64
+ parentMatch?: RouteMatch;
65
+ childMatches: RouteMatch[];
66
+ routeSearch: TRouteInfo['searchSchema'];
67
+ search: TRouteInfo['fullSearchSchema'];
68
+ status: 'idle' | 'loading' | 'success' | 'error';
69
+ updatedAt?: number;
70
+ error?: unknown;
71
+ isInvalid: boolean;
72
+ getIsInvalid: () => boolean;
73
+ loaderData: TRouteInfo['loaderData'];
74
+ routeLoaderData: TRouteInfo['routeLoaderData'];
75
+ isFetching: boolean;
76
+ isPending: boolean;
77
+ invalidAt: number;
78
+ __: {
79
+ element?: GetFrameworkGeneric<'Element'>;
80
+ errorElement?: GetFrameworkGeneric<'Element'>;
81
+ catchElement?: GetFrameworkGeneric<'Element'>;
82
+ pendingElement?: GetFrameworkGeneric<'Element'>;
83
+ loadPromise?: Promise<void>;
84
+ loaderDataPromise?: Promise<void>;
85
+ elementsPromise?: Promise<void>;
86
+ dataPromise?: Promise<void>;
87
+ pendingTimeout?: Timeout;
88
+ pendingMinTimeout?: Timeout;
89
+ pendingMinPromise?: Promise<void>;
90
+ onExit?: void | ((matchContext: {
91
+ params: TRouteInfo['allParams'];
92
+ search: TRouteInfo['fullSearchSchema'];
93
+ }) => void);
94
+ abortController: AbortController;
95
+ latestId: string;
96
+ validate: () => void;
97
+ startPending: () => void;
98
+ cancelPending: () => void;
99
+ notify: () => void;
100
+ resolve: () => void;
101
+ };
102
+ cancel: () => void;
103
+ load: (loaderOpts?: {
104
+ withPending?: boolean;
105
+ } & ({
106
+ preload: true;
107
+ maxAge: number;
108
+ gcMaxAge: number;
109
+ } | {
110
+ preload?: false;
111
+ maxAge?: never;
112
+ gcMaxAge?: never;
113
+ })) => Promise<TRouteInfo['routeLoaderData']>;
114
+ fetch: (opts?: {
115
+ maxAge?: number;
116
+ }) => Promise<TRouteInfo['routeLoaderData']>;
117
+ invalidate: () => void;
118
+ hasLoaders: () => boolean;
119
+ }
120
+ declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
121
+ matchId: string;
122
+ params: TRouteInfo['allParams'];
123
+ pathname: string;
124
+ }): RouteMatch<TAllRouteInfo, TRouteInfo>;
58
125
 
59
126
  interface LocationState {
60
127
  }
@@ -102,29 +169,55 @@ interface RouterOptions<TRouteConfig extends AnyRouteConfig> {
102
169
  route: AnyRoute;
103
170
  router: Router<any, any>;
104
171
  }) => void;
172
+ createElement?: (element: GetFrameworkGeneric<'SyncOrAsyncElement'>) => Promise<GetFrameworkGeneric<'Element'>>;
105
173
  }
106
174
  interface Action<TPayload = unknown, TResponse = unknown> {
107
- submit: (submission?: TPayload) => Promise<TResponse>;
175
+ submit: (submission?: TPayload, actionOpts?: {
176
+ invalidate?: boolean;
177
+ multi?: boolean;
178
+ }) => Promise<TResponse>;
108
179
  current?: ActionState<TPayload, TResponse>;
109
180
  latest?: ActionState<TPayload, TResponse>;
110
- pending: ActionState<TPayload, TResponse>[];
181
+ submissions: ActionState<TPayload, TResponse>[];
111
182
  }
112
183
  interface ActionState<TPayload = unknown, TResponse = unknown> {
113
184
  submittedAt: number;
114
185
  status: 'idle' | 'pending' | 'success' | 'error';
115
186
  submission: TPayload;
187
+ isMulti: boolean;
116
188
  data?: TResponse;
117
189
  error?: unknown;
118
190
  }
191
+ interface Loader<TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}, TRouteLoaderData = AnyLoaderData> {
192
+ fetch: keyof PickRequired<TFullSearchSchema> extends never ? keyof TAllParams extends never ? (loaderContext: {
193
+ signal?: AbortSignal;
194
+ }) => Promise<TRouteLoaderData> : (loaderContext: {
195
+ params: TAllParams;
196
+ search?: TFullSearchSchema;
197
+ signal?: AbortSignal;
198
+ }) => Promise<TRouteLoaderData> : keyof TAllParams extends never ? (loaderContext: {
199
+ search: TFullSearchSchema;
200
+ params: TAllParams;
201
+ signal?: AbortSignal;
202
+ }) => Promise<TRouteLoaderData> : (loaderContext: {
203
+ search: TFullSearchSchema;
204
+ signal?: AbortSignal;
205
+ }) => Promise<TRouteLoaderData>;
206
+ current?: LoaderState<TFullSearchSchema, TAllParams>;
207
+ latest?: LoaderState<TFullSearchSchema, TAllParams>;
208
+ pending: LoaderState<TFullSearchSchema, TAllParams>[];
209
+ }
210
+ interface LoaderState<TFullSearchSchema = unknown, TAllParams = unknown> {
211
+ loadedAt: number;
212
+ loaderContext: LoaderContext<TFullSearchSchema, TAllParams>;
213
+ }
119
214
  interface RouterState {
120
215
  status: 'idle' | 'loading';
121
216
  location: Location;
122
217
  matches: RouteMatch[];
123
218
  lastUpdated: number;
124
- loaderData: unknown;
125
- currentAction?: ActionState;
126
- latestAction?: ActionState;
127
219
  actions: Record<string, Action>;
220
+ loaders: Record<string, Loader>;
128
221
  pending?: PendingState;
129
222
  isFetching: boolean;
130
223
  isPreloading: boolean;
@@ -133,7 +226,7 @@ interface PendingState {
133
226
  location: Location;
134
227
  matches: RouteMatch[];
135
228
  }
136
- declare type Listener = () => void;
229
+ declare type Listener = (router: Router<any, any>) => void;
137
230
  declare type ListenerFn = () => void;
138
231
  interface BuildNextOptions {
139
232
  to?: string | number | null;
@@ -161,7 +254,13 @@ interface MatchRouteOptions {
161
254
  pending: boolean;
162
255
  caseSensitive?: boolean;
163
256
  }
257
+ interface DehydratedRouterState extends Pick<RouterState, 'status' | 'location' | 'lastUpdated'> {
258
+ matches: DehydratedRouteMatch[];
259
+ }
260
+ interface DehydratedRouteMatch extends Pick<RouteMatch<any, any>, 'matchId' | 'status' | 'routeLoaderData' | 'loaderData' | 'isInvalid' | 'invalidAt'> {
261
+ }
164
262
  interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>> {
263
+ history: BrowserHistory | MemoryHistory | HashHistory;
165
264
  options: PickAsRequired<RouterOptions<TRouteConfig>, 'stringifySearch' | 'parseSearch'>;
166
265
  basepath: string;
167
266
  allRouteInfo: TAllRouteInfo;
@@ -173,24 +272,17 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
173
272
  routeTree: Route<TAllRouteInfo, RouteInfo>;
174
273
  routesById: RoutesById<TAllRouteInfo>;
175
274
  navigationPromise: Promise<void>;
176
- removeActionQueue: {
177
- action: Action;
178
- actionState: ActionState;
179
- }[];
180
275
  startedLoadingAt: number;
181
276
  resolveNavigation: () => void;
182
277
  subscribe: (listener: Listener) => () => void;
278
+ reset: () => void;
183
279
  notify: () => void;
184
280
  mount: () => () => void;
185
281
  onFocus: () => void;
186
282
  update: <TRouteConfig extends RouteConfig = RouteConfig>(opts?: RouterOptions<TRouteConfig>) => Router<TRouteConfig>;
187
- buildRouteTree: (routeConfig: RouteConfig) => Route<TAllRouteInfo, AnyRouteInfo>;
188
- parseLocation: (location: History['location'], previousLocation?: Location) => Location;
189
- buildLocation: (dest: BuildNextOptions) => Location;
190
- commitLocation: (next: Location, replace?: boolean) => Promise<void>;
191
283
  buildNext: (opts: BuildNextOptions) => Location;
192
284
  cancelMatches: () => void;
193
- loadLocation: (next?: Location) => Promise<void>;
285
+ load: (next?: Location) => Promise<void>;
194
286
  matchCache: Record<string, MatchCacheEntry>;
195
287
  cleanMatchCache: () => void;
196
288
  getRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(id: TId) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>;
@@ -216,70 +308,22 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
216
308
  invalidateRoute: (opts: MatchLocation) => void;
217
309
  reload: () => Promise<void>;
218
310
  resolvePath: (from: string, path: string) => string;
219
- _navigate: (location: BuildNextOptions & {
220
- replace?: boolean;
221
- }) => Promise<void>;
222
311
  navigate: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(opts: NavigateOptionsAbsolute<TAllRouteInfo, TFrom, TTo>) => Promise<void>;
223
312
  matchRoute: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(matchLocation: ToOptions<TAllRouteInfo, TFrom, TTo>, opts?: MatchRouteOptions) => boolean;
224
313
  buildLink: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(opts: LinkOptions<TAllRouteInfo, TFrom, TTo>) => LinkInfo;
225
- }
226
- declare function createRouter<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>>(userOptions?: RouterOptions<TRouteConfig>): Router<TRouteConfig, TAllRouteInfo>;
227
-
228
- interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
229
- matchId: string;
230
- pathname: string;
231
- params: AnyPathParams;
232
- parentMatch?: RouteMatch;
233
- childMatches: RouteMatch[];
234
- routeSearch: TRouteInfo['searchSchema'];
235
- search: TRouteInfo['fullSearchSchema'];
236
- status: 'idle' | 'loading' | 'success' | 'error';
237
- updatedAt?: number;
238
- error?: unknown;
239
- isInvalid: boolean;
240
- getIsInvalid: () => boolean;
241
- loaderData: TRouteInfo['loaderData'];
242
- routeLoaderData: TRouteInfo['routeLoaderData'];
243
- isFetching: boolean;
244
- isPending: boolean;
245
- invalidAt: number;
314
+ dehydrateState: () => DehydratedRouterState;
315
+ hydrateState: (state: DehydratedRouterState) => void;
246
316
  __: {
247
- element?: GetFrameworkGeneric<'Element'>;
248
- errorElement?: GetFrameworkGeneric<'Element'>;
249
- catchElement?: GetFrameworkGeneric<'Element'>;
250
- pendingElement?: GetFrameworkGeneric<'Element'>;
251
- loadPromise?: Promise<void>;
252
- loaderPromise?: Promise<void>;
253
- importPromise?: Promise<void>;
254
- elementsPromise?: Promise<void>;
255
- dataPromise?: Promise<void>;
256
- pendingTimeout?: Timeout;
257
- pendingMinTimeout?: Timeout;
258
- pendingMinPromise?: Promise<void>;
259
- onExit?: void | ((matchContext: {
260
- params: TRouteInfo['allParams'];
261
- search: TRouteInfo['fullSearchSchema'];
262
- }) => void);
263
- abortController: AbortController;
264
- latestId: string;
265
- validate: () => void;
266
- startPending: () => void;
267
- cancelPending: () => void;
268
- notify: () => void;
269
- resolve: () => void;
317
+ buildRouteTree: (routeConfig: RouteConfig) => Route<TAllRouteInfo, AnyRouteInfo>;
318
+ parseLocation: (location: History['location'], previousLocation?: Location) => Location;
319
+ buildLocation: (dest: BuildNextOptions) => Location;
320
+ commitLocation: (next: Location, replace?: boolean) => Promise<void>;
321
+ navigate: (location: BuildNextOptions & {
322
+ replace?: boolean;
323
+ }) => Promise<void>;
270
324
  };
271
- cancel: () => void;
272
- load: (opts?: {
273
- maxAge?: number;
274
- }) => Promise<void>;
275
- invalidate: () => void;
276
- hasLoaders: () => boolean;
277
325
  }
278
- declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
279
- matchId: string;
280
- params: TRouteInfo['allParams'];
281
- pathname: string;
282
- }): RouteMatch<TAllRouteInfo, TRouteInfo>;
326
+ declare function createRouter<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>>(userOptions?: RouterOptions<TRouteConfig>): Router<TRouteConfig, TAllRouteInfo>;
283
327
 
284
328
  interface AnyRoute extends Route<any, any> {
285
329
  }
@@ -296,9 +340,9 @@ interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRo
296
340
  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'];
297
341
  navigate: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['id'], TTo>, 'from'>) => Promise<void>;
298
342
  action: unknown extends TRouteInfo['actionResponse'] ? Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']> | undefined : Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']>;
343
+ loader: unknown extends TRouteInfo['routeLoaderData'] ? Action<LoaderContext<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams']>, TRouteInfo['routeLoaderData']> | undefined : Loader<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams'], TRouteInfo['routeLoaderData']>;
299
344
  }
300
345
  declare function createRoute<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(routeConfig: RouteConfig, options: TRouteInfo['options'], parent: undefined | Route<TAllRouteInfo, any>, router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo>): Route<TAllRouteInfo, TRouteInfo>;
301
- declare function cascadeLoaderData(matches: RouteMatch<any, any>[]): void;
302
346
 
303
347
  interface AnyAllRouteInfo {
304
348
  routeConfig: AnyRouteConfig;
@@ -381,11 +425,12 @@ declare type DefinedPathParamWarning = 'Path params cannot be redefined by child
381
425
  declare type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
382
426
  [Key in keyof TParentParams]?: DefinedPathParamWarning;
383
427
  };
384
- declare type LoaderFn<TRouteLoaderData extends AnyLoaderData, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext: {
428
+ declare type LoaderFn<TRouteLoaderData extends AnyLoaderData, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext: LoaderContext<TFullSearchSchema, TAllParams>) => Promise<TRouteLoaderData>;
429
+ interface LoaderContext<TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
385
430
  params: TAllParams;
386
431
  search: TFullSearchSchema;
387
432
  signal?: AbortSignal;
388
- }) => Promise<TRouteLoaderData>;
433
+ }
389
434
  declare type ActionFn<TActionPayload = unknown, TActionResponse = unknown> = (submission: TActionPayload) => TActionResponse | Promise<TActionResponse>;
390
435
  declare type UnloaderFn<TPath extends string> = (routeMatch: RouteMatch<any, RouteInfo<string, TPath>>) => void;
391
436
  declare type RouteOptions<TRouteId extends string = string, TPath extends string = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = ({
@@ -399,18 +444,6 @@ declare type RouteOptions<TRouteId extends string = string, TPath extends string
399
444
  postSearchFilters?: SearchFilter<TFullSearchSchema>[];
400
445
  pendingMs?: number;
401
446
  pendingMinMs?: number;
402
- } & ({
403
- parseParams?: never;
404
- stringifyParams?: never;
405
- } | {
406
- parseParams: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams;
407
- stringifyParams: (params: TParams) => Record<ParsePathParams<TPath>, string>;
408
- }) & RouteLoaders<TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TFullSearchSchema, TAllParams> & {
409
- import?: (opts: {
410
- params: AnyPathParams;
411
- }) => Promise<RouteLoaders<TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TFullSearchSchema, TAllParams>>;
412
- } & (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never ? {} : 'Cannot redefined path params in child routes!');
413
- interface RouteLoaders<TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
414
447
  element?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
415
448
  errorElement?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
416
449
  catchElement?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
@@ -432,7 +465,13 @@ interface RouteLoaders<TRouteLoaderData extends AnyLoaderData = {}, TLoaderData
432
465
  search: TFullSearchSchema;
433
466
  }) => void;
434
467
  meta?: RouteMeta;
435
- }
468
+ } & ({
469
+ parseParams?: never;
470
+ stringifyParams?: never;
471
+ } | {
472
+ parseParams: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams;
473
+ stringifyParams: (params: TParams) => Record<ParsePathParams<TPath>, string>;
474
+ }) & (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never ? {} : 'Cannot redefined path params in child routes!');
436
475
  declare type SearchFilter<T, U = T> = (prev: T) => U;
437
476
  interface RouteConfig<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}, TKnownChildren = unknown> {
438
477
  id: TId;
@@ -480,7 +519,7 @@ declare type LinkInfo = {
480
519
  };
481
520
  declare type StartsWith<A, B> = A extends `${B extends string ? B : never}${infer _}` ? true : false;
482
521
  declare 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;
483
- declare type Split<S, TTrailing = true> = S extends unknown ? string extends S ? string[] : S extends string ? CleanPath<S> extends '' ? [] : TTrailing extends true ? CleanPath<S> extends `${infer T}/` ? [T, '/'] : CleanPath<S> extends `/${infer U}` ? ['/', U] : CleanPath<S> extends `${infer T}/${infer U}` ? [T, ...Split<U>] : [S] : CleanPath<S> extends `${infer T}/${infer U}` ? [T, ...Split<U>] : [S] : never : never;
522
+ declare 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;
484
523
  declare type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends `:${infer V}` ? V : never : never;
485
524
  declare type Join<T> = T extends [] ? '' : T extends [infer L extends string] ? L : T extends [infer L extends string, ...infer Tail extends [...string[]]] ? CleanPath<`${L}/${Join<Tail>}`> : never;
486
525
  declare type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, TTo extends string, SplitPaths extends string[] = Split<AllPaths, false>> = TTo extends `..${infer _}` ? SplitPaths extends [
@@ -501,7 +540,7 @@ declare type ToOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteIn
501
540
  to?: ToPathOption<TAllRouteInfo, TFrom, TTo>;
502
541
  hash?: Updater<string>;
503
542
  from?: TFrom;
504
- } & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo>> & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
543
+ } & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
505
544
  declare type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema'], TToSchema = RouteInfoByPath<TAllRouteInfo, TTo>['fullSearchSchema']> = StartsWith<TFrom, TTo> extends true ? {
506
545
  search?: SearchReducer<TFromSchema, TToSchema>;
507
546
  } : keyof PickRequired<TToSchema> extends never ? {
@@ -539,12 +578,17 @@ declare type CheckRelativePath<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo
539
578
  Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<TFrom, TTo>}, which is not a valid route path.`;
540
579
  'Valid Route Paths': TAllRouteInfo['routePaths'];
541
580
  } : {} : {};
542
- declare type CheckPath<TAllRouteInfo extends AnyAllRouteInfo, TPath> = Exclude<TPath, TAllRouteInfo['routePaths']> extends never ? {} : CheckPathError<TAllRouteInfo, Exclude<TPath, TAllRouteInfo['routePaths']>>;
543
- declare type CheckPathError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = {
581
+ declare type CheckPath<TAllRouteInfo extends AnyAllRouteInfo, TPath, TPass> = Exclude<TPath, TAllRouteInfo['routePaths']> extends never ? TPass : CheckPathError<TAllRouteInfo, Exclude<TPath, TAllRouteInfo['routePaths']>>;
582
+ declare type CheckPathError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = Expand<{
544
583
  Error: `${TInvalids extends string ? TInvalids : never} is not a valid route path.`;
545
584
  'Valid Route Paths': TAllRouteInfo['routePaths'];
546
- };
547
- declare 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] ? ResolveRelativePath<Join<FromRest>, Join<ToRest>> : never : Split<TTo> extends ['.', ...infer ToRest] ? ResolveRelativePath<TFrom, Join<ToRest>> : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>> : never : never;
585
+ }>;
586
+ declare type CheckId<TAllRouteInfo extends AnyAllRouteInfo, TPath, TPass> = Exclude<TPath, TAllRouteInfo['routeIds']> extends never ? TPass : CheckIdError<TAllRouteInfo, Exclude<TPath, TAllRouteInfo['routeIds']>>;
587
+ declare type CheckIdError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = Expand<{
588
+ Error: `${TInvalids extends string ? TInvalids : never} is not a valid route ID.`;
589
+ 'Valid Route IDs': TAllRouteInfo['routeIds'];
590
+ }>;
591
+ declare 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;
548
592
  declare type ValidFromPath<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = undefined | (string extends TAllRouteInfo['routePaths'] ? string : TAllRouteInfo['routePaths']);
549
593
 
550
594
  interface Segment {
@@ -570,4 +614,4 @@ declare const defaultStringifySearch: (search: Record<string, any>) => string;
570
614
  declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
571
615
  declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
572
616
 
573
- export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultAllRouteInfo, DefinedPathParamWarning, Expand, FilterRoutesFn, FrameworkGenerics, FromLocation, GetFrameworkGeneric, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, LoaderFn, Location, LocationState, MatchCacheEntry, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, ParseRouteConfig, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath, RouteLoaders, RouteMatch, RouteMeta, RouteOptions, Router, RouterOptions, RouterState, RoutesById, RoutesInfoInner, SearchFilter, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, Timeout, ToIdOption, ToOptions, ToPathOption, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, cascadeLoaderData, cleanPath, createRoute, createRouteConfig, createRouteMatch, createRouter, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };
617
+ export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultAllRouteInfo, DefinedPathParamWarning, Expand, FilterRoutesFn, FrameworkGenerics, FromLocation, GetFrameworkGeneric, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, Loader, LoaderContext, LoaderFn, LoaderState, Location, LocationState, MatchCacheEntry, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, ParseRouteConfig, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath, RouteMatch, RouteMeta, RouteOptions, Router, RouterOptions, RouterState, RoutesById, RoutesInfoInner, SearchFilter, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, Timeout, ToIdOption, ToOptions, ToPathOption, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, cleanPath, createRoute, createRouteConfig, createRouteMatch, createRouter, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };