@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/index.tsx CHANGED
@@ -120,6 +120,51 @@ export type {
120
120
  Validator,
121
121
  ValidatorAdapter,
122
122
  ValidatorObj,
123
+ NavigateFn,
124
+ BuildLocationFn,
125
+ InferDescendantToPaths,
126
+ RelativeToPath,
127
+ RelativeToParentPath,
128
+ RelativeToCurrentPath,
129
+ Register,
130
+ AbsoluteToPath,
131
+ RelativeToPathAutoComplete,
132
+ NavigateOptions,
133
+ ToOptions,
134
+ ToMaskOptions,
135
+ ToSubOptions,
136
+ ResolveRoute,
137
+ SearchParamOptions,
138
+ PathParamOptions,
139
+ ToPathOption,
140
+ LinkOptions,
141
+ MakeOptionalPathParams,
142
+ AnyRouterWithContext,
143
+ ParseRoute,
144
+ RoutesById,
145
+ RouteById,
146
+ RouteIds,
147
+ RoutesByPath,
148
+ RouteByPath,
149
+ RoutePaths,
150
+ FullSearchSchema,
151
+ AllParams,
152
+ AllLoaderData,
153
+ FullSearchSchemaInput,
154
+ AllContext,
155
+ CommitLocationOptions,
156
+ MatchLocation,
157
+ ResolveFullSearchSchema,
158
+ ResolveFullSearchSchemaInput,
159
+ ResolveAllParamsFromParent,
160
+ RouteContextParameter,
161
+ BeforeLoadContextParameter,
162
+ ResolveAllContext,
163
+ FullSearchSchemaOption,
164
+ MakeRemountDepsOptionsUnion,
165
+ RemountDepsOptions,
166
+ FileRouteTypes,
167
+ FileRoutesByPath,
123
168
  } from '@tanstack/router-core'
124
169
 
125
170
  export {
@@ -150,11 +195,7 @@ export {
150
195
  createLazyRoute,
151
196
  createLazyFileRoute,
152
197
  } from './fileRoute'
153
- export type {
154
- FileRoutesByPath,
155
- FileRouteTypes,
156
- LazyRouteOptions,
157
- } from './fileRoute'
198
+ export type { LazyRouteOptions } from './fileRoute'
158
199
 
159
200
  export * from './history'
160
201
 
@@ -162,28 +203,12 @@ export { lazyRouteComponent } from './lazyRouteComponent'
162
203
 
163
204
  export { useLinkProps, createLink, Link, linkOptions } from './link'
164
205
  export type {
165
- InferDescendantToPaths,
166
- RelativeToPath,
167
- RelativeToParentPath,
168
- RelativeToCurrentPath,
169
- AbsoluteToPath,
170
- RelativeToPathAutoComplete,
171
- NavigateOptions,
172
- ToOptions,
173
- ToMaskOptions,
174
- ToSubOptions,
175
- ResolveRoute,
176
- SearchParamOptions,
177
- PathParamOptions,
178
- ToPathOption,
179
- LinkOptions,
180
206
  UseLinkPropsOptions,
181
207
  ActiveLinkOptions,
182
208
  LinkProps,
183
209
  LinkComponent,
184
210
  LinkComponentProps,
185
211
  CreateLinkProps,
186
- MakeOptionalPathParams,
187
212
  } from './link'
188
213
 
189
214
  export {
@@ -234,8 +259,6 @@ export type {
234
259
  UpdatableRouteOptions,
235
260
  RouteLoaderFn,
236
261
  LoaderFnContext,
237
- ResolveFullSearchSchema,
238
- ResolveFullSearchSchemaInput,
239
262
  AnyRoute,
240
263
  RouteConstraints,
241
264
  AnyRootRoute,
@@ -249,35 +272,13 @@ export type {
249
272
  NotFoundRouteComponent,
250
273
  RootRouteOptions,
251
274
  AnyRouteWithContext,
252
- FullSearchSchemaOption,
253
275
  RouteContextFn,
254
276
  RouteContextOptions,
255
277
  BeforeLoadFn,
256
278
  BeforeLoadContextOptions,
257
279
  ContextOptions,
258
- RouteContextParameter,
259
- BeforeLoadContextParameter,
260
- ResolveAllContext,
261
- ResolveAllParamsFromParent,
262
- MakeRemountDepsOptionsUnion,
263
- RemountDepsOptions,
264
280
  } from './route'
265
281
 
266
- export type {
267
- ParseRoute,
268
- RoutesById,
269
- RouteById,
270
- RouteIds,
271
- RoutesByPath,
272
- RouteByPath,
273
- RoutePaths,
274
- FullSearchSchema,
275
- AllParams,
276
- AllLoaderData,
277
- FullSearchSchemaInput,
278
- AllContext,
279
- } from './routeInfo'
280
-
281
282
  export {
282
283
  componentTypes,
283
284
  createRouter,
@@ -289,7 +290,6 @@ export {
289
290
  } from './router'
290
291
 
291
292
  export type {
292
- Register,
293
293
  AnyRouter,
294
294
  RegisteredRouter,
295
295
  RouterContextOptions,
@@ -302,19 +302,12 @@ export type {
302
302
  RouterEvents,
303
303
  RouterEvent,
304
304
  RouterListener,
305
- AnyRouterWithContext,
306
305
  ControllablePromise,
307
306
  InjectedHtmlEntry,
308
307
  } from './router'
309
308
 
310
309
  export { RouterProvider, RouterContextProvider } from './RouterProvider'
311
- export type {
312
- RouterProps,
313
- CommitLocationOptions,
314
- MatchLocation,
315
- NavigateFn,
316
- BuildLocationFn,
317
- } from './RouterProvider'
310
+ export type { RouterProps } from './RouterProvider'
318
311
 
319
312
  export {
320
313
  useElementScrollRestoration,
package/src/link.tsx CHANGED
@@ -18,440 +18,16 @@ import { useIntersectionObserver } from './utils'
18
18
  import { useMatch } from './useMatch'
19
19
  import type {
20
20
  Constrain,
21
- ConstrainLiteral,
22
- Expand,
23
- IsRequiredParams,
24
- LinkOptionsProps,
25
- MakeDifferenceOptional,
26
- NoInfer,
27
- NonNullableUpdater,
28
- ParsedLocation,
29
- PickRequired,
30
- RemoveTrailingSlashes,
31
- ResolveRelativePath,
32
- Updater,
33
- ViewTransitionOptions,
34
- WithoutEmpty,
35
- } from '@tanstack/router-core'
36
- import type { HistoryState, ParsedHistoryState } from '@tanstack/history'
37
- import type {
38
- AllParams,
39
- CatchAllPaths,
40
- CurrentPath,
41
- FullSearchSchema,
42
- FullSearchSchemaInput,
43
- ParentPath,
44
- RouteByPath,
45
- RouteByToPath,
21
+ LinkCurrentTargetElement,
22
+ LinkOptions,
46
23
  RoutePaths,
47
- RouteToPath,
48
- ToPath,
49
- } from './routeInfo'
24
+ } from '@tanstack/router-core'
50
25
  import type { AnyRouter, RegisteredRouter } from './router'
51
26
  import type {
52
27
  ValidateLinkOptions,
53
28
  ValidateLinkOptionsArray,
54
29
  } from './typePrimitives'
55
30
 
56
- export type FindDescendantToPaths<
57
- TRouter extends AnyRouter,
58
- TPrefix extends string,
59
- > = `${TPrefix}/${string}` & RouteToPath<TRouter>
60
-
61
- export type InferDescendantToPaths<
62
- TRouter extends AnyRouter,
63
- TPrefix extends string,
64
- TPaths = FindDescendantToPaths<TRouter, TPrefix>,
65
- > = TPaths extends `${TPrefix}/`
66
- ? never
67
- : TPaths extends `${TPrefix}/${infer TRest}`
68
- ? TRest
69
- : never
70
-
71
- export type RelativeToPath<
72
- TRouter extends AnyRouter,
73
- TTo extends string,
74
- TResolvedPath extends string,
75
- > =
76
- | (TResolvedPath & RouteToPath<TRouter> extends never
77
- ? never
78
- : ToPath<TRouter, TTo>)
79
- | `${RemoveTrailingSlashes<TTo>}/${InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TResolvedPath>>}`
80
-
81
- export type RelativeToParentPath<
82
- TRouter extends AnyRouter,
83
- TFrom extends string,
84
- TTo extends string,
85
- TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>,
86
- > =
87
- | RelativeToPath<TRouter, TTo, TResolvedPath>
88
- | (TTo extends `${string}..` | `${string}../`
89
- ? TResolvedPath extends '/' | ''
90
- ? never
91
- : FindDescendantToPaths<
92
- TRouter,
93
- RemoveTrailingSlashes<TResolvedPath>
94
- > extends never
95
- ? never
96
- : `${RemoveTrailingSlashes<TTo>}/${ParentPath<TRouter>}`
97
- : never)
98
-
99
- export type RelativeToCurrentPath<
100
- TRouter extends AnyRouter,
101
- TFrom extends string,
102
- TTo extends string,
103
- TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>,
104
- > = RelativeToPath<TRouter, TTo, TResolvedPath> | CurrentPath<TRouter>
105
-
106
- export type AbsoluteToPath<TRouter extends AnyRouter, TFrom extends string> =
107
- | (string extends TFrom
108
- ? CurrentPath<TRouter>
109
- : TFrom extends `/`
110
- ? never
111
- : CurrentPath<TRouter>)
112
- | (string extends TFrom
113
- ? ParentPath<TRouter>
114
- : TFrom extends `/`
115
- ? never
116
- : ParentPath<TRouter>)
117
- | RouteToPath<TRouter>
118
- | (TFrom extends '/'
119
- ? never
120
- : string extends TFrom
121
- ? never
122
- : InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TFrom>>)
123
-
124
- export type RelativeToPathAutoComplete<
125
- TRouter extends AnyRouter,
126
- TFrom extends string,
127
- TTo extends string,
128
- > = string extends TTo
129
- ? string
130
- : string extends TFrom
131
- ? AbsoluteToPath<TRouter, TFrom>
132
- : TTo & `..${string}` extends never
133
- ? TTo & `.${string}` extends never
134
- ? AbsoluteToPath<TRouter, TFrom>
135
- : RelativeToCurrentPath<TRouter, TFrom, TTo>
136
- : RelativeToParentPath<TRouter, TFrom, TTo>
137
-
138
- export type NavigateOptions<
139
- TRouter extends AnyRouter = RegisteredRouter,
140
- TFrom extends string = string,
141
- TTo extends string | undefined = '.',
142
- TMaskFrom extends string = TFrom,
143
- TMaskTo extends string = '.',
144
- > = ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & NavigateOptionProps
145
-
146
- export interface NavigateOptionProps {
147
- // if set to `true`, the router will scroll the element with an id matching the hash into view with default ScrollIntoViewOptions.
148
- // if set to `false`, the router will not scroll the element with an id matching the hash into view.
149
- // if set to `ScrollIntoViewOptions`, the router will scroll the element with an id matching the hash into view with the provided options.
150
- hashScrollIntoView?: boolean | ScrollIntoViewOptions
151
- // `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.
152
- replace?: boolean
153
- resetScroll?: boolean
154
- /** @deprecated All navigations now use startTransition under the hood */
155
- startTransition?: boolean
156
- // if set to `true`, the router will wrap the resulting navigation in a document.startViewTransition() call.
157
- // if set to `ViewTransitionOptions`, the router will pass the `types` field to document.startViewTransition({update: fn, types: viewTransition.types}) call
158
- viewTransition?: boolean | ViewTransitionOptions
159
- ignoreBlocker?: boolean
160
- reloadDocument?: boolean
161
- href?: string
162
- }
163
-
164
- export type ToOptions<
165
- TRouter extends AnyRouter = RegisteredRouter,
166
- TFrom extends string = string,
167
- TTo extends string | undefined = '.',
168
- TMaskFrom extends string = TFrom,
169
- TMaskTo extends string = '.',
170
- > = ToSubOptions<TRouter, TFrom, TTo> & MaskOptions<TRouter, TMaskFrom, TMaskTo>
171
-
172
- export interface MaskOptions<
173
- in out TRouter extends AnyRouter,
174
- in out TMaskFrom extends string,
175
- in out TMaskTo extends string,
176
- > {
177
- _fromLocation?: ParsedLocation
178
- mask?: ToMaskOptions<TRouter, TMaskFrom, TMaskTo>
179
- }
180
-
181
- export type ToMaskOptions<
182
- TRouter extends AnyRouter = RegisteredRouter,
183
- TMaskFrom extends string = string,
184
- TMaskTo extends string = '.',
185
- > = ToSubOptions<TRouter, TMaskFrom, TMaskTo> & {
186
- unmaskOnReload?: boolean
187
- }
188
-
189
- export type ToSubOptions<
190
- TRouter extends AnyRouter = RegisteredRouter,
191
- TFrom extends string = string,
192
- TTo extends string | undefined = '.',
193
- > = ToSubOptionsProps<TRouter, TFrom, TTo> &
194
- SearchParamOptions<TRouter, TFrom, TTo> &
195
- PathParamOptions<TRouter, TFrom, TTo>
196
-
197
- export interface RequiredToOptions<
198
- in out TRouter extends AnyRouter,
199
- in out TFrom extends string,
200
- in out TTo extends string | undefined,
201
- > {
202
- to: ToPathOption<TRouter, TFrom, TTo> & {}
203
- }
204
-
205
- export interface OptionalToOptions<
206
- in out TRouter extends AnyRouter,
207
- in out TFrom extends string,
208
- in out TTo extends string | undefined,
209
- > {
210
- to?: ToPathOption<TRouter, TFrom, TTo> & {}
211
- }
212
-
213
- export type MakeToRequired<
214
- TRouter extends AnyRouter,
215
- TFrom extends string,
216
- TTo extends string | undefined,
217
- > = string extends TFrom
218
- ? string extends TTo
219
- ? OptionalToOptions<TRouter, TFrom, TTo>
220
- : TTo & CatchAllPaths<TRouter> extends never
221
- ? RequiredToOptions<TRouter, TFrom, TTo>
222
- : OptionalToOptions<TRouter, TFrom, TTo>
223
- : OptionalToOptions<TRouter, TFrom, TTo>
224
-
225
- export type ToSubOptionsProps<
226
- TRouter extends AnyRouter = RegisteredRouter,
227
- TFrom extends RoutePaths<TRouter['routeTree']> | string = string,
228
- TTo extends string | undefined = '.',
229
- > = MakeToRequired<TRouter, TFrom, TTo> & {
230
- hash?: true | Updater<string>
231
- state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>
232
- from?: FromPathOption<TRouter, TFrom> & {}
233
- }
234
-
235
- export type ParamsReducerFn<
236
- in out TRouter extends AnyRouter,
237
- in out TParamVariant extends ParamVariant,
238
- in out TFrom,
239
- in out TTo,
240
- > = (
241
- current: Expand<ResolveFromParams<TRouter, TParamVariant, TFrom>>,
242
- ) => Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>
243
-
244
- type ParamsReducer<
245
- TRouter extends AnyRouter,
246
- TParamVariant extends ParamVariant,
247
- TFrom,
248
- TTo,
249
- > =
250
- | Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>
251
- | (ParamsReducerFn<TRouter, TParamVariant, TFrom, TTo> & {})
252
-
253
- type ParamVariant = 'PATH' | 'SEARCH'
254
-
255
- export type ResolveRoute<
256
- TRouter extends AnyRouter,
257
- TFrom,
258
- TTo,
259
- TPath = ResolveRelativePath<TFrom, TTo>,
260
- > = TPath extends string
261
- ? TFrom extends TPath
262
- ? RouteByPath<TRouter['routeTree'], TPath>
263
- : RouteByToPath<TRouter, TPath>
264
- : never
265
-
266
- type ResolveFromParamType<TParamVariant extends ParamVariant> =
267
- TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchema'
268
-
269
- type ResolveFromAllParams<
270
- TRouter extends AnyRouter,
271
- TParamVariant extends ParamVariant,
272
- > = TParamVariant extends 'PATH'
273
- ? AllParams<TRouter['routeTree']>
274
- : FullSearchSchema<TRouter['routeTree']>
275
-
276
- type ResolveFromParams<
277
- TRouter extends AnyRouter,
278
- TParamVariant extends ParamVariant,
279
- TFrom,
280
- > = string extends TFrom
281
- ? ResolveFromAllParams<TRouter, TParamVariant>
282
- : RouteByPath<
283
- TRouter['routeTree'],
284
- TFrom
285
- >['types'][ResolveFromParamType<TParamVariant>]
286
-
287
- type ResolveToParamType<TParamVariant extends ParamVariant> =
288
- TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchemaInput'
289
-
290
- type ResolveAllToParams<
291
- TRouter extends AnyRouter,
292
- TParamVariant extends ParamVariant,
293
- > = TParamVariant extends 'PATH'
294
- ? AllParams<TRouter['routeTree']>
295
- : FullSearchSchemaInput<TRouter['routeTree']>
296
-
297
- export type ResolveToParams<
298
- TRouter extends AnyRouter,
299
- TParamVariant extends ParamVariant,
300
- TFrom,
301
- TTo,
302
- > =
303
- ResolveRelativePath<TFrom, TTo> extends infer TPath
304
- ? undefined extends TPath
305
- ? never
306
- : string extends TPath
307
- ? ResolveAllToParams<TRouter, TParamVariant>
308
- : TPath extends CatchAllPaths<TRouter>
309
- ? ResolveAllToParams<TRouter, TParamVariant>
310
- : ResolveRoute<
311
- TRouter,
312
- TFrom,
313
- TTo
314
- >['types'][ResolveToParamType<TParamVariant>]
315
- : never
316
-
317
- type ResolveRelativeToParams<
318
- TRouter extends AnyRouter,
319
- TParamVariant extends ParamVariant,
320
- TFrom,
321
- TTo,
322
- TToParams = ResolveToParams<TRouter, TParamVariant, TFrom, TTo>,
323
- > = TParamVariant extends 'SEARCH'
324
- ? TToParams
325
- : string extends TFrom
326
- ? TToParams
327
- : MakeDifferenceOptional<
328
- ResolveFromParams<TRouter, TParamVariant, TFrom>,
329
- TToParams
330
- >
331
-
332
- export interface MakeOptionalSearchParams<
333
- in out TRouter extends AnyRouter,
334
- in out TFrom,
335
- in out TTo,
336
- > {
337
- search?: true | (ParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {})
338
- }
339
-
340
- export interface MakeOptionalPathParams<
341
- in out TRouter extends AnyRouter,
342
- in out TFrom,
343
- in out TTo,
344
- > {
345
- params?: true | (ParamsReducer<TRouter, 'PATH', TFrom, TTo> & {})
346
- }
347
-
348
- type MakeRequiredParamsReducer<
349
- TRouter extends AnyRouter,
350
- TParamVariant extends ParamVariant,
351
- TFrom,
352
- TTo,
353
- > =
354
- | (string extends TFrom
355
- ? never
356
- : ResolveFromParams<TRouter, TParamVariant, TFrom> extends WithoutEmpty<
357
- PickRequired<
358
- ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>
359
- >
360
- >
361
- ? true
362
- : never)
363
- | (ParamsReducer<TRouter, TParamVariant, TFrom, TTo> & {})
364
-
365
- export interface MakeRequiredPathParams<
366
- in out TRouter extends AnyRouter,
367
- in out TFrom,
368
- in out TTo,
369
- > {
370
- params: MakeRequiredParamsReducer<TRouter, 'PATH', TFrom, TTo> & {}
371
- }
372
-
373
- export interface MakeRequiredSearchParams<
374
- in out TRouter extends AnyRouter,
375
- in out TFrom,
376
- in out TTo,
377
- > {
378
- search: MakeRequiredParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {}
379
- }
380
-
381
- export type IsRequired<
382
- TRouter extends AnyRouter,
383
- TParamVariant extends ParamVariant,
384
- TFrom,
385
- TTo,
386
- > =
387
- ResolveRelativePath<TFrom, TTo> extends infer TPath
388
- ? undefined extends TPath
389
- ? never
390
- : TPath extends CatchAllPaths<TRouter>
391
- ? never
392
- : IsRequiredParams<
393
- ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>
394
- >
395
- : never
396
-
397
- export type SearchParamOptions<TRouter extends AnyRouter, TFrom, TTo> =
398
- IsRequired<TRouter, 'SEARCH', TFrom, TTo> extends never
399
- ? MakeOptionalSearchParams<TRouter, TFrom, TTo>
400
- : MakeRequiredSearchParams<TRouter, TFrom, TTo>
401
-
402
- export type PathParamOptions<TRouter extends AnyRouter, TFrom, TTo> =
403
- IsRequired<TRouter, 'PATH', TFrom, TTo> extends never
404
- ? MakeOptionalPathParams<TRouter, TFrom, TTo>
405
- : MakeRequiredPathParams<TRouter, TFrom, TTo>
406
-
407
- export type ToPathOption<
408
- TRouter extends AnyRouter = AnyRouter,
409
- TFrom extends string = string,
410
- TTo extends string | undefined = string,
411
- > = ConstrainLiteral<
412
- TTo,
413
- RelativeToPathAutoComplete<
414
- TRouter,
415
- NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',
416
- NoInfer<TTo> & string
417
- >
418
- >
419
-
420
- export type FromPathOption<TRouter extends AnyRouter, TFrom> = ConstrainLiteral<
421
- TFrom,
422
- RoutePaths<TRouter['routeTree']>
423
- >
424
-
425
- export type LinkOptions<
426
- TRouter extends AnyRouter = RegisteredRouter,
427
- TFrom extends string = string,
428
- TTo extends string | undefined = '.',
429
- TMaskFrom extends string = TFrom,
430
- TMaskTo extends string = '.',
431
- > = NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & LinkOptionsProps
432
-
433
- // type Test1 = ResolveRelativePath<'/', '/posts'>
434
- // // ^?
435
- // type Test4 = ResolveRelativePath<'/posts/1/comments', '../..'>
436
- // // ^?
437
- // type Test5 = ResolveRelativePath<'/posts/1/comments', '../../..'>
438
- // // ^?
439
- // type Test6 = ResolveRelativePath<'/posts/1/comments', './1'>
440
- // // ^?
441
- // type Test7 = ResolveRelativePath<'/posts/1/comments', './1/2'>
442
- // // ^?
443
- // type Test8 = ResolveRelativePath<'/posts/1/comments', '../edit'>
444
- // // ^?
445
- // type Test9 = ResolveRelativePath<'/posts/1/comments', '1'>
446
- // // ^?
447
- // type Test10 = ResolveRelativePath<'/posts/1/comments', './1'>
448
- // // ^?
449
- // type Test11 = ResolveRelativePath<'/posts/1/comments', './1/2'>
450
- // // ^?
451
- type LinkCurrentTargetElement = {
452
- preloadTimeout?: null | ReturnType<typeof setTimeout>
453
- }
454
-
455
31
  export function useLinkProps<
456
32
  TRouter extends AnyRouter = RegisteredRouter,
457
33
  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,
@@ -987,8 +563,8 @@ export type LinkOptionsFnOptions<
987
563
  TRouter extends AnyRouter = RegisteredRouter,
988
564
  > =
989
565
  TOptions extends ReadonlyArray<any>
990
- ? ValidateLinkOptionsArray<TOptions, TComp, TRouter>
991
- : ValidateLinkOptions<TOptions, TComp, TRouter>
566
+ ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>
567
+ : ValidateLinkOptions<TRouter, TOptions, string, TComp>
992
568
 
993
569
  export type LinkOptionsFn<TComp> = <
994
570
  const TOptions,
package/src/not-found.tsx CHANGED
@@ -2,7 +2,7 @@ import { CatchBoundary } from './CatchBoundary'
2
2
  import { useRouterState } from './useRouterState'
3
3
  import type * as Solid from 'solid-js'
4
4
  import type { RegisteredRouter } from './router'
5
- import type { RouteIds } from './routeInfo'
5
+ import type { RouteIds } from '@tanstack/router-core'
6
6
 
7
7
  export type NotFoundError = {
8
8
  /**
package/src/redirects.ts CHANGED
@@ -1,7 +1,9 @@
1
- import type { NavigateOptions } from './link'
2
- import type { RoutePaths } from './routeInfo'
3
1
  import type { AnyRouter, RegisteredRouter } from './router'
4
- import type { PickAsRequired } from '@tanstack/router-core'
2
+ import type {
3
+ NavigateOptions,
4
+ PickAsRequired,
5
+ RoutePaths,
6
+ } from '@tanstack/router-core'
5
7
 
6
8
  export type AnyRedirect = Redirect<any, any, any, any, any>
7
9