@tanstack/solid-router 1.111.4 → 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 (97) hide show
  1. package/dist/cjs/Matches.cjs.map +1 -1
  2. package/dist/cjs/Matches.d.cts +8 -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 +3 -5
  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 -4
  16. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  17. package/dist/cjs/useLoaderDeps.d.cts +2 -4
  18. package/dist/cjs/useMatch.cjs.map +1 -1
  19. package/dist/cjs/useMatch.d.cts +1 -2
  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 -4
  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 -4
  28. package/dist/esm/Matches.d.ts +8 -44
  29. package/dist/esm/Matches.js.map +1 -1
  30. package/dist/esm/fileRoute.d.ts +5 -5
  31. package/dist/esm/fileRoute.js +4 -1
  32. package/dist/esm/fileRoute.js.map +1 -1
  33. package/dist/esm/index.d.ts +3 -5
  34. package/dist/esm/redirects.d.ts +2 -16
  35. package/dist/esm/redirects.js.map +1 -1
  36. package/dist/esm/route.d.ts +8 -109
  37. package/dist/esm/route.js.map +1 -1
  38. package/dist/esm/router.d.ts +4 -5
  39. package/dist/esm/router.js.map +1 -1
  40. package/dist/esm/typePrimitives.d.ts +3 -4
  41. package/dist/esm/useLoaderData.d.ts +2 -4
  42. package/dist/esm/useLoaderData.js.map +1 -1
  43. package/dist/esm/useLoaderDeps.d.ts +2 -4
  44. package/dist/esm/useLoaderDeps.js.map +1 -1
  45. package/dist/esm/useMatch.d.ts +1 -2
  46. package/dist/esm/useMatch.js.map +1 -1
  47. package/dist/esm/useNavigate.d.ts +1 -2
  48. package/dist/esm/useNavigate.js.map +1 -1
  49. package/dist/esm/useParams.d.ts +2 -4
  50. package/dist/esm/useParams.js.map +1 -1
  51. package/dist/esm/useRouteContext.d.ts +1 -8
  52. package/dist/esm/useRouteContext.js.map +1 -1
  53. package/dist/esm/useSearch.d.ts +2 -4
  54. package/dist/esm/useSearch.js.map +1 -1
  55. package/dist/source/Matches.d.ts +8 -44
  56. package/dist/source/Matches.jsx.map +1 -1
  57. package/dist/source/fileRoute.d.ts +5 -5
  58. package/dist/source/fileRoute.js +4 -1
  59. package/dist/source/fileRoute.js.map +1 -1
  60. package/dist/source/index.d.ts +3 -5
  61. package/dist/source/index.jsx.map +1 -1
  62. package/dist/source/redirects.d.ts +2 -16
  63. package/dist/source/redirects.js.map +1 -1
  64. package/dist/source/route.d.ts +8 -109
  65. package/dist/source/route.js.map +1 -1
  66. package/dist/source/router.d.ts +4 -5
  67. package/dist/source/router.js.map +1 -1
  68. package/dist/source/typePrimitives.d.ts +3 -4
  69. package/dist/source/useLoaderData.d.ts +2 -4
  70. package/dist/source/useLoaderData.jsx.map +1 -1
  71. package/dist/source/useLoaderDeps.d.ts +2 -4
  72. package/dist/source/useLoaderDeps.jsx.map +1 -1
  73. package/dist/source/useMatch.d.ts +1 -2
  74. package/dist/source/useMatch.jsx.map +1 -1
  75. package/dist/source/useNavigate.d.ts +1 -2
  76. package/dist/source/useNavigate.jsx.map +1 -1
  77. package/dist/source/useParams.d.ts +2 -4
  78. package/dist/source/useParams.jsx.map +1 -1
  79. package/dist/source/useRouteContext.d.ts +1 -8
  80. package/dist/source/useRouteContext.js.map +1 -1
  81. package/dist/source/useSearch.d.ts +2 -4
  82. package/dist/source/useSearch.jsx.map +1 -1
  83. package/package.json +2 -2
  84. package/src/Matches.tsx +8 -105
  85. package/src/fileRoute.ts +16 -14
  86. package/src/index.tsx +16 -18
  87. package/src/redirects.ts +4 -36
  88. package/src/route.ts +11 -532
  89. package/src/router.ts +9 -10
  90. package/src/typePrimitives.ts +5 -3
  91. package/src/useLoaderData.tsx +5 -19
  92. package/src/useLoaderDeps.tsx +5 -11
  93. package/src/useMatch.tsx +5 -2
  94. package/src/useNavigate.tsx +5 -12
  95. package/src/useParams.tsx +3 -20
  96. package/src/useRouteContext.ts +5 -36
  97. package/src/useSearch.tsx +3 -21
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
- ResolveFullSearchSchema,
35
- ResolveFullSearchSchemaInput,
36
19
  ResolveId,
37
- ResolveLoaderData,
38
20
  ResolveParams,
39
21
  RootRouteId,
22
+ RootRouteOptions,
40
23
  RouteById,
41
24
  RouteContext,
42
- RouteContextParameter,
43
25
  RouteIds,
44
- RoutePathOptions,
26
+ RouteLoaderFn,
27
+ RouteOptions,
45
28
  RoutePathOptionsIntersection,
46
29
  RoutePaths,
47
30
  RoutePrefix,
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,490 +40,18 @@ import type { UseLoaderDepsRoute } from './useLoaderDeps'
58
40
  import type { UseParamsRoute } from './useParams'
59
41
  import type { UseSearchRoute } from './useSearch'
60
42
  import type * as Solid from 'solid-js'
61
- import type { UseNavigateResult } from './useNavigate'
62
- import type {
63
- AnyRouteMatch,
64
- MakeRouteMatchFromRoute,
65
- MakeRouteMatchUnion,
66
- RouteMatch,
67
- } from './Matches'
68
43
  import type { AnyRouter, RegisteredRouter, Router } from './router'
69
44
  import type { NotFoundError } from './not-found'
70
45
  import type { LazyRoute } from './fileRoute'
71
-
72
46
  import type { UseRouteContextRoute } from './useRouteContext'
73
47
 
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
48
+ declare module '@tanstack/router-core' {
49
+ export interface UpdatableRouteOptionsExtensions {
50
+ component?: RouteComponent
51
+ errorComponent?: false | null | ErrorRouteComponent
52
+ notFoundComponent?: NotFoundRouteComponent
53
+ pendingComponent?: RouteComponent
259
54
  }
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
-
347
- export interface UpdatableRouteOptions<
348
- in out TParentRoute extends AnyRoute,
349
- in out TRouteId,
350
- in out TFullPath,
351
- in out TParams,
352
- in out TSearchValidator,
353
- in out TLoaderFn,
354
- in out TLoaderDeps,
355
- in out TRouterContext,
356
- in out TRouteContextFn,
357
- in out TBeforeLoadFn,
358
- > extends UpdatableStaticRouteOption {
359
- // If true, this route will be matched as case-sensitive
360
- caseSensitive?: boolean
361
- // If true, this route will be forcefully wrapped in a suspense boundary
362
- wrapInSuspense?: boolean
363
- // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`
364
- component?: RouteComponent
365
- errorComponent?: false | null | ErrorRouteComponent
366
- notFoundComponent?: NotFoundRouteComponent
367
- pendingComponent?: RouteComponent
368
- pendingMs?: number
369
- pendingMinMs?: number
370
- staleTime?: number
371
- gcTime?: number
372
- preload?: boolean
373
- preloadStaleTime?: number
374
- preloadGcTime?: number
375
- search?: {
376
- middlewares?: Array<
377
- SearchMiddleware<
378
- ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>
379
- >
380
- >
381
- }
382
- /**
383
- @deprecated Use search.middlewares instead
384
- */
385
- preSearchFilters?: Array<
386
- SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
387
- >
388
- /**
389
- @deprecated Use search.middlewares instead
390
- */
391
- postSearchFilters?: Array<
392
- SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
393
- >
394
- onCatch?: (error: Error) => void
395
- onError?: (err: any) => void
396
- // These functions are called as route matches are loaded, stick around and leave the active
397
- // matches
398
- onEnter?: (
399
- match: RouteMatch<
400
- TRouteId,
401
- TFullPath,
402
- ResolveAllParamsFromParent<TParentRoute, TParams>,
403
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
404
- ResolveLoaderData<TLoaderFn>,
405
- ResolveAllContext<
406
- TParentRoute,
407
- TRouterContext,
408
- TRouteContextFn,
409
- TBeforeLoadFn
410
- >,
411
- TLoaderDeps
412
- >,
413
- ) => void
414
- onStay?: (
415
- match: RouteMatch<
416
- TRouteId,
417
- TFullPath,
418
- ResolveAllParamsFromParent<TParentRoute, TParams>,
419
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
420
- ResolveLoaderData<TLoaderFn>,
421
- ResolveAllContext<
422
- TParentRoute,
423
- TRouterContext,
424
- TRouteContextFn,
425
- TBeforeLoadFn
426
- >,
427
- TLoaderDeps
428
- >,
429
- ) => void
430
- onLeave?: (
431
- match: RouteMatch<
432
- TRouteId,
433
- TFullPath,
434
- ResolveAllParamsFromParent<TParentRoute, TParams>,
435
- ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
436
- ResolveLoaderData<TLoaderFn>,
437
- ResolveAllContext<
438
- TParentRoute,
439
- TRouterContext,
440
- TRouteContextFn,
441
- TBeforeLoadFn
442
- >,
443
- TLoaderDeps
444
- >,
445
- ) => void
446
- headers?: (ctx: {
447
- loaderData: ResolveLoaderData<TLoaderFn>
448
- }) => Record<string, string>
449
- head?: (
450
- ctx: AssetFnContextOptions<
451
- TRouteId,
452
- TFullPath,
453
- TParentRoute,
454
- TParams,
455
- TSearchValidator,
456
- TLoaderFn,
457
- TRouterContext,
458
- TRouteContextFn,
459
- TBeforeLoadFn,
460
- TLoaderDeps
461
- >,
462
- ) => {
463
- links?: AnyRouteMatch['links']
464
- scripts?: AnyRouteMatch['headScripts']
465
- meta?: AnyRouteMatch['meta']
466
- }
467
- scripts?: (
468
- ctx: AssetFnContextOptions<
469
- TRouteId,
470
- TFullPath,
471
- TParentRoute,
472
- TParams,
473
- TSearchValidator,
474
- TLoaderFn,
475
- TRouterContext,
476
- TRouteContextFn,
477
- TBeforeLoadFn,
478
- TLoaderDeps
479
- >,
480
- ) => AnyRouteMatch['scripts']
481
- ssr?: boolean
482
- codeSplitGroupings?: Array<
483
- Array<
484
- | 'loader'
485
- | 'component'
486
- | 'pendingComponent'
487
- | 'notFoundComponent'
488
- | 'errorComponent'
489
- >
490
- >
491
- }
492
-
493
- export type RouteLoaderFn<
494
- in out TParentRoute extends AnyRoute = AnyRoute,
495
- in out TId extends string = string,
496
- in out TParams = {},
497
- in out TLoaderDeps = {},
498
- in out TRouterContext = {},
499
- in out TRouteContextFn = AnyContext,
500
- in out TBeforeLoadFn = AnyContext,
501
- > = (
502
- match: LoaderFnContext<
503
- TParentRoute,
504
- TId,
505
- TParams,
506
- TLoaderDeps,
507
- TRouterContext,
508
- TRouteContextFn,
509
- TBeforeLoadFn
510
- >,
511
- ) => any
512
-
513
- export interface LoaderFnContext<
514
- in out TParentRoute extends AnyRoute = AnyRoute,
515
- in out TId extends string = string,
516
- in out TParams = {},
517
- in out TLoaderDeps = {},
518
- in out TRouterContext = {},
519
- in out TRouteContextFn = AnyContext,
520
- in out TBeforeLoadFn = AnyContext,
521
- > {
522
- abortController: AbortController
523
- preload: boolean
524
- params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
525
- deps: TLoaderDeps
526
- context: Expand<
527
- ResolveAllContext<
528
- TParentRoute,
529
- TRouterContext,
530
- TRouteContextFn,
531
- TBeforeLoadFn
532
- >
533
- >
534
- location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps
535
- /**
536
- * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
537
- **/
538
- navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void
539
- // root route does not have a parent match
540
- parentMatchPromise: TId extends RootRouteId
541
- ? never
542
- : Promise<MakeRouteMatchFromRoute<TParentRoute>>
543
- cause: 'preload' | 'enter' | 'stay'
544
- route: Route
545
55
  }
546
56
 
547
57
  export interface AnyRoute
@@ -1113,37 +623,6 @@ export function createRoute<
1113
623
 
1114
624
  export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>
1115
625
 
1116
- export type RootRouteOptions<
1117
- TSearchValidator = undefined,
1118
- TRouterContext = {},
1119
- TRouteContextFn = AnyContext,
1120
- TBeforeLoadFn = AnyContext,
1121
- TLoaderDeps extends Record<string, any> = {},
1122
- TLoaderFn = undefined,
1123
- > = Omit<
1124
- RouteOptions<
1125
- any, // TParentRoute
1126
- RootRouteId, // TId
1127
- RootRouteId, // TCustomId
1128
- '', // TFullPath
1129
- '', // TPath
1130
- TSearchValidator,
1131
- {}, // TParams
1132
- TLoaderDeps,
1133
- TLoaderFn,
1134
- TRouterContext,
1135
- TRouteContextFn,
1136
- TBeforeLoadFn
1137
- >,
1138
- | 'path'
1139
- | 'id'
1140
- | 'getParentRoute'
1141
- | 'caseSensitive'
1142
- | 'parseParams'
1143
- | 'stringifyParams'
1144
- | 'params'
1145
- >
1146
-
1147
626
  export function createRootRouteWithContext<TRouterContext extends {}>() {
1148
627
  return <
1149
628
  TRouteContextFn = AnyContext,
package/src/router.ts CHANGED
@@ -40,13 +40,19 @@ import type { NoInfer } from '@tanstack/solid-store'
40
40
 
41
41
  import type {
42
42
  AnyContext,
43
+ AnyRedirect,
44
+ AnyRouteMatch,
43
45
  AnySchema,
44
46
  AnyValidator,
47
+ BeforeLoadContextOptions,
45
48
  BuildLocationFn,
46
49
  CommitLocationOptions,
47
50
  ControlledPromise,
48
51
  FullSearchSchema,
52
+ LoaderFnContext,
49
53
  MakeRemountDepsOptionsUnion,
54
+ MakeRouteMatch,
55
+ MakeRouteMatchUnion,
50
56
  Manifest,
51
57
  NavigateFn,
52
58
  NavigateOptions,
@@ -55,7 +61,9 @@ import type {
55
61
  PickAsRequired,
56
62
  Register,
57
63
  ResolveRelativePath,
64
+ ResolvedRedirect,
58
65
  RouteById,
66
+ RouteContextOptions,
59
67
  RoutePaths,
60
68
  RoutesById,
61
69
  RoutesByPath,
@@ -70,23 +78,14 @@ import type {
70
78
  } from '@tanstack/router-core'
71
79
  import type {
72
80
  AnyRoute,
73
- BeforeLoadContextOptions,
74
81
  ErrorRouteComponent,
75
- LoaderFnContext,
76
82
  NotFoundRouteComponent,
77
83
  RootRoute,
78
84
  RouteComponent,
79
- RouteContextOptions,
80
85
  RouteMask,
81
86
  } from './route'
82
- import type {
83
- AnyRouteMatch,
84
- MakeRouteMatch,
85
- MakeRouteMatchUnion,
86
- MatchRouteOptions,
87
- } from './Matches'
87
+ import type { MatchRouteOptions } from './Matches'
88
88
 
89
- import type { AnyRedirect, ResolvedRedirect } from './redirects'
90
89
  import type { NotFoundError } from './not-found'
91
90
 
92
91
  declare global {
@@ -1,17 +1,19 @@
1
1
  import type { LinkComponentProps } from './link'
2
- import type { Redirect } from './redirects'
3
2
  import type { AnyRouter, RegisteredRouter } from './router'
4
- import type { UseParamsOptions, UseParamsResult } from './useParams'
5
- import type { UseSearchOptions, UseSearchResult } from './useSearch'
3
+ import type { UseParamsOptions } from './useParams'
4
+ import type { UseSearchOptions } from './useSearch'
6
5
  import type {
7
6
  Constrain,
8
7
  ConstrainLiteral,
9
8
  FromPathOption,
10
9
  NavigateOptions,
11
10
  PathParamOptions,
11
+ Redirect,
12
12
  RouteIds,
13
13
  SearchParamOptions,
14
14
  ToPathOption,
15
+ UseParamsResult,
16
+ UseSearchResult,
15
17
  } from '@tanstack/router-core'
16
18
 
17
19
  export type ValidateFromPath<
@@ -2,7 +2,10 @@ import { useMatch } from './useMatch'
2
2
  import type { Accessor } from 'solid-js'
3
3
  import type { AnyRouter, RegisteredRouter } from './router'
4
4
  import type { StrictOrFrom } from './utils'
5
- import type { AllLoaderData, Expand, RouteById } from '@tanstack/router-core'
5
+ import type {
6
+ ResolveUseLoaderData,
7
+ UseLoaderDataResult,
8
+ } from '@tanstack/router-core'
6
9
 
7
10
  export interface UseLoaderDataBaseOptions<
8
11
  TRouter extends AnyRouter,
@@ -10,7 +13,7 @@ export interface UseLoaderDataBaseOptions<
10
13
  TStrict extends boolean,
11
14
  TSelected,
12
15
  > {
13
- select?: (match: ResolveLoaderData<TRouter, TFrom, TStrict>) => TSelected
16
+ select?: (match: ResolveUseLoaderData<TRouter, TFrom, TStrict>) => TSelected
14
17
  }
15
18
 
16
19
  export type UseLoaderDataOptions<
@@ -21,23 +24,6 @@ export type UseLoaderDataOptions<
21
24
  > = StrictOrFrom<TRouter, TFrom, TStrict> &
22
25
  UseLoaderDataBaseOptions<TRouter, TFrom, TStrict, TSelected>
23
26
 
24
- export type ResolveLoaderData<
25
- TRouter extends AnyRouter,
26
- TFrom,
27
- TStrict extends boolean,
28
- > = TStrict extends false
29
- ? AllLoaderData<TRouter['routeTree']>
30
- : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['loaderData']>
31
-
32
- export type UseLoaderDataResult<
33
- TRouter extends AnyRouter,
34
- TFrom,
35
- TStrict extends boolean,
36
- TSelected,
37
- > = unknown extends TSelected
38
- ? ResolveLoaderData<TRouter, TFrom, TStrict>
39
- : TSelected
40
-
41
27
  export type UseLoaderDataRoute<out TId> = <
42
28
  TRouter extends AnyRouter = RegisteredRouter,
43
29
  TSelected = unknown,