@tanstack/router-core 0.0.1-beta.152 → 0.0.1-beta.153
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/fileRoute.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js +3 -2
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +3 -2
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +116 -116
- package/build/types/index.d.ts +80 -140
- package/build/umd/index.development.js +3 -2
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/fileRoute.ts +31 -29
- package/src/link.ts +57 -56
- package/src/route.ts +11 -33
- package/src/routeInfo.ts +58 -139
- package/src/router.ts +104 -113
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.153",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"tiny-invariant": "^1.3.1",
|
|
44
44
|
"tiny-warning": "^1.0.3",
|
|
45
45
|
"@gisatcz/cross-package-react-context": "^0.2.0",
|
|
46
|
-
"@tanstack/react-store": "0.0.1-beta.
|
|
46
|
+
"@tanstack/react-store": "0.0.1-beta.153"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "rollup --config rollup.config.js",
|
package/src/fileRoute.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CleanPath, Last, ParsePathParams, Split } from './link'
|
|
1
|
+
import { ParsePathParams } from './link'
|
|
3
2
|
import {
|
|
4
3
|
AnyRoute,
|
|
5
4
|
ResolveFullPath,
|
|
6
|
-
ResolveId,
|
|
7
5
|
AnySearchSchema,
|
|
8
6
|
ResolveFullSearchSchema,
|
|
9
7
|
MergeParamsFromParent,
|
|
@@ -16,8 +14,8 @@ import {
|
|
|
16
14
|
AnyPathParams,
|
|
17
15
|
RootRouteId,
|
|
18
16
|
TrimPathLeft,
|
|
17
|
+
RouteConstraints,
|
|
19
18
|
} from './route'
|
|
20
|
-
import { DefaultRoutesInfo } from './routeInfo'
|
|
21
19
|
|
|
22
20
|
export interface FileRoutesByPath {
|
|
23
21
|
// '/': {
|
|
@@ -48,6 +46,12 @@ export type Trim<T extends string, S extends string> = TrimLeft<
|
|
|
48
46
|
S
|
|
49
47
|
>
|
|
50
48
|
|
|
49
|
+
export type RemoveUnderScores<T extends string> = Replace<
|
|
50
|
+
Replace<TrimRight<TrimLeft<T, '/_'>, '_'>, '_/', '/'>,
|
|
51
|
+
'/_',
|
|
52
|
+
'/'
|
|
53
|
+
>
|
|
54
|
+
|
|
51
55
|
export type ResolveFilePath<
|
|
52
56
|
TParentRoute extends AnyRoute,
|
|
53
57
|
TFilePath extends string,
|
|
@@ -69,44 +73,42 @@ export type FileRoutePath<
|
|
|
69
73
|
export class FileRoute<
|
|
70
74
|
TFilePath extends keyof FileRoutesByPath,
|
|
71
75
|
TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],
|
|
72
|
-
TId extends
|
|
73
|
-
TPath extends
|
|
74
|
-
|
|
76
|
+
TId extends RouteConstraints['TId'] = TFilePath,
|
|
77
|
+
TPath extends RouteConstraints['TPath'] = FileRoutePath<
|
|
78
|
+
TParentRoute,
|
|
79
|
+
TFilePath
|
|
80
|
+
>,
|
|
81
|
+
TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<
|
|
82
|
+
TParentRoute,
|
|
83
|
+
RemoveUnderScores<TPath>
|
|
84
|
+
>,
|
|
75
85
|
> {
|
|
76
86
|
constructor(public path: TFilePath) {}
|
|
77
87
|
|
|
78
88
|
createRoute = <
|
|
79
89
|
TLoader = unknown,
|
|
80
|
-
TSearchSchema extends
|
|
81
|
-
TFullSearchSchema extends
|
|
90
|
+
TSearchSchema extends RouteConstraints['TSearchSchema'] = {},
|
|
91
|
+
TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<
|
|
82
92
|
TParentRoute,
|
|
83
93
|
TSearchSchema
|
|
84
94
|
>,
|
|
85
|
-
TParams extends ParsePathParams<TPath> extends never
|
|
95
|
+
TParams extends RouteConstraints['TParams'] = ParsePathParams<TPath> extends never
|
|
86
96
|
? AnyPathParams
|
|
87
|
-
: Record<
|
|
88
|
-
|
|
89
|
-
any
|
|
90
|
-
> = ParsePathParams<TPath> extends never
|
|
91
|
-
? AnyPathParams
|
|
92
|
-
: Record<ParsePathParams<TPath>, string>,
|
|
93
|
-
TAllParams extends MergeParamsFromParent<
|
|
97
|
+
: Record<ParsePathParams<TPath>, RouteConstraints['TPath']>,
|
|
98
|
+
TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<
|
|
94
99
|
TParentRoute['__types']['allParams'],
|
|
95
100
|
TParams
|
|
96
|
-
|
|
97
|
-
TParentContext extends
|
|
98
|
-
TAllParentContext extends
|
|
99
|
-
TRouteContext extends
|
|
100
|
-
TContext extends MergeParamsFromParent<
|
|
101
|
-
TParentRoute['__types']['context'],
|
|
102
|
-
TRouteContext
|
|
103
|
-
> = MergeParamsFromParent<
|
|
101
|
+
>,
|
|
102
|
+
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['__types']['routeContext'],
|
|
103
|
+
TAllParentContext extends RouteConstraints['TId'] = TParentRoute['__types']['context'],
|
|
104
|
+
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
105
|
+
TContext extends RouteConstraints['TContext'] = MergeParamsFromParent<
|
|
104
106
|
TParentRoute['__types']['context'],
|
|
105
107
|
TRouteContext
|
|
106
108
|
>,
|
|
107
|
-
TRouterContext extends
|
|
108
|
-
TChildren extends
|
|
109
|
-
|
|
109
|
+
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
110
|
+
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
111
|
+
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
110
112
|
>(
|
|
111
113
|
options: Omit<
|
|
112
114
|
RouteOptions<
|
|
@@ -151,7 +153,7 @@ export class FileRoute<
|
|
|
151
153
|
TContext,
|
|
152
154
|
TRouterContext,
|
|
153
155
|
TChildren,
|
|
154
|
-
|
|
156
|
+
TRouteTree
|
|
155
157
|
> => {
|
|
156
158
|
const route = new Route(options as any)
|
|
157
159
|
;(route as any).isRoot = false
|
package/src/link.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { Trim } from './fileRoute'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { AnyRoute } from './route'
|
|
3
|
+
import {
|
|
4
|
+
AllParams,
|
|
5
|
+
FullSearchSchema,
|
|
6
|
+
RouteByPath,
|
|
7
|
+
RouteIds,
|
|
8
|
+
RoutePaths,
|
|
9
|
+
} from './routeInfo'
|
|
10
|
+
import { ParsedLocation, LocationState } from './router'
|
|
4
11
|
import { NoInfer, PickRequired, UnionToIntersection, Updater } from './utils'
|
|
5
12
|
|
|
6
13
|
export type LinkInfo =
|
|
@@ -111,21 +118,21 @@ export type RelativeToPathAutoComplete<
|
|
|
111
118
|
| AllPaths
|
|
112
119
|
|
|
113
120
|
export type NavigateOptions<
|
|
114
|
-
|
|
115
|
-
TFrom extends
|
|
121
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
122
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
116
123
|
TTo extends string = '',
|
|
117
|
-
> = ToOptions<
|
|
124
|
+
> = ToOptions<TRouteTree, TFrom, TTo> & {
|
|
118
125
|
// `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.
|
|
119
126
|
replace?: boolean
|
|
120
127
|
}
|
|
121
128
|
|
|
122
129
|
export type ToOptions<
|
|
123
|
-
|
|
124
|
-
TFrom extends
|
|
130
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
131
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
125
132
|
TTo extends string = '',
|
|
126
133
|
TResolvedTo = ResolveRelativePath<TFrom, NoInfer<TTo>>,
|
|
127
134
|
> = {
|
|
128
|
-
to?: ToPathOption<
|
|
135
|
+
to?: ToPathOption<TRouteTree, TFrom, TTo>
|
|
129
136
|
// The new has string or a function to update it
|
|
130
137
|
hash?: Updater<string>
|
|
131
138
|
// State to pass to the history stack
|
|
@@ -134,37 +141,34 @@ export type ToOptions<
|
|
|
134
141
|
from?: TFrom
|
|
135
142
|
// // When using relative route paths, this option forces resolution from the current path, instead of the route API's path or `from` path
|
|
136
143
|
// fromCurrent?: boolean
|
|
137
|
-
} & CheckPath<
|
|
138
|
-
SearchParamOptions<
|
|
139
|
-
PathParamOptions<
|
|
144
|
+
} & CheckPath<TRouteTree, NoInfer<TResolvedTo>, {}> &
|
|
145
|
+
SearchParamOptions<TRouteTree, TFrom, TResolvedTo> &
|
|
146
|
+
PathParamOptions<TRouteTree, TFrom, TResolvedTo>
|
|
140
147
|
|
|
141
148
|
export type SearchParamOptions<
|
|
142
|
-
|
|
149
|
+
TRouteTree extends AnyRoute,
|
|
143
150
|
TFrom,
|
|
144
151
|
TTo,
|
|
145
152
|
TFromSchema = UnionToIntersection<
|
|
146
|
-
|
|
147
|
-
RouteByPath<TRoutesInfo, TFrom> extends never
|
|
153
|
+
FullSearchSchema<TRouteTree> & RouteByPath<TRouteTree, TFrom> extends never
|
|
148
154
|
? {}
|
|
149
|
-
: RouteByPath<
|
|
155
|
+
: RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']
|
|
150
156
|
>,
|
|
151
157
|
// Find the schema for the new path, and make optional any keys
|
|
152
158
|
// that are already defined in the current schema
|
|
153
159
|
TToSchema = Partial<
|
|
154
|
-
RouteByPath<
|
|
160
|
+
RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']
|
|
155
161
|
> &
|
|
156
162
|
Omit<
|
|
157
|
-
RouteByPath<
|
|
163
|
+
RouteByPath<TRouteTree, TTo>['__types']['fullSearchSchema'],
|
|
158
164
|
keyof PickRequired<
|
|
159
|
-
RouteByPath<
|
|
165
|
+
RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']
|
|
160
166
|
>
|
|
161
167
|
>,
|
|
162
168
|
TFromFullSchema = UnionToIntersection<
|
|
163
|
-
|
|
164
|
-
>,
|
|
165
|
-
TToFullSchema = UnionToIntersection<
|
|
166
|
-
TRoutesInfo['fullSearchSchema'] & TToSchema
|
|
169
|
+
FullSearchSchema<TRouteTree> & TFromSchema
|
|
167
170
|
>,
|
|
171
|
+
TToFullSchema = UnionToIntersection<FullSearchSchema<TRouteTree> & TToSchema>,
|
|
168
172
|
> = keyof PickRequired<TToSchema> extends never
|
|
169
173
|
? {
|
|
170
174
|
search?: true | SearchReducer<TFromFullSchema, TToFullSchema>
|
|
@@ -178,25 +182,23 @@ type SearchReducer<TFrom, TTo> =
|
|
|
178
182
|
| ((current: TFrom) => TTo)
|
|
179
183
|
|
|
180
184
|
export type PathParamOptions<
|
|
181
|
-
|
|
185
|
+
TRouteTree extends AnyRoute,
|
|
182
186
|
TFrom,
|
|
183
187
|
TTo,
|
|
184
188
|
TFromSchema = UnionToIntersection<
|
|
185
|
-
RouteByPath<
|
|
189
|
+
RouteByPath<TRouteTree, TFrom> extends never
|
|
186
190
|
? {}
|
|
187
|
-
: RouteByPath<
|
|
191
|
+
: RouteByPath<TRouteTree, TFrom>['__types']['allParams']
|
|
188
192
|
>,
|
|
189
193
|
// Find the schema for the new path, and make optional any keys
|
|
190
194
|
// that are already defined in the current schema
|
|
191
|
-
TToSchema = Partial<RouteByPath<
|
|
195
|
+
TToSchema = Partial<RouteByPath<TRouteTree, TFrom>['__types']['allParams']> &
|
|
192
196
|
Omit<
|
|
193
|
-
RouteByPath<
|
|
194
|
-
keyof PickRequired<
|
|
195
|
-
RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']
|
|
196
|
-
>
|
|
197
|
+
RouteByPath<TRouteTree, TTo>['__types']['allParams'],
|
|
198
|
+
keyof PickRequired<RouteByPath<TRouteTree, TFrom>['__types']['allParams']>
|
|
197
199
|
>,
|
|
198
|
-
TFromFullParams = UnionToIntersection<
|
|
199
|
-
TToFullParams = UnionToIntersection<
|
|
200
|
+
TFromFullParams = UnionToIntersection<AllParams<TRouteTree> & TFromSchema>,
|
|
201
|
+
TToFullParams = UnionToIntersection<AllParams<TRouteTree> & TToSchema>,
|
|
200
202
|
> = keyof PickRequired<TToSchema> extends never
|
|
201
203
|
? {
|
|
202
204
|
params?: ParamsReducer<TFromFullParams, TToFullParams>
|
|
@@ -208,25 +210,25 @@ export type PathParamOptions<
|
|
|
208
210
|
type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo)
|
|
209
211
|
|
|
210
212
|
export type ToPathOption<
|
|
211
|
-
|
|
212
|
-
TFrom extends
|
|
213
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
214
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
213
215
|
TTo extends string = '',
|
|
214
216
|
> =
|
|
215
217
|
| TTo
|
|
216
218
|
| RelativeToPathAutoComplete<
|
|
217
|
-
|
|
219
|
+
RoutePaths<TRouteTree>,
|
|
218
220
|
NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',
|
|
219
221
|
NoInfer<TTo> & string
|
|
220
222
|
>
|
|
221
223
|
|
|
222
224
|
export type ToIdOption<
|
|
223
|
-
|
|
224
|
-
TFrom extends
|
|
225
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
226
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
225
227
|
TTo extends string = '',
|
|
226
228
|
> =
|
|
227
229
|
| TTo
|
|
228
230
|
| RelativeToPathAutoComplete<
|
|
229
|
-
|
|
231
|
+
RouteIds<TRouteTree>,
|
|
230
232
|
NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',
|
|
231
233
|
NoInfer<TTo> & string
|
|
232
234
|
>
|
|
@@ -238,10 +240,10 @@ export interface ActiveOptions {
|
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
export type LinkOptions<
|
|
241
|
-
|
|
242
|
-
TFrom extends
|
|
243
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
244
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
243
245
|
TTo extends string = '',
|
|
244
|
-
> = NavigateOptions<
|
|
246
|
+
> = NavigateOptions<TRouteTree, TFrom, TTo> & {
|
|
245
247
|
// The standard anchor tag target attribute
|
|
246
248
|
target?: HTMLAnchorElement['target']
|
|
247
249
|
// Defaults to `{ exact: false, includeHash: false }`
|
|
@@ -255,47 +257,46 @@ export type LinkOptions<
|
|
|
255
257
|
}
|
|
256
258
|
|
|
257
259
|
export type CheckRelativePath<
|
|
258
|
-
|
|
260
|
+
TRouteTree extends AnyRoute,
|
|
259
261
|
TFrom,
|
|
260
262
|
TTo,
|
|
261
263
|
> = TTo extends string
|
|
262
264
|
? TFrom extends string
|
|
263
|
-
? ResolveRelativePath<TFrom, TTo> extends
|
|
265
|
+
? ResolveRelativePath<TFrom, TTo> extends RoutePaths<TRouteTree>
|
|
264
266
|
? {}
|
|
265
267
|
: {
|
|
266
268
|
Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<
|
|
267
269
|
TFrom,
|
|
268
270
|
TTo
|
|
269
271
|
>}, which is not a valid route path.`
|
|
270
|
-
'Valid Route Paths':
|
|
272
|
+
'Valid Route Paths': RoutePaths<TRouteTree>
|
|
271
273
|
}
|
|
272
274
|
: {}
|
|
273
275
|
: {}
|
|
274
276
|
|
|
275
|
-
export type CheckPath<
|
|
276
|
-
TRoutesInfo extends AnyRoutesInfo,
|
|
277
|
+
export type CheckPath<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<
|
|
277
278
|
TPath,
|
|
278
|
-
|
|
279
|
-
>
|
|
279
|
+
RoutePaths<TRouteTree>
|
|
280
|
+
> extends never
|
|
280
281
|
? TPass
|
|
281
|
-
: CheckPathError<
|
|
282
|
+
: CheckPathError<TRouteTree, Exclude<TPath, RoutePaths<TRouteTree>>>
|
|
282
283
|
|
|
283
|
-
export type CheckPathError<
|
|
284
|
-
to:
|
|
284
|
+
export type CheckPathError<TRouteTree extends AnyRoute, TInvalids> = {
|
|
285
|
+
to: RoutePaths<TRouteTree>
|
|
285
286
|
}
|
|
286
287
|
|
|
287
|
-
export type CheckId<
|
|
288
|
+
export type CheckId<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<
|
|
288
289
|
TPath,
|
|
289
|
-
|
|
290
|
+
RouteIds<TRouteTree>
|
|
290
291
|
> extends never
|
|
291
292
|
? TPass
|
|
292
|
-
: CheckIdError<
|
|
293
|
+
: CheckIdError<TRouteTree, Exclude<TPath, RouteIds<TRouteTree>>>
|
|
293
294
|
|
|
294
|
-
export type CheckIdError<
|
|
295
|
+
export type CheckIdError<TRouteTree extends AnyRoute, TInvalids> = {
|
|
295
296
|
Error: `${TInvalids extends string
|
|
296
297
|
? TInvalids
|
|
297
298
|
: never} is not a valid route ID.`
|
|
298
|
-
'Valid Route IDs':
|
|
299
|
+
'Valid Route IDs': RouteIds<TRouteTree>
|
|
299
300
|
}
|
|
300
301
|
|
|
301
302
|
export type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string
|
package/src/route.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ParsePathParams } from './link'
|
|
2
|
-
import { AnyRouter, Router, RouteMatch } from './router'
|
|
2
|
+
import { AnyRouter, Router, RouteMatch, RegisteredRouter } from './router'
|
|
3
3
|
import { IsAny, NoInfer, PickRequired, UnionToIntersection } from './utils'
|
|
4
4
|
import invariant from 'tiny-invariant'
|
|
5
5
|
import { joinPaths, trimPath } from './path'
|
|
6
|
-
import { AnyRoutesInfo, DefaultRoutesInfo } from './routeInfo'
|
|
7
6
|
|
|
8
7
|
export const rootRouteId = '__root__' as const
|
|
9
8
|
export type RootRouteId = typeof rootRouteId
|
|
@@ -72,7 +71,7 @@ export type ComponentPropsFromRoute<TRoute> = TRoute extends Route<
|
|
|
72
71
|
infer TContext,
|
|
73
72
|
infer TRouterContext,
|
|
74
73
|
infer TChildren,
|
|
75
|
-
infer
|
|
74
|
+
infer TRouteTree
|
|
76
75
|
>
|
|
77
76
|
? RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>
|
|
78
77
|
: never
|
|
@@ -93,11 +92,11 @@ export type RouteLoaderFromRoute<TRoute extends AnyRoute> = LoaderFn<
|
|
|
93
92
|
export type RouteProps<
|
|
94
93
|
TLoader = unknown,
|
|
95
94
|
TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
|
|
96
|
-
TAllParams = AnyPathParams,
|
|
97
|
-
TRouteContext = AnyContext,
|
|
98
|
-
TContext = AnyContext,
|
|
95
|
+
TAllParams extends AnyPathParams = AnyPathParams,
|
|
96
|
+
TRouteContext extends AnyContext = AnyContext,
|
|
97
|
+
TContext extends AnyContext = AnyContext,
|
|
99
98
|
> = {
|
|
100
|
-
useMatch: () => RouteMatch<
|
|
99
|
+
useMatch: () => RouteMatch<any, any>
|
|
101
100
|
useLoader: () => UseLoaderResult<TLoader>
|
|
102
101
|
useSearch: <
|
|
103
102
|
TStrict extends boolean = true,
|
|
@@ -499,27 +498,6 @@ export interface AnyRoute
|
|
|
499
498
|
any
|
|
500
499
|
> {}
|
|
501
500
|
|
|
502
|
-
export type AnyRouteWithRouterContext<TRouterContext extends AnyContext> =
|
|
503
|
-
Route<
|
|
504
|
-
any,
|
|
505
|
-
any,
|
|
506
|
-
any,
|
|
507
|
-
any,
|
|
508
|
-
any,
|
|
509
|
-
any,
|
|
510
|
-
any,
|
|
511
|
-
any,
|
|
512
|
-
any,
|
|
513
|
-
any,
|
|
514
|
-
any,
|
|
515
|
-
any,
|
|
516
|
-
any,
|
|
517
|
-
any,
|
|
518
|
-
TRouterContext,
|
|
519
|
-
any,
|
|
520
|
-
any
|
|
521
|
-
>
|
|
522
|
-
|
|
523
501
|
export type MergeParamsFromParent<T, U> = IsAny<T, U, T & U>
|
|
524
502
|
|
|
525
503
|
export type UseLoaderResult<T> = T extends Record<PropertyKey, infer U>
|
|
@@ -555,7 +533,7 @@ export type RouteConstraints = {
|
|
|
555
533
|
TContext: AnyContext
|
|
556
534
|
TRouterContext: AnyContext
|
|
557
535
|
TChildren: unknown
|
|
558
|
-
|
|
536
|
+
TRouteTree: AnyRoute
|
|
559
537
|
}
|
|
560
538
|
|
|
561
539
|
export class Route<
|
|
@@ -594,7 +572,7 @@ export class Route<
|
|
|
594
572
|
>,
|
|
595
573
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
596
574
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
597
|
-
|
|
575
|
+
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
598
576
|
> {
|
|
599
577
|
__types!: {
|
|
600
578
|
parentRoute: TParentRoute
|
|
@@ -613,7 +591,7 @@ export class Route<
|
|
|
613
591
|
routeContext: TRouteContext
|
|
614
592
|
context: TContext
|
|
615
593
|
children: TChildren
|
|
616
|
-
|
|
594
|
+
routeTree: TRouteTree
|
|
617
595
|
routerContext: TRouterContext
|
|
618
596
|
}
|
|
619
597
|
isRoot: TParentRoute extends Route<any> ? true : false
|
|
@@ -652,7 +630,7 @@ export class Route<
|
|
|
652
630
|
// Optional
|
|
653
631
|
children?: TChildren
|
|
654
632
|
originalIndex?: number
|
|
655
|
-
router?:
|
|
633
|
+
router?: AnyRouter
|
|
656
634
|
rank!: number
|
|
657
635
|
|
|
658
636
|
constructor(
|
|
@@ -768,7 +746,7 @@ export class Route<
|
|
|
768
746
|
TContext,
|
|
769
747
|
TRouterContext,
|
|
770
748
|
TNewChildren,
|
|
771
|
-
|
|
749
|
+
TRouteTree
|
|
772
750
|
> => {
|
|
773
751
|
this.children = children as any
|
|
774
752
|
return this as any
|