@tanstack/react-router 1.111.3 → 1.111.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/cjs/Matches.cjs.map +1 -1
  2. package/dist/cjs/Matches.d.cts +9 -44
  3. package/dist/cjs/fileRoute.cjs +4 -1
  4. package/dist/cjs/fileRoute.cjs.map +1 -1
  5. package/dist/cjs/fileRoute.d.cts +5 -5
  6. package/dist/cjs/index.d.cts +4 -6
  7. package/dist/cjs/redirects.cjs.map +1 -1
  8. package/dist/cjs/redirects.d.cts +2 -16
  9. package/dist/cjs/route.cjs.map +1 -1
  10. package/dist/cjs/route.d.cts +8 -109
  11. package/dist/cjs/router.cjs.map +1 -1
  12. package/dist/cjs/router.d.cts +4 -5
  13. package/dist/cjs/typePrimitives.d.cts +3 -4
  14. package/dist/cjs/useLoaderData.cjs.map +1 -1
  15. package/dist/cjs/useLoaderData.d.cts +2 -5
  16. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  17. package/dist/cjs/useLoaderDeps.d.cts +2 -5
  18. package/dist/cjs/useMatch.cjs.map +1 -1
  19. package/dist/cjs/useMatch.d.cts +1 -3
  20. package/dist/cjs/useNavigate.cjs.map +1 -1
  21. package/dist/cjs/useNavigate.d.cts +1 -2
  22. package/dist/cjs/useParams.cjs.map +1 -1
  23. package/dist/cjs/useParams.d.cts +2 -5
  24. package/dist/cjs/useRouteContext.cjs.map +1 -1
  25. package/dist/cjs/useRouteContext.d.cts +1 -8
  26. package/dist/cjs/useSearch.cjs.map +1 -1
  27. package/dist/cjs/useSearch.d.cts +2 -5
  28. package/dist/cjs/utils.cjs.map +1 -1
  29. package/dist/cjs/utils.d.cts +0 -8
  30. package/dist/esm/Matches.d.ts +9 -44
  31. package/dist/esm/Matches.js.map +1 -1
  32. package/dist/esm/fileRoute.d.ts +5 -5
  33. package/dist/esm/fileRoute.js +4 -1
  34. package/dist/esm/fileRoute.js.map +1 -1
  35. package/dist/esm/index.d.ts +4 -6
  36. package/dist/esm/redirects.d.ts +2 -16
  37. package/dist/esm/redirects.js.map +1 -1
  38. package/dist/esm/route.d.ts +8 -109
  39. package/dist/esm/route.js.map +1 -1
  40. package/dist/esm/router.d.ts +4 -5
  41. package/dist/esm/router.js.map +1 -1
  42. package/dist/esm/typePrimitives.d.ts +3 -4
  43. package/dist/esm/useLoaderData.d.ts +2 -5
  44. package/dist/esm/useLoaderData.js.map +1 -1
  45. package/dist/esm/useLoaderDeps.d.ts +2 -5
  46. package/dist/esm/useLoaderDeps.js.map +1 -1
  47. package/dist/esm/useMatch.d.ts +1 -3
  48. package/dist/esm/useMatch.js.map +1 -1
  49. package/dist/esm/useNavigate.d.ts +1 -2
  50. package/dist/esm/useNavigate.js.map +1 -1
  51. package/dist/esm/useParams.d.ts +2 -5
  52. package/dist/esm/useParams.js.map +1 -1
  53. package/dist/esm/useRouteContext.d.ts +1 -8
  54. package/dist/esm/useRouteContext.js.map +1 -1
  55. package/dist/esm/useSearch.d.ts +2 -5
  56. package/dist/esm/useSearch.js.map +1 -1
  57. package/dist/esm/utils.d.ts +0 -8
  58. package/dist/esm/utils.js.map +1 -1
  59. package/package.json +2 -2
  60. package/src/Matches.tsx +9 -105
  61. package/src/fileRoute.ts +16 -13
  62. package/src/index.tsx +20 -18
  63. package/src/redirects.ts +4 -36
  64. package/src/route.ts +12 -531
  65. package/src/router.ts +9 -10
  66. package/src/typePrimitives.ts +6 -3
  67. package/src/useLoaderData.tsx +6 -20
  68. package/src/useLoaderDeps.tsx +6 -13
  69. package/src/useMatch.tsx +6 -3
  70. package/src/useNavigate.tsx +5 -12
  71. package/src/useParams.tsx +4 -22
  72. package/src/useRouteContext.ts +5 -36
  73. package/src/useSearch.tsx +4 -22
  74. package/src/utils.ts +0 -19
package/src/redirects.ts CHANGED
@@ -1,41 +1,9 @@
1
- import type { AnyRouter, RegisteredRouter } from './router'
2
1
  import type {
3
- NavigateOptions,
4
- PickAsRequired,
5
- RoutePaths,
2
+ AnyRedirect,
3
+ Redirect,
4
+ ResolvedRedirect,
6
5
  } from '@tanstack/router-core'
7
-
8
- export type AnyRedirect = Redirect<any, any, any, any, any>
9
-
10
- export type Redirect<
11
- TRouter extends AnyRouter = RegisteredRouter,
12
- TFrom extends RoutePaths<TRouter['routeTree']> | string = '/',
13
- TTo extends string | undefined = '.',
14
- TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,
15
- TMaskTo extends string = '.',
16
- > = {
17
- href?: string
18
- /**
19
- * @deprecated Use `statusCode` instead
20
- **/
21
- code?: number
22
- statusCode?: number
23
- throw?: any
24
- headers?: HeadersInit
25
- } & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
26
-
27
- export type ResolvedRedirect<
28
- TRouter extends AnyRouter = RegisteredRouter,
29
- TFrom extends RoutePaths<TRouter['routeTree']> = '/',
30
- TTo extends string = '',
31
- TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom,
32
- TMaskTo extends string = '',
33
- > = PickAsRequired<
34
- Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
35
- 'code' | 'statusCode' | 'headers'
36
- > & {
37
- href: string
38
- }
6
+ import type { RegisteredRouter } from './router'
39
7
 
40
8
  export function redirect<
41
9
  TRouter extends RegisteredRouter,
package/src/route.ts CHANGED
@@ -9,48 +9,30 @@ import { useNavigate } from './useNavigate'
9
9
  import { useMatch } from './useMatch'
10
10
  import type {
11
11
  AnyContext,
12
- AnyPathParams,
13
12
  AnySchema,
14
- AnyValidator,
15
- BeforeLoadContextParameter,
16
- BuildLocationFn,
17
13
  Constrain,
18
14
  ConstrainLiteral,
19
15
  RootRoute as CoreRootRoute,
20
16
  Route as CoreRoute,
21
- DefaultValidator,
22
17
  ErrorComponentProps,
23
- Expand,
24
- FullSearchSchemaOption,
25
- NavigateFn,
26
- NavigateOptions,
27
- NoInfer,
28
18
  NotFoundRouteProps,
29
- ParamsOptions,
30
- ParsedLocation,
31
- RemountDepsOptions,
32
- ResolveAllContext,
33
- ResolveAllParamsFromParent,
34
19
  ResolveFullPath,
35
- ResolveFullSearchSchema,
36
- ResolveFullSearchSchemaInput,
37
20
  ResolveId,
38
- ResolveLoaderData,
39
21
  ResolveParams,
40
22
  RootRouteId,
23
+ RootRouteOptions,
41
24
  RouteById,
42
25
  RouteContext,
43
- RouteContextParameter,
44
26
  RouteIds,
45
- RoutePathOptions,
27
+ RouteLoaderFn,
28
+ RouteOptions,
46
29
  RoutePathOptionsIntersection,
47
30
  RoutePaths,
48
31
  RouteTypes,
49
- SearchFilter,
50
- SearchMiddleware,
51
32
  ToMaskOptions,
52
33
  TrimPathRight,
53
- UpdatableStaticRouteOption,
34
+ UpdatableRouteOptions,
35
+ UseNavigateResult,
54
36
  } from '@tanstack/router-core'
55
37
  import type { UseLoaderDataRoute } from './useLoaderData'
56
38
  import type { UseMatchRoute } from './useMatch'
@@ -58,489 +40,19 @@ import type { UseLoaderDepsRoute } from './useLoaderDeps'
58
40
  import type { UseParamsRoute } from './useParams'
59
41
  import type { UseSearchRoute } from './useSearch'
60
42
  import type * as React from 'react'
61
- import type { UseNavigateResult } from './useNavigate'
62
- import type {
63
- AnyRouteMatch,
64
- MakeRouteMatchFromRoute,
65
- MakeRouteMatchUnion,
66
- RouteMatch,
67
- } from './Matches'
43
+ import type {} from './Matches'
68
44
  import type { AnyRouter, RegisteredRouter, Router } from './router'
69
45
  import type { NotFoundError } from './not-found'
70
46
  import type { LazyRoute } from './fileRoute'
71
-
72
47
  import type { UseRouteContextRoute } from './useRouteContext'
73
48
 
74
- export type RouteOptions<
75
- TParentRoute extends AnyRoute = AnyRoute,
76
- TId extends string = string,
77
- TCustomId extends string = string,
78
- TFullPath extends string = string,
79
- TPath extends string = string,
80
- TSearchValidator = undefined,
81
- TParams = AnyPathParams,
82
- TLoaderDeps extends Record<string, any> = {},
83
- TLoaderFn = undefined,
84
- TRouterContext = {},
85
- TRouteContextFn = AnyContext,
86
- TBeforeLoadFn = AnyContext,
87
- > = BaseRouteOptions<
88
- TParentRoute,
89
- TId,
90
- TCustomId,
91
- TPath,
92
- TSearchValidator,
93
- TParams,
94
- TLoaderDeps,
95
- TLoaderFn,
96
- TRouterContext,
97
- TRouteContextFn,
98
- TBeforeLoadFn
99
- > &
100
- UpdatableRouteOptions<
101
- NoInfer<TParentRoute>,
102
- NoInfer<TCustomId>,
103
- NoInfer<TFullPath>,
104
- NoInfer<TParams>,
105
- NoInfer<TSearchValidator>,
106
- NoInfer<TLoaderFn>,
107
- NoInfer<TLoaderDeps>,
108
- NoInfer<TRouterContext>,
109
- NoInfer<TRouteContextFn>,
110
- NoInfer<TBeforeLoadFn>
111
- >
112
-
113
- export type RouteContextFn<
114
- in out TParentRoute extends AnyRoute,
115
- in out TSearchValidator,
116
- in out TParams,
117
- in out TRouterContext,
118
- > = (
119
- ctx: RouteContextOptions<
120
- TParentRoute,
121
- TSearchValidator,
122
- TParams,
123
- TRouterContext
124
- >,
125
- ) => any
126
-
127
- export type BeforeLoadFn<
128
- in out TParentRoute extends AnyRoute,
129
- in out TSearchValidator,
130
- in out TParams,
131
- in out TRouterContext,
132
- in out TRouteContextFn,
133
- > = (
134
- ctx: BeforeLoadContextOptions<
135
- TParentRoute,
136
- TSearchValidator,
137
- TParams,
138
- TRouterContext,
139
- TRouteContextFn
140
- >,
141
- ) => any
142
-
143
- export type FileBaseRouteOptions<
144
- TParentRoute extends AnyRoute = AnyRoute,
145
- TId extends string = string,
146
- TPath extends string = string,
147
- TSearchValidator = undefined,
148
- TParams = {},
149
- TLoaderDeps extends Record<string, any> = {},
150
- TLoaderFn = undefined,
151
- TRouterContext = {},
152
- TRouteContextFn = AnyContext,
153
- TBeforeLoadFn = AnyContext,
154
- TRemountDepsFn = AnyContext,
155
- > = ParamsOptions<TPath, TParams> & {
156
- validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>
157
-
158
- shouldReload?:
159
- | boolean
160
- | ((
161
- match: LoaderFnContext<
162
- TParentRoute,
163
- TId,
164
- TParams,
165
- TLoaderDeps,
166
- TRouterContext,
167
- TRouteContextFn,
168
- TBeforeLoadFn
169
- >,
170
- ) => any)
171
-
172
- context?: Constrain<
173
- TRouteContextFn,
174
- (
175
- ctx: RouteContextOptions<
176
- TParentRoute,
177
- TParams,
178
- TRouterContext,
179
- TLoaderDeps
180
- >,
181
- ) => any
182
- >
183
-
184
- // This async function is called before a route is loaded.
185
- // If an error is thrown here, the route's loader will not be called.
186
- // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.
187
- // If thrown during a preload event, the error will be logged to the console.
188
- beforeLoad?: Constrain<
189
- TBeforeLoadFn,
190
- (
191
- ctx: BeforeLoadContextOptions<
192
- TParentRoute,
193
- TSearchValidator,
194
- TParams,
195
- TRouterContext,
196
- TRouteContextFn
197
- >,
198
- ) => any
199
- >
200
-
201
- loaderDeps?: (
202
- opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>,
203
- ) => TLoaderDeps
204
-
205
- remountDeps?: Constrain<
206
- TRemountDepsFn,
207
- (
208
- opt: RemountDepsOptions<
209
- TId,
210
- FullSearchSchemaOption<TParentRoute, TSearchValidator>,
211
- Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>,
212
- TLoaderDeps
213
- >,
214
- ) => any
215
- >
216
-
217
- loader?: Constrain<
218
- TLoaderFn,
219
- (
220
- ctx: LoaderFnContext<
221
- TParentRoute,
222
- TId,
223
- TParams,
224
- TLoaderDeps,
225
- TRouterContext,
226
- TRouteContextFn,
227
- TBeforeLoadFn
228
- >,
229
- ) => any
230
- >
231
- }
232
-
233
- export type BaseRouteOptions<
234
- TParentRoute extends AnyRoute = AnyRoute,
235
- TId extends string = string,
236
- TCustomId extends string = string,
237
- TPath extends string = string,
238
- TSearchValidator = undefined,
239
- TParams = {},
240
- TLoaderDeps extends Record<string, any> = {},
241
- TLoaderFn = undefined,
242
- TRouterContext = {},
243
- TRouteContextFn = AnyContext,
244
- TBeforeLoadFn = AnyContext,
245
- > = RoutePathOptions<TCustomId, TPath> &
246
- FileBaseRouteOptions<
247
- TParentRoute,
248
- TId,
249
- TPath,
250
- TSearchValidator,
251
- TParams,
252
- TLoaderDeps,
253
- TLoaderFn,
254
- TRouterContext,
255
- TRouteContextFn,
256
- TBeforeLoadFn
257
- > & {
258
- getParentRoute: () => TParentRoute
259
- }
260
-
261
- export interface ContextOptions<
262
- in out TParentRoute extends AnyRoute,
263
- in out TParams,
264
- > {
265
- abortController: AbortController
266
- preload: boolean
267
- params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
268
- location: ParsedLocation
269
- /**
270
- * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
271
- **/
272
- navigate: NavigateFn
273
- buildLocation: BuildLocationFn
274
- cause: 'preload' | 'enter' | 'stay'
275
- matches: Array<MakeRouteMatchUnion>
276
- }
277
-
278
- export interface RouteContextOptions<
279
- in out TParentRoute extends AnyRoute,
280
- in out TParams,
281
- in out TRouterContext,
282
- in out TLoaderDeps,
283
- > extends ContextOptions<TParentRoute, TParams> {
284
- deps: TLoaderDeps
285
- context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>
286
- }
287
-
288
- export interface BeforeLoadContextOptions<
289
- in out TParentRoute extends AnyRoute,
290
- in out TSearchValidator,
291
- in out TParams,
292
- in out TRouterContext,
293
- in out TRouteContextFn,
294
- > extends ContextOptions<TParentRoute, TParams>,
295
- FullSearchSchemaOption<TParentRoute, TSearchValidator> {
296
- context: Expand<
297
- BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>
298
- >
299
- }
300
-
301
- type AssetFnContextOptions<
302
- in out TRouteId,
303
- in out TFullPath,
304
- in out TParentRoute extends AnyRoute,
305
- in out TParams,
306
- in out TSearchValidator,
307
- in out TLoaderFn,
308
- in out TRouterContext,
309
- in out TRouteContextFn,
310
- in out TBeforeLoadFn,
311
- in out TLoaderDeps,
312
- > = {
313
- matches: Array<
314
- RouteMatch<
315
- TRouteId,
316
- TFullPath,
317
- ResolveAllParamsFromParent<TParentRoute, TParams>,
318
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
319
- ResolveLoaderData<TLoaderFn>,
320
- ResolveAllContext<
321
- TParentRoute,
322
- TRouterContext,
323
- TRouteContextFn,
324
- TBeforeLoadFn
325
- >,
326
- TLoaderDeps
327
- >
328
- >
329
- match: RouteMatch<
330
- TRouteId,
331
- TFullPath,
332
- ResolveAllParamsFromParent<TParentRoute, TParams>,
333
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
334
- ResolveLoaderData<TLoaderFn>,
335
- ResolveAllContext<
336
- TParentRoute,
337
- TRouterContext,
338
- TRouteContextFn,
339
- TBeforeLoadFn
340
- >,
341
- TLoaderDeps
342
- >
343
- params: ResolveAllParamsFromParent<TParentRoute, TParams>
344
- loaderData: ResolveLoaderData<TLoaderFn>
345
- }
346
- export interface UpdatableRouteOptions<
347
- in out TParentRoute extends AnyRoute,
348
- in out TRouteId,
349
- in out TFullPath,
350
- in out TParams,
351
- in out TSearchValidator,
352
- in out TLoaderFn,
353
- in out TLoaderDeps,
354
- in out TRouterContext,
355
- in out TRouteContextFn,
356
- in out TBeforeLoadFn,
357
- > extends UpdatableStaticRouteOption {
358
- // If true, this route will be matched as case-sensitive
359
- caseSensitive?: boolean
360
- // If true, this route will be forcefully wrapped in a suspense boundary
361
- wrapInSuspense?: boolean
362
- // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`
363
- component?: RouteComponent
364
- errorComponent?: false | null | ErrorRouteComponent
365
- notFoundComponent?: NotFoundRouteComponent
366
- pendingComponent?: RouteComponent
367
- pendingMs?: number
368
- pendingMinMs?: number
369
- staleTime?: number
370
- gcTime?: number
371
- preload?: boolean
372
- preloadStaleTime?: number
373
- preloadGcTime?: number
374
- search?: {
375
- middlewares?: Array<
376
- SearchMiddleware<
377
- ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>
378
- >
379
- >
380
- }
381
- /**
382
- @deprecated Use search.middlewares instead
383
- */
384
- preSearchFilters?: Array<
385
- SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
386
- >
387
- /**
388
- @deprecated Use search.middlewares instead
389
- */
390
- postSearchFilters?: Array<
391
- SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
392
- >
393
- onCatch?: (error: Error, errorInfo: React.ErrorInfo) => void
394
- onError?: (err: any) => void
395
- // These functions are called as route matches are loaded, stick around and leave the active
396
- // matches
397
- onEnter?: (
398
- match: RouteMatch<
399
- TRouteId,
400
- TFullPath,
401
- ResolveAllParamsFromParent<TParentRoute, TParams>,
402
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
403
- ResolveLoaderData<TLoaderFn>,
404
- ResolveAllContext<
405
- TParentRoute,
406
- TRouterContext,
407
- TRouteContextFn,
408
- TBeforeLoadFn
409
- >,
410
- TLoaderDeps
411
- >,
412
- ) => void
413
- onStay?: (
414
- match: RouteMatch<
415
- TRouteId,
416
- TFullPath,
417
- ResolveAllParamsFromParent<TParentRoute, TParams>,
418
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
419
- ResolveLoaderData<TLoaderFn>,
420
- ResolveAllContext<
421
- TParentRoute,
422
- TRouterContext,
423
- TRouteContextFn,
424
- TBeforeLoadFn
425
- >,
426
- TLoaderDeps
427
- >,
428
- ) => void
429
- onLeave?: (
430
- match: RouteMatch<
431
- TRouteId,
432
- TFullPath,
433
- ResolveAllParamsFromParent<TParentRoute, TParams>,
434
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
435
- ResolveLoaderData<TLoaderFn>,
436
- ResolveAllContext<
437
- TParentRoute,
438
- TRouterContext,
439
- TRouteContextFn,
440
- TBeforeLoadFn
441
- >,
442
- TLoaderDeps
443
- >,
444
- ) => void
445
- headers?: (ctx: {
446
- loaderData: ResolveLoaderData<TLoaderFn>
447
- }) => Record<string, string>
448
- head?: (
449
- ctx: AssetFnContextOptions<
450
- TRouteId,
451
- TFullPath,
452
- TParentRoute,
453
- TParams,
454
- TSearchValidator,
455
- TLoaderFn,
456
- TRouterContext,
457
- TRouteContextFn,
458
- TBeforeLoadFn,
459
- TLoaderDeps
460
- >,
461
- ) => {
462
- links?: AnyRouteMatch['links']
463
- scripts?: AnyRouteMatch['headScripts']
464
- meta?: AnyRouteMatch['meta']
49
+ declare module '@tanstack/router-core' {
50
+ export interface UpdatableRouteOptionsExtensions {
51
+ component?: RouteComponent
52
+ errorComponent?: false | null | ErrorRouteComponent
53
+ notFoundComponent?: NotFoundRouteComponent
54
+ pendingComponent?: RouteComponent
465
55
  }
466
- scripts?: (
467
- ctx: AssetFnContextOptions<
468
- TRouteId,
469
- TFullPath,
470
- TParentRoute,
471
- TParams,
472
- TSearchValidator,
473
- TLoaderFn,
474
- TRouterContext,
475
- TRouteContextFn,
476
- TBeforeLoadFn,
477
- TLoaderDeps
478
- >,
479
- ) => AnyRouteMatch['scripts']
480
- ssr?: boolean
481
- codeSplitGroupings?: Array<
482
- Array<
483
- | 'loader'
484
- | 'component'
485
- | 'pendingComponent'
486
- | 'notFoundComponent'
487
- | 'errorComponent'
488
- >
489
- >
490
- }
491
-
492
- export type RouteLoaderFn<
493
- in out TParentRoute extends AnyRoute = AnyRoute,
494
- in out TId extends string = string,
495
- in out TParams = {},
496
- in out TLoaderDeps = {},
497
- in out TRouterContext = {},
498
- in out TRouteContextFn = AnyContext,
499
- in out TBeforeLoadFn = AnyContext,
500
- > = (
501
- match: LoaderFnContext<
502
- TParentRoute,
503
- TId,
504
- TParams,
505
- TLoaderDeps,
506
- TRouterContext,
507
- TRouteContextFn,
508
- TBeforeLoadFn
509
- >,
510
- ) => any
511
-
512
- export interface LoaderFnContext<
513
- in out TParentRoute extends AnyRoute = AnyRoute,
514
- in out TId extends string = string,
515
- in out TParams = {},
516
- in out TLoaderDeps = {},
517
- in out TRouterContext = {},
518
- in out TRouteContextFn = AnyContext,
519
- in out TBeforeLoadFn = AnyContext,
520
- > {
521
- abortController: AbortController
522
- preload: boolean
523
- params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
524
- deps: TLoaderDeps
525
- context: Expand<
526
- ResolveAllContext<
527
- TParentRoute,
528
- TRouterContext,
529
- TRouteContextFn,
530
- TBeforeLoadFn
531
- >
532
- >
533
- location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps
534
- /**
535
- * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
536
- **/
537
- navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void
538
- // root route does not have a parent match
539
- parentMatchPromise: TId extends RootRouteId
540
- ? never
541
- : Promise<MakeRouteMatchFromRoute<TParentRoute>>
542
- cause: 'preload' | 'enter' | 'stay'
543
- route: Route
544
56
  }
545
57
 
546
58
  export interface AnyRoute
@@ -1120,37 +632,6 @@ export function createRoute<
1120
632
 
1121
633
  export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>
1122
634
 
1123
- export type RootRouteOptions<
1124
- TSearchValidator = undefined,
1125
- TRouterContext = {},
1126
- TRouteContextFn = AnyContext,
1127
- TBeforeLoadFn = AnyContext,
1128
- TLoaderDeps extends Record<string, any> = {},
1129
- TLoaderFn = undefined,
1130
- > = Omit<
1131
- RouteOptions<
1132
- any, // TParentRoute
1133
- RootRouteId, // TId
1134
- RootRouteId, // TCustomId
1135
- '', // TFullPath
1136
- '', // TPath
1137
- TSearchValidator,
1138
- {}, // TParams
1139
- TLoaderDeps,
1140
- TLoaderFn,
1141
- TRouterContext,
1142
- TRouteContextFn,
1143
- TBeforeLoadFn
1144
- >,
1145
- | 'path'
1146
- | 'id'
1147
- | 'getParentRoute'
1148
- | 'caseSensitive'
1149
- | 'parseParams'
1150
- | 'stringifyParams'
1151
- | 'params'
1152
- >
1153
-
1154
635
  export function createRootRouteWithContext<TRouterContext extends {}>() {
1155
636
  return <
1156
637
  TRouteContextFn = AnyContext,
package/src/router.ts CHANGED
@@ -41,13 +41,19 @@ import type { NoInfer } from '@tanstack/react-store'
41
41
 
42
42
  import type {
43
43
  AnyContext,
44
+ AnyRedirect,
45
+ AnyRouteMatch,
44
46
  AnySchema,
45
47
  AnyValidator,
48
+ BeforeLoadContextOptions,
46
49
  BuildLocationFn,
47
50
  CommitLocationOptions,
48
51
  ControlledPromise,
49
52
  FullSearchSchema,
53
+ LoaderFnContext,
50
54
  MakeRemountDepsOptionsUnion,
55
+ MakeRouteMatch,
56
+ MakeRouteMatchUnion,
51
57
  Manifest,
52
58
  NavigateFn,
53
59
  NavigateOptions,
@@ -56,7 +62,9 @@ import type {
56
62
  PickAsRequired,
57
63
  Register,
58
64
  ResolveRelativePath,
65
+ ResolvedRedirect,
59
66
  RouteById,
67
+ RouteContextOptions,
60
68
  RoutePaths,
61
69
  RoutesById,
62
70
  RoutesByPath,
@@ -71,24 +79,15 @@ import type {
71
79
  } from '@tanstack/router-core'
72
80
  import type {
73
81
  AnyRoute,
74
- BeforeLoadContextOptions,
75
82
  ErrorRouteComponent,
76
- LoaderFnContext,
77
83
  NotFoundRouteComponent,
78
84
  RootRoute,
79
85
  RouteComponent,
80
- RouteContextOptions,
81
86
  RouteMask,
82
87
  } from './route'
83
88
 
84
- import type {
85
- AnyRouteMatch,
86
- MakeRouteMatch,
87
- MakeRouteMatchUnion,
88
- MatchRouteOptions,
89
- } from './Matches'
89
+ import type { MatchRouteOptions } from './Matches'
90
90
 
91
- import type { AnyRedirect, ResolvedRedirect } from './redirects'
92
91
  import type { NotFoundError } from './not-found'
93
92
 
94
93
  declare global {
@@ -4,15 +4,18 @@ import type {
4
4
  FromPathOption,
5
5
  NavigateOptions,
6
6
  PathParamOptions,
7
+ Redirect,
7
8
  RouteIds,
8
9
  SearchParamOptions,
9
10
  ToPathOption,
11
+ UseParamsResult,
12
+ UseSearchResult,
10
13
  } from '@tanstack/router-core'
11
14
  import type { LinkComponentProps } from './link'
12
- import type { Redirect } from './redirects'
13
15
  import type { AnyRouter, RegisteredRouter } from './router'
14
- import type { UseParamsOptions, UseParamsResult } from './useParams'
15
- import type { UseSearchOptions, UseSearchResult } from './useSearch'
16
+
17
+ import type { UseParamsOptions } from './useParams'
18
+ import type { UseSearchOptions } from './useSearch'
16
19
 
17
20
  export type ValidateFromPath<
18
21
  TRouter extends AnyRouter = RegisteredRouter,