@tanstack/react-router 1.2.1 → 1.2.2
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/build/cjs/link.js.map +1 -1
- package/build/cjs/useNavigate.js.map +1 -1
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +374 -374
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/link.tsx +19 -4
- package/src/useNavigate.tsx +1 -1
- package/src/utils.ts +10 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
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.2.
|
|
47
|
+
"@tanstack/history": "1.2.2"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/link.tsx
CHANGED
|
@@ -184,13 +184,28 @@ export type ParamOptions<
|
|
|
184
184
|
| 'fullSearchSchemaInput' = TParamVariant extends 'PATH'
|
|
185
185
|
? 'allParams'
|
|
186
186
|
: 'fullSearchSchemaInput',
|
|
187
|
-
TFromParams = Expand<
|
|
188
|
-
|
|
187
|
+
TFromParams = Expand<
|
|
188
|
+
Exclude<
|
|
189
|
+
RouteByPath<TRouteTree, TFrom>['types'][TFromRouteType],
|
|
190
|
+
RootSearchSchema
|
|
191
|
+
>
|
|
192
|
+
>,
|
|
193
|
+
TToIndex = RouteByPath<TRouteTree, `${TTo}/`> extends never ? TTo : `${TTo}/`,
|
|
189
194
|
TToParams = TToIndex extends ''
|
|
190
195
|
? TFromParams
|
|
191
196
|
: never extends TResolved
|
|
192
|
-
? Expand<
|
|
193
|
-
|
|
197
|
+
? Expand<
|
|
198
|
+
Exclude<
|
|
199
|
+
RouteByPath<TRouteTree, TToIndex>['types'][TToRouteType],
|
|
200
|
+
RootSearchSchema
|
|
201
|
+
>
|
|
202
|
+
>
|
|
203
|
+
: Expand<
|
|
204
|
+
Exclude<
|
|
205
|
+
RouteByPath<TRouteTree, TResolved>['types'][TToRouteType],
|
|
206
|
+
RootSearchSchema
|
|
207
|
+
>
|
|
208
|
+
>,
|
|
194
209
|
TReducer = ParamsReducer<TFromParams, TToParams>,
|
|
195
210
|
> = Expand<WithoutEmpty<PickRequired<TToParams>>> extends never
|
|
196
211
|
? Partial<MakeParamOption<TParamVariant, true | TReducer>>
|
package/src/useNavigate.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export function useNavigate<
|
|
|
21
21
|
<
|
|
22
22
|
TFrom extends RoutePaths<TRouteTree> | string = TDefaultFrom,
|
|
23
23
|
TTo extends string = '',
|
|
24
|
-
TMaskFrom extends RoutePaths<TRouteTree
|
|
24
|
+
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
25
25
|
TMaskTo extends string = '',
|
|
26
26
|
>({
|
|
27
27
|
from,
|
package/src/utils.ts
CHANGED
|
@@ -18,8 +18,8 @@ export type PickExtra<T, K> = {
|
|
|
18
18
|
[TKey in keyof K as string extends TKey
|
|
19
19
|
? never
|
|
20
20
|
: TKey extends keyof T
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
? never
|
|
22
|
+
: TKey]: K[TKey]
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export type PickRequired<T> = {
|
|
@@ -108,15 +108,15 @@ export type ValueKeys<O> = Extract<keyof O, PropertyKey>
|
|
|
108
108
|
export type DeepAwaited<T> = T extends Promise<infer A>
|
|
109
109
|
? DeepAwaited<A>
|
|
110
110
|
: T extends Record<infer A, Promise<infer B>>
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
? { [K in A]: DeepAwaited<B> }
|
|
112
|
+
: T
|
|
113
113
|
|
|
114
114
|
export type PathParamMask<TRoutePath extends string> =
|
|
115
115
|
TRoutePath extends `${infer L}/$${infer C}/${infer R}`
|
|
116
116
|
? PathParamMask<`${L}/${string}/${R}`>
|
|
117
117
|
: TRoutePath extends `${infer L}/$${infer C}`
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
? PathParamMask<`${L}/${string}`>
|
|
119
|
+
: TRoutePath
|
|
120
120
|
|
|
121
121
|
export type Timeout = ReturnType<typeof setTimeout>
|
|
122
122
|
|
|
@@ -327,10 +327,10 @@ export type RouteFromIdOrRoute<
|
|
|
327
327
|
> = T extends ParseRoute<TRouteTree>
|
|
328
328
|
? T
|
|
329
329
|
: T extends RouteIds<TRouteTree>
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
330
|
+
? RoutesById<TRouteTree>[T]
|
|
331
|
+
: T extends string
|
|
332
|
+
? RouteIds<TRouteTree>
|
|
333
|
+
: never
|
|
334
334
|
|
|
335
335
|
export function useRouteContext<
|
|
336
336
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|