@tanstack/react-router 1.7.0 → 1.7.1

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "1.7.0",
4
+ "version": "1.7.1",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -44,7 +44,7 @@
44
44
  "@tanstack/store": "^0.1.3",
45
45
  "tiny-invariant": "^1.3.1",
46
46
  "tiny-warning": "^1.0.3",
47
- "@tanstack/history": "1.7.0"
47
+ "@tanstack/history": "1.7.1"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
package/src/link.tsx CHANGED
@@ -51,7 +51,11 @@ export type Split<S, TIncludeTrailingSlash = true> = S extends unknown
51
51
  : never
52
52
 
53
53
  export type ParsePathParams<T extends string> = keyof {
54
- [K in Trim<Split<T>[number], '_'> as K extends `$${infer L}` ? L extends '' ? '_splat' : L: never]: K
54
+ [K in Trim<Split<T>[number], '_'> as K extends `$${infer L}`
55
+ ? L extends ''
56
+ ? '_splat'
57
+ : L
58
+ : never]: K
55
59
  }
56
60
 
57
61
  export type Join<T, Delimiter extends string = '/'> = T extends []
@@ -163,6 +167,16 @@ export type ToSubOptions<
163
167
  type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo)
164
168
 
165
169
  type ParamVariant = 'PATH' | 'SEARCH'
170
+ type ExcludeRootSearchSchema<
171
+ T,
172
+ Excluded = Exclude<T, RootSearchSchema>,
173
+ > = [Excluded] extends [never] ? {} : Excluded
174
+
175
+ type PostProcessParams<
176
+ T,
177
+ TParamVariant extends ParamVariant,
178
+ > = TParamVariant extends 'SEARCH' ? ExcludeRootSearchSchema<T> : T
179
+
166
180
  export type ParamOptions<
167
181
  TRouteTree extends AnyRoute,
168
182
  TFrom,
@@ -179,11 +193,9 @@ export type ParamOptions<
179
193
  | 'fullSearchSchemaInput' = TParamVariant extends 'PATH'
180
194
  ? 'allParams'
181
195
  : 'fullSearchSchemaInput',
182
- TFromParams = Expand<
183
- Exclude<
184
- RouteByPath<TRouteTree, TFrom>['types'][TFromRouteType],
185
- RootSearchSchema
186
- >
196
+ TFromParams = PostProcessParams<
197
+ RouteByPath<TRouteTree, TFrom>['types'][TFromRouteType],
198
+ TParamVariant
187
199
  >,
188
200
  TToIndex = TTo extends ''
189
201
  ? ''
@@ -193,17 +205,13 @@ export type ParamOptions<
193
205
  TToParams = TToIndex extends ''
194
206
  ? TFromParams
195
207
  : never extends TResolved
196
- ? Expand<
197
- Exclude<
198
- RouteByPath<TRouteTree, TToIndex>['types'][TToRouteType],
199
- RootSearchSchema
200
- >
208
+ ? PostProcessParams<
209
+ RouteByPath<TRouteTree, TToIndex>['types'][TToRouteType],
210
+ TParamVariant
201
211
  >
202
- : Expand<
203
- Exclude<
204
- RouteByPath<TRouteTree, TResolved>['types'][TToRouteType],
205
- RootSearchSchema
206
- >
212
+ : PostProcessParams<
213
+ RouteByPath<TRouteTree, TResolved>['types'][TToRouteType],
214
+ TParamVariant
207
215
  >,
208
216
  TReducer = ParamsReducer<TFromParams, TToParams>,
209
217
  > = Expand<WithoutEmpty<PickRequired<TToParams>>> extends never