@tanstack/solid-router 1.109.2 → 1.111.3

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 (90) hide show
  1. package/dist/cjs/Matches.cjs.map +1 -1
  2. package/dist/cjs/Matches.d.cts +1 -3
  3. package/dist/cjs/RouterProvider.cjs.map +1 -1
  4. package/dist/cjs/RouterProvider.d.cts +0 -25
  5. package/dist/cjs/fileRoute.cjs.map +1 -1
  6. package/dist/cjs/fileRoute.d.cts +2 -14
  7. package/dist/cjs/index.d.cts +6 -7
  8. package/dist/cjs/link.cjs.map +1 -1
  9. package/dist/cjs/link.d.cts +2 -74
  10. package/dist/cjs/not-found.cjs.map +1 -1
  11. package/dist/cjs/not-found.d.cts +1 -1
  12. package/dist/cjs/redirects.cjs.map +1 -1
  13. package/dist/cjs/redirects.d.cts +1 -3
  14. package/dist/cjs/route.cjs.map +1 -1
  15. package/dist/cjs/route.d.cts +10 -50
  16. package/dist/cjs/router.cjs.map +1 -1
  17. package/dist/cjs/router.d.cts +2 -8
  18. package/dist/cjs/typePrimitives.d.cts +20 -16
  19. package/dist/cjs/useBlocker.cjs.map +1 -1
  20. package/dist/cjs/useBlocker.d.cts +1 -1
  21. package/dist/cjs/useLoaderData.cjs.map +1 -1
  22. package/dist/cjs/useLoaderData.d.cts +1 -2
  23. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  24. package/dist/cjs/useLoaderDeps.d.cts +1 -2
  25. package/dist/cjs/useNavigate.cjs.map +1 -1
  26. package/dist/cjs/useNavigate.d.cts +1 -1
  27. package/dist/cjs/useParams.cjs.map +1 -1
  28. package/dist/cjs/useParams.d.cts +1 -2
  29. package/dist/cjs/useRouteContext.cjs.map +1 -1
  30. package/dist/cjs/useRouteContext.d.cts +1 -2
  31. package/dist/cjs/useSearch.cjs.map +1 -1
  32. package/dist/cjs/useSearch.d.cts +1 -2
  33. package/dist/cjs/utils.cjs.map +1 -1
  34. package/dist/cjs/utils.d.cts +2 -3
  35. package/dist/esm/Matches.d.ts +1 -3
  36. package/dist/esm/Matches.js.map +1 -1
  37. package/dist/esm/RouterProvider.d.ts +0 -25
  38. package/dist/esm/RouterProvider.js.map +1 -1
  39. package/dist/esm/fileRoute.d.ts +2 -14
  40. package/dist/esm/fileRoute.js.map +1 -1
  41. package/dist/esm/index.d.ts +6 -7
  42. package/dist/esm/link.d.ts +2 -74
  43. package/dist/esm/link.js.map +1 -1
  44. package/dist/esm/not-found.d.ts +1 -1
  45. package/dist/esm/not-found.js.map +1 -1
  46. package/dist/esm/redirects.d.ts +1 -3
  47. package/dist/esm/redirects.js.map +1 -1
  48. package/dist/esm/route.d.ts +10 -50
  49. package/dist/esm/route.js.map +1 -1
  50. package/dist/esm/router.d.ts +2 -8
  51. package/dist/esm/router.js.map +1 -1
  52. package/dist/esm/typePrimitives.d.ts +20 -16
  53. package/dist/esm/useBlocker.d.ts +1 -1
  54. package/dist/esm/useBlocker.js.map +1 -1
  55. package/dist/esm/useLoaderData.d.ts +1 -2
  56. package/dist/esm/useLoaderData.js.map +1 -1
  57. package/dist/esm/useLoaderDeps.d.ts +1 -2
  58. package/dist/esm/useLoaderDeps.js.map +1 -1
  59. package/dist/esm/useNavigate.d.ts +1 -1
  60. package/dist/esm/useNavigate.js.map +1 -1
  61. package/dist/esm/useParams.d.ts +1 -2
  62. package/dist/esm/useParams.js.map +1 -1
  63. package/dist/esm/useRouteContext.d.ts +1 -2
  64. package/dist/esm/useRouteContext.js.map +1 -1
  65. package/dist/esm/useSearch.d.ts +1 -2
  66. package/dist/esm/useSearch.js.map +1 -1
  67. package/dist/esm/utils.d.ts +2 -3
  68. package/dist/esm/utils.js.map +1 -1
  69. package/package.json +2 -2
  70. package/src/Matches.tsx +11 -15
  71. package/src/RouterProvider.tsx +0 -48
  72. package/src/fileRoute.ts +3 -31
  73. package/src/index.tsx +47 -54
  74. package/src/link.tsx +5 -429
  75. package/src/not-found.tsx +1 -1
  76. package/src/redirects.ts +5 -3
  77. package/src/route.ts +101 -154
  78. package/src/router.ts +11 -25
  79. package/src/typePrimitives.ts +73 -27
  80. package/src/useBlocker.tsx +1 -1
  81. package/src/useLoaderData.tsx +1 -2
  82. package/src/useLoaderDeps.tsx +1 -2
  83. package/src/useNavigate.tsx +1 -1
  84. package/src/useParams.tsx +6 -2
  85. package/src/useRouteContext.ts +2 -2
  86. package/src/useSearch.tsx +6 -2
  87. package/src/utils.ts +1 -2
  88. package/dist/cjs/routeInfo.d.cts +0 -53
  89. package/dist/esm/routeInfo.d.ts +0 -53
  90. package/src/routeInfo.ts +0 -239
package/src/route.ts CHANGED
@@ -12,36 +12,43 @@ import type {
12
12
  AnyPathParams,
13
13
  AnySchema,
14
14
  AnyValidator,
15
- Assign,
15
+ BeforeLoadContextParameter,
16
+ BuildLocationFn,
16
17
  Constrain,
17
18
  ConstrainLiteral,
18
- ContextAsyncReturnType,
19
- ContextReturnType,
19
+ RootRoute as CoreRootRoute,
20
+ Route as CoreRoute,
20
21
  DefaultValidator,
21
22
  ErrorComponentProps,
22
23
  Expand,
23
- InferAllContext,
24
- InferAllParams,
25
- InferFullSearchSchema,
26
- InferFullSearchSchemaInput,
27
- IntersectAssign,
24
+ FullSearchSchemaOption,
25
+ NavigateFn,
26
+ NavigateOptions,
28
27
  NoInfer,
29
28
  NotFoundRouteProps,
30
29
  ParamsOptions,
31
30
  ParsedLocation,
31
+ RemountDepsOptions,
32
+ ResolveAllContext,
33
+ ResolveAllParamsFromParent,
34
+ ResolveFullSearchSchema,
35
+ ResolveFullSearchSchemaInput,
32
36
  ResolveId,
33
37
  ResolveLoaderData,
34
38
  ResolveParams,
35
- ResolveRouteContext,
36
- ResolveSearchValidatorInput,
37
- ResolveValidatorOutput,
38
39
  RootRouteId,
40
+ RouteById,
39
41
  RouteContext,
42
+ RouteContextParameter,
43
+ RouteIds,
40
44
  RoutePathOptions,
41
45
  RoutePathOptionsIntersection,
46
+ RoutePaths,
42
47
  RoutePrefix,
48
+ RouteTypes,
43
49
  SearchFilter,
44
50
  SearchMiddleware,
51
+ ToMaskOptions,
45
52
  TrimPathRight,
46
53
  UpdatableStaticRouteOption,
47
54
  } from '@tanstack/router-core'
@@ -58,10 +65,7 @@ import type {
58
65
  MakeRouteMatchUnion,
59
66
  RouteMatch,
60
67
  } from './Matches'
61
- import type { NavigateOptions, ToMaskOptions } from './link'
62
- import type { ParseRoute, RouteById, RouteIds, RoutePaths } from './routeInfo'
63
68
  import type { AnyRouter, RegisteredRouter, Router } from './router'
64
- import type { BuildLocationFn, NavigateFn } from './RouterProvider'
65
69
  import type { NotFoundError } from './not-found'
66
70
  import type { LazyRoute } from './fileRoute'
67
71
 
@@ -106,13 +110,6 @@ export type RouteOptions<
106
110
  NoInfer<TBeforeLoadFn>
107
111
  >
108
112
 
109
- export interface FullSearchSchemaOption<
110
- in out TParentRoute extends AnyRoute,
111
- in out TSearchValidator,
112
- > {
113
- search: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
114
- }
115
-
116
113
  export type RouteContextFn<
117
114
  in out TParentRoute extends AnyRoute,
118
115
  in out TSearchValidator,
@@ -288,30 +285,6 @@ export interface RouteContextOptions<
288
285
  context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>
289
286
  }
290
287
 
291
- export interface RemountDepsOptions<
292
- in out TRouteId,
293
- in out TFullSearchSchema,
294
- in out TAllParams,
295
- in out TLoaderDeps,
296
- > {
297
- routeId: TRouteId
298
- search: TFullSearchSchema
299
- params: TAllParams
300
- loaderDeps: TLoaderDeps
301
- }
302
-
303
- export type MakeRemountDepsOptionsUnion<
304
- TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
305
- TRoute extends AnyRoute = ParseRoute<TRouteTree>,
306
- > = TRoute extends any
307
- ? RemountDepsOptions<
308
- TRoute['id'],
309
- TRoute['types']['fullSearchSchema'],
310
- TRoute['types']['allParams'],
311
- TRoute['types']['loaderDeps']
312
- >
313
- : never
314
-
315
288
  export interface BeforeLoadContextOptions<
316
289
  in out TParentRoute extends AnyRoute,
317
290
  in out TSearchValidator,
@@ -571,50 +544,6 @@ export interface LoaderFnContext<
571
544
  route: Route
572
545
  }
573
546
 
574
- export type ResolveFullSearchSchema<
575
- TParentRoute extends AnyRoute,
576
- TSearchValidator,
577
- > = unknown extends TParentRoute
578
- ? ResolveValidatorOutput<TSearchValidator>
579
- : IntersectAssign<
580
- InferFullSearchSchema<TParentRoute>,
581
- ResolveValidatorOutput<TSearchValidator>
582
- >
583
-
584
- export type ResolveFullSearchSchemaInput<
585
- TParentRoute extends AnyRoute,
586
- TSearchValidator,
587
- > = IntersectAssign<
588
- InferFullSearchSchemaInput<TParentRoute>,
589
- ResolveSearchValidatorInput<TSearchValidator>
590
- >
591
-
592
- export type RouteContextParameter<
593
- TParentRoute extends AnyRoute,
594
- TRouterContext,
595
- > = unknown extends TParentRoute
596
- ? TRouterContext
597
- : Assign<TRouterContext, InferAllContext<TParentRoute>>
598
-
599
- export type BeforeLoadContextParameter<
600
- TParentRoute extends AnyRoute,
601
- TRouterContext,
602
- TRouteContextFn,
603
- > = Assign<
604
- RouteContextParameter<TParentRoute, TRouterContext>,
605
- ContextReturnType<TRouteContextFn>
606
- >
607
-
608
- export type ResolveAllContext<
609
- TParentRoute extends AnyRoute,
610
- TRouterContext,
611
- TRouteContextFn,
612
- TBeforeLoadFn,
613
- > = Assign<
614
- BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>,
615
- ContextAsyncReturnType<TBeforeLoadFn>
616
- >
617
-
618
547
  export interface AnyRoute
619
548
  extends Route<
620
549
  any,
@@ -629,6 +558,7 @@ export interface AnyRoute
629
558
  any,
630
559
  any,
631
560
  any,
561
+ any,
632
562
  any
633
563
  > {}
634
564
 
@@ -636,11 +566,6 @@ export type AnyRouteWithContext<TContext> = AnyRoute & {
636
566
  types: { allContext: TContext }
637
567
  }
638
568
 
639
- export type ResolveAllParamsFromParent<
640
- TParentRoute extends AnyRoute,
641
- TParams,
642
- > = Assign<InferAllParams<TParentRoute>, TParams>
643
-
644
569
  export type RouteConstraints = {
645
570
  TParentRoute: AnyRoute
646
571
  TPath: string
@@ -749,7 +674,25 @@ export class Route<
749
674
  in out TLoaderDeps extends Record<string, any> = {},
750
675
  in out TLoaderFn = undefined,
751
676
  in out TChildren = unknown,
752
- > {
677
+ in out TFileRouteTypes = unknown,
678
+ > implements
679
+ CoreRoute<
680
+ TParentRoute,
681
+ TPath,
682
+ TFullPath,
683
+ TCustomId,
684
+ TId,
685
+ TSearchValidator,
686
+ TParams,
687
+ TRouterContext,
688
+ TRouteContextFn,
689
+ TBeforeLoadFn,
690
+ TLoaderDeps,
691
+ TLoaderFn,
692
+ TChildren,
693
+ TFileRouteTypes
694
+ >
695
+ {
753
696
  isRoot: TParentRoute extends Route<any> ? true : false
754
697
  options: RouteOptions<
755
698
  TParentRoute,
@@ -847,37 +790,22 @@ export class Route<
847
790
  )
848
791
  }
849
792
 
850
- types!: {
851
- parentRoute: TParentRoute
852
- path: TPath
853
- to: TrimPathRight<TFullPath>
854
- fullPath: TFullPath
855
- customId: TCustomId
856
- id: TId
857
- searchSchema: ResolveValidatorOutput<TSearchValidator>
858
- searchSchemaInput: ResolveSearchValidatorInput<TSearchValidator>
859
- searchValidator: TSearchValidator
860
- fullSearchSchema: ResolveFullSearchSchema<TParentRoute, TSearchValidator>
861
- fullSearchSchemaInput: ResolveFullSearchSchemaInput<
862
- TParentRoute,
863
- TSearchValidator
864
- >
865
- params: TParams
866
- allParams: ResolveAllParamsFromParent<TParentRoute, TParams>
867
- routerContext: TRouterContext
868
- routeContext: ResolveRouteContext<TRouteContextFn, TBeforeLoadFn>
869
- routeContextFn: TRouteContextFn
870
- beforeLoadFn: TBeforeLoadFn
871
- allContext: ResolveAllContext<
872
- TParentRoute,
873
- TRouterContext,
874
- TRouteContextFn,
875
- TBeforeLoadFn
876
- >
877
- children: TChildren
878
- loaderData: ResolveLoaderData<TLoaderFn>
879
- loaderDeps: TLoaderDeps
880
- }
793
+ types!: RouteTypes<
794
+ TParentRoute,
795
+ TPath,
796
+ TFullPath,
797
+ TCustomId,
798
+ TId,
799
+ TSearchValidator,
800
+ TParams,
801
+ TRouterContext,
802
+ TRouteContextFn,
803
+ TBeforeLoadFn,
804
+ TLoaderDeps,
805
+ TLoaderFn,
806
+ TChildren,
807
+ TFileRouteTypes
808
+ >
881
809
 
882
810
  init = (opts: { originalIndex: number; defaultSsr?: boolean }): void => {
883
811
  this.originalIndex = opts.originalIndex
@@ -967,7 +895,8 @@ export class Route<
967
895
  TBeforeLoadFn,
968
896
  TLoaderDeps,
969
897
  TLoaderFn,
970
- TNewChildren
898
+ TNewChildren,
899
+ TFileRouteTypes
971
900
  > {
972
901
  return this._addFileChildren(children) as Route<
973
902
  TParentRoute,
@@ -982,7 +911,8 @@ export class Route<
982
911
  TBeforeLoadFn,
983
912
  TLoaderDeps,
984
913
  TLoaderFn,
985
- TNewChildren
914
+ TNewChildren,
915
+ TFileRouteTypes
986
916
  >
987
917
  }
988
918
 
@@ -1001,7 +931,8 @@ export class Route<
1001
931
  TBeforeLoadFn,
1002
932
  TLoaderDeps,
1003
933
  TLoaderFn,
1004
- TNewChildren
934
+ TNewChildren,
935
+ TFileRouteTypes
1005
936
  > {
1006
937
  if (Array.isArray(children)) {
1007
938
  this.children = children as TChildren
@@ -1024,7 +955,8 @@ export class Route<
1024
955
  TBeforeLoadFn,
1025
956
  TLoaderDeps,
1026
957
  TLoaderFn,
1027
- TNewChildren
958
+ TNewChildren,
959
+ TFileRouteTypes
1028
960
  >
1029
961
  }
1030
962
 
@@ -1056,7 +988,8 @@ export class Route<
1056
988
  TBeforeLoadFn,
1057
989
  TLoaderDeps,
1058
990
  TNewLoaderFn,
1059
- TChildren
991
+ TChildren,
992
+ TFileRouteTypes
1060
993
  >
1061
994
  }
1062
995
 
@@ -1245,29 +1178,43 @@ export function createRootRouteWithContext<TRouterContext extends {}>() {
1245
1178
  export const rootRouteWithContext = createRootRouteWithContext
1246
1179
 
1247
1180
  export class RootRoute<
1248
- in out TSearchValidator = undefined,
1249
- in out TRouterContext = {},
1250
- in out TRouteContextFn = AnyContext,
1251
- in out TBeforeLoadFn = AnyContext,
1252
- in out TLoaderDeps extends Record<string, any> = {},
1253
- in out TLoaderFn = undefined,
1254
- in out TChildren = unknown,
1255
- in out TFileRouteTypes = unknown,
1256
- > extends Route<
1257
- any, // TParentRoute
1258
- '/', // TPath
1259
- '/', // TFullPath
1260
- string, // TCustomId
1261
- RootRouteId, // TId
1262
- TSearchValidator, // TSearchValidator
1263
- {}, // TParams
1264
- TRouterContext,
1265
- TRouteContextFn,
1266
- TBeforeLoadFn,
1267
- TLoaderDeps,
1268
- TLoaderFn,
1269
- TChildren // TChildren
1270
- > {
1181
+ in out TSearchValidator = undefined,
1182
+ in out TRouterContext = {},
1183
+ in out TRouteContextFn = AnyContext,
1184
+ in out TBeforeLoadFn = AnyContext,
1185
+ in out TLoaderDeps extends Record<string, any> = {},
1186
+ in out TLoaderFn = undefined,
1187
+ in out TChildren = unknown,
1188
+ in out TFileRouteTypes = unknown,
1189
+ >
1190
+ extends Route<
1191
+ any, // TParentRoute
1192
+ '/', // TPath
1193
+ '/', // TFullPath
1194
+ string, // TCustomId
1195
+ RootRouteId, // TId
1196
+ TSearchValidator, // TSearchValidator
1197
+ {}, // TParams
1198
+ TRouterContext,
1199
+ TRouteContextFn,
1200
+ TBeforeLoadFn,
1201
+ TLoaderDeps,
1202
+ TLoaderFn,
1203
+ TChildren, // TChildren
1204
+ TFileRouteTypes
1205
+ >
1206
+ implements
1207
+ CoreRootRoute<
1208
+ TSearchValidator,
1209
+ TRouterContext,
1210
+ TRouteContextFn,
1211
+ TBeforeLoadFn,
1212
+ TLoaderDeps,
1213
+ TLoaderFn,
1214
+ TChildren,
1215
+ TFileRouteTypes
1216
+ >
1217
+ {
1271
1218
  /**
1272
1219
  * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
1273
1220
  */
package/src/router.ts CHANGED
@@ -42,42 +42,43 @@ import type {
42
42
  AnyContext,
43
43
  AnySchema,
44
44
  AnyValidator,
45
+ BuildLocationFn,
45
46
  CommitLocationOptions,
46
47
  ControlledPromise,
48
+ FullSearchSchema,
49
+ MakeRemountDepsOptionsUnion,
47
50
  Manifest,
51
+ NavigateFn,
52
+ NavigateOptions,
48
53
  NonNullableUpdater,
49
54
  ParsedLocation,
50
55
  PickAsRequired,
56
+ Register,
51
57
  ResolveRelativePath,
58
+ RouteById,
59
+ RoutePaths,
60
+ RoutesById,
61
+ RoutesByPath,
52
62
  SearchMiddleware,
53
63
  SearchParser,
54
64
  SearchSerializer,
55
65
  StartSerializer,
66
+ ToOptions,
56
67
  TrailingSlashOption,
57
68
  Updater,
58
69
  ViewTransitionOptions,
59
70
  } from '@tanstack/router-core'
60
71
  import type {
61
72
  AnyRoute,
62
- AnyRouteWithContext,
63
73
  BeforeLoadContextOptions,
64
74
  ErrorRouteComponent,
65
75
  LoaderFnContext,
66
- MakeRemountDepsOptionsUnion,
67
76
  NotFoundRouteComponent,
68
77
  RootRoute,
69
78
  RouteComponent,
70
79
  RouteContextOptions,
71
80
  RouteMask,
72
81
  } from './route'
73
-
74
- import type {
75
- FullSearchSchema,
76
- RouteById,
77
- RoutePaths,
78
- RoutesById,
79
- RoutesByPath,
80
- } from './routeInfo'
81
82
  import type {
82
83
  AnyRouteMatch,
83
84
  MakeRouteMatch,
@@ -85,11 +86,8 @@ import type {
85
86
  MatchRouteOptions,
86
87
  } from './Matches'
87
88
 
88
- import type { BuildLocationFn, NavigateFn } from './RouterProvider'
89
-
90
89
  import type { AnyRedirect, ResolvedRedirect } from './redirects'
91
90
  import type { NotFoundError } from './not-found'
92
- import type { NavigateOptions, ToOptions } from './link'
93
91
 
94
92
  declare global {
95
93
  interface Window {
@@ -97,20 +95,8 @@ declare global {
97
95
  }
98
96
  }
99
97
 
100
- export interface Register {
101
- // router: Router
102
- }
103
-
104
98
  export type AnyRouter = Router<any, any, any, any, any>
105
99
 
106
- export type AnyRouterWithContext<TContext> = Router<
107
- AnyRouteWithContext<TContext>,
108
- any,
109
- any,
110
- any,
111
- any
112
- >
113
-
114
100
  export type RegisteredRouter = Register extends {
115
101
  router: infer TRouter extends AnyRouter
116
102
  }
@@ -1,48 +1,53 @@
1
+ import type { LinkComponentProps } from './link'
2
+ import type { Redirect } from './redirects'
3
+ import type { AnyRouter, RegisteredRouter } from './router'
4
+ import type { UseParamsOptions, UseParamsResult } from './useParams'
5
+ import type { UseSearchOptions, UseSearchResult } from './useSearch'
1
6
  import type {
7
+ Constrain,
8
+ ConstrainLiteral,
2
9
  FromPathOption,
3
- LinkComponentProps,
4
10
  NavigateOptions,
5
11
  PathParamOptions,
12
+ RouteIds,
6
13
  SearchParamOptions,
7
14
  ToPathOption,
8
- } from './link'
9
- import type { RouteIds } from './routeInfo'
10
- import type { AnyRouter, RegisteredRouter } from './router'
11
- import type { UseParamsOptions, UseParamsResult } from './useParams'
12
- import type { UseSearchOptions, UseSearchResult } from './useSearch'
13
- import type { Constrain, ConstrainLiteral } from '@tanstack/router-core'
15
+ } from '@tanstack/router-core'
14
16
 
15
17
  export type ValidateFromPath<
16
- TFrom,
17
18
  TRouter extends AnyRouter = RegisteredRouter,
19
+ TFrom = string,
18
20
  > = FromPathOption<TRouter, TFrom>
19
21
 
20
22
  export type ValidateToPath<
21
- TTo extends string | undefined,
22
- TFrom extends string = string,
23
23
  TRouter extends AnyRouter = RegisteredRouter,
24
+ TTo extends string | undefined = undefined,
25
+ TFrom extends string = string,
24
26
  > = ToPathOption<TRouter, TFrom, TTo>
25
27
 
26
28
  export type ValidateSearch<
27
- TTo extends string | undefined,
28
- TFrom extends string = string,
29
29
  TRouter extends AnyRouter = RegisteredRouter,
30
+ TTo extends string | undefined = undefined,
31
+ TFrom extends string = string,
30
32
  > = SearchParamOptions<TRouter, TFrom, TTo>
31
33
 
32
34
  export type ValidateParams<
33
- TTo extends string | undefined,
34
- TFrom extends string = string,
35
35
  TRouter extends AnyRouter = RegisteredRouter,
36
+ TTo extends string | undefined = undefined,
37
+ TFrom extends string = string,
36
38
  > = PathParamOptions<TRouter, TFrom, TTo>
37
39
 
38
40
  /**
39
41
  * @internal
40
42
  */
41
- export type InferFrom<TOptions> = TOptions extends {
43
+ export type InferFrom<
44
+ TOptions,
45
+ TDefaultFrom extends string = string,
46
+ > = TOptions extends {
42
47
  from: infer TFrom extends string
43
48
  }
44
49
  ? TFrom
45
- : string
50
+ : TDefaultFrom
46
51
 
47
52
  /**
48
53
  * @internal
@@ -69,13 +74,14 @@ export type InferMaskFrom<TOptions> = TOptions extends {
69
74
  : string
70
75
 
71
76
  export type ValidateNavigateOptions<
72
- TOptions,
73
77
  TRouter extends AnyRouter = RegisteredRouter,
78
+ TOptions = unknown,
79
+ TDefaultFrom extends string = string,
74
80
  > = Constrain<
75
81
  TOptions,
76
82
  NavigateOptions<
77
83
  TRouter,
78
- InferFrom<TOptions>,
84
+ InferFrom<TOptions, TDefaultFrom>,
79
85
  InferTo<TOptions>,
80
86
  InferMaskFrom<TOptions>,
81
87
  InferMaskTo<TOptions>
@@ -83,20 +89,54 @@ export type ValidateNavigateOptions<
83
89
  >
84
90
 
85
91
  export type ValidateNavigateOptionsArray<
86
- TOptions extends ReadonlyArray<any>,
87
92
  TRouter extends AnyRouter = RegisteredRouter,
88
- > = { [K in keyof TOptions]: ValidateNavigateOptions<TOptions[K], TRouter> }
93
+ TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,
94
+ TDefaultFrom extends string = string,
95
+ > = {
96
+ [K in keyof TOptions]: ValidateNavigateOptions<
97
+ TRouter,
98
+ TOptions[K],
99
+ TDefaultFrom
100
+ >
101
+ }
102
+ export type ValidateRedirectOptions<
103
+ TRouter extends AnyRouter = RegisteredRouter,
104
+ TOptions = unknown,
105
+ TDefaultFrom extends string = string,
106
+ > = Constrain<
107
+ TOptions,
108
+ Redirect<
109
+ TRouter,
110
+ InferFrom<TOptions, TDefaultFrom>,
111
+ InferTo<TOptions>,
112
+ InferMaskFrom<TOptions>,
113
+ InferMaskTo<TOptions>
114
+ >
115
+ >
116
+
117
+ export type ValidateRedirectOptionsArray<
118
+ TRouter extends AnyRouter = RegisteredRouter,
119
+ TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,
120
+ TDefaultFrom extends string = string,
121
+ > = {
122
+ [K in keyof TOptions]: ValidateRedirectOptions<
123
+ TRouter,
124
+ TOptions[K],
125
+ TDefaultFrom
126
+ >
127
+ }
89
128
 
90
129
  export type ValidateLinkOptions<
91
- TOptions,
92
- TComp = 'a',
93
130
  TRouter extends AnyRouter = RegisteredRouter,
131
+ TOptions = unknown,
132
+ TDefaultFrom extends string = string,
133
+ TComp = 'a',
94
134
  > = Constrain<
95
135
  TOptions,
96
136
  LinkComponentProps<
97
137
  TComp,
98
138
  TRouter,
99
- InferFrom<TOptions>,
139
+ InferFrom<TOptions, TDefaultFrom>,
100
140
  InferTo<TOptions>,
101
141
  InferMaskFrom<TOptions>,
102
142
  InferMaskTo<TOptions>
@@ -104,16 +144,22 @@ export type ValidateLinkOptions<
104
144
  >
105
145
 
106
146
  export type ValidateLinkOptionsArray<
107
- TOptions extends ReadonlyArray<any>,
108
- TComp = 'a',
109
147
  TRouter extends AnyRouter = RegisteredRouter,
148
+ TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,
149
+ TDefaultFrom extends string = string,
150
+ TComp = 'a',
110
151
  > = {
111
- [K in keyof TOptions]: ValidateLinkOptions<TOptions[K], TComp, TRouter>
152
+ [K in keyof TOptions]: ValidateLinkOptions<
153
+ TRouter,
154
+ TOptions[K],
155
+ TDefaultFrom,
156
+ TComp
157
+ >
112
158
  }
113
159
 
114
160
  export type ValidateId<
115
- TId extends string,
116
161
  TRouter extends AnyRouter = RegisteredRouter,
162
+ TId extends string = string,
117
163
  > = ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>
118
164
 
119
165
  /**
@@ -6,7 +6,7 @@ import type {
6
6
  HistoryLocation,
7
7
  } from '@tanstack/history'
8
8
  import type { AnyRoute, SolidNode } from './route'
9
- import type { ParseRoute } from './routeInfo'
9
+ import type { ParseRoute } from '@tanstack/router-core'
10
10
  import type { AnyRouter, RegisteredRouter } from './router'
11
11
 
12
12
  interface ShouldBlockFnLocation<
@@ -1,9 +1,8 @@
1
1
  import { useMatch } from './useMatch'
2
2
  import type { Accessor } from 'solid-js'
3
3
  import type { AnyRouter, RegisteredRouter } from './router'
4
- import type { AllLoaderData, RouteById } from './routeInfo'
5
4
  import type { StrictOrFrom } from './utils'
6
- import type { Expand } from '@tanstack/router-core'
5
+ import type { AllLoaderData, Expand, RouteById } from '@tanstack/router-core'
7
6
 
8
7
  export interface UseLoaderDataBaseOptions<
9
8
  TRouter extends AnyRouter,
@@ -1,8 +1,7 @@
1
1
  import { useMatch } from './useMatch'
2
2
  import type { AnyRouter, RegisteredRouter } from './router'
3
- import type { RouteById } from './routeInfo'
4
3
  import type { StrictOrFrom } from './utils'
5
- import type { Expand } from '@tanstack/router-core'
4
+ import type { Expand, RouteById } from '@tanstack/router-core'
6
5
 
7
6
  export interface UseLoaderDepsBaseOptions<
8
7
  TRouter extends AnyRouter,
@@ -1,6 +1,6 @@
1
1
  import * as Solid from 'solid-js'
2
2
  import { useRouter } from './useRouter'
3
- import type { FromPathOption, NavigateOptions } from './link'
3
+ import type { FromPathOption, NavigateOptions } from '@tanstack/router-core'
4
4
  import type { AnyRouter, RegisteredRouter } from './router'
5
5
 
6
6
  export type UseNavigateResult<TDefaultFrom extends string> = <
package/src/useParams.tsx CHANGED
@@ -1,10 +1,14 @@
1
1
  import { useMatch } from './useMatch'
2
2
  import type { ThrowConstraint } from './useMatch'
3
3
  import type { Accessor } from 'solid-js'
4
- import type { AllParams, RouteById } from './routeInfo'
5
4
  import type { AnyRouter, RegisteredRouter } from './router'
6
5
  import type { StrictOrFrom } from './utils'
7
- import type { Expand, ThrowOrOptional } from '@tanstack/router-core'
6
+ import type {
7
+ AllParams,
8
+ Expand,
9
+ RouteById,
10
+ ThrowOrOptional,
11
+ } from '@tanstack/router-core'
8
12
 
9
13
  export interface UseParamsBaseOptions<
10
14
  TRouter extends AnyRouter,