@tanstack/router-core 0.0.1-beta.193 → 0.0.1-beta.195
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/history.js +88 -15
- package/build/cjs/history.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/utils.js +2 -0
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +91 -16
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +128 -128
- package/build/types/fileRoute.d.ts +3 -2
- package/build/types/history.d.ts +17 -0
- package/build/types/route.d.ts +62 -36
- package/build/types/routeInfo.d.ts +2 -2
- package/build/types/router.d.ts +3 -3
- package/build/types/utils.d.ts +1 -1
- package/build/umd/index.development.js +91 -16
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/fileRoute.ts +10 -17
- package/src/history.ts +113 -15
- package/src/route.ts +54 -121
- package/src/routeInfo.ts +1 -5
- package/src/router.ts +1 -4
- package/src/utils.ts +2 -1
package/src/route.ts
CHANGED
|
@@ -24,7 +24,6 @@ export interface RegisterRouteComponent<
|
|
|
24
24
|
TLoader = unknown,
|
|
25
25
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
26
26
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
27
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
28
27
|
TAllContext extends Record<string, any> = AnyContext,
|
|
29
28
|
> {
|
|
30
29
|
// RouteComponent: unknown // This is registered by the framework
|
|
@@ -32,7 +31,6 @@ export interface RegisterRouteComponent<
|
|
|
32
31
|
export interface RegisterErrorRouteComponent<
|
|
33
32
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
34
33
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
35
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
36
34
|
TAllContext extends Record<string, any> = AnyContext,
|
|
37
35
|
> {
|
|
38
36
|
// ErrorRouteComponent: unknown // This is registered by the framework
|
|
@@ -40,7 +38,6 @@ export interface RegisterErrorRouteComponent<
|
|
|
40
38
|
export interface RegisterPendingRouteComponent<
|
|
41
39
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
42
40
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
43
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
44
41
|
TAllContext extends Record<string, any> = AnyContext,
|
|
45
42
|
> {
|
|
46
43
|
// PendingRouteComponent: unknown // This is registered by the framework
|
|
@@ -50,7 +47,6 @@ export interface RegisterRouteProps<
|
|
|
50
47
|
TLoader = unknown,
|
|
51
48
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
52
49
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
53
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
54
50
|
TAllContext extends Record<string, any> = AnyContext,
|
|
55
51
|
> {
|
|
56
52
|
// RouteProps: unknown // This is registered by the framework
|
|
@@ -58,7 +54,6 @@ export interface RegisterRouteProps<
|
|
|
58
54
|
export interface RegisterErrorRouteProps<
|
|
59
55
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
60
56
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
61
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
62
57
|
TAllContext extends Record<string, any> = AnyContext,
|
|
63
58
|
> {
|
|
64
59
|
// ErrorRouteProps: unknown // This is registered by the framework
|
|
@@ -67,7 +62,6 @@ export interface RegisterErrorRouteProps<
|
|
|
67
62
|
export interface RegisterPendingRouteProps<
|
|
68
63
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
69
64
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
70
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
71
65
|
TAllContext extends Record<string, any> = AnyContext,
|
|
72
66
|
> {
|
|
73
67
|
// PendingRouteProps: unknown // This is registered by the framework
|
|
@@ -77,13 +71,11 @@ export type RegisteredRouteComponent<
|
|
|
77
71
|
TLoader = unknown,
|
|
78
72
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
79
73
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
80
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
81
74
|
TAllContext extends Record<string, any> = AnyContext,
|
|
82
75
|
> = RegisterRouteComponent<
|
|
83
76
|
TLoader,
|
|
84
77
|
TFullSearchSchema,
|
|
85
78
|
TAllParams,
|
|
86
|
-
TRouteContext,
|
|
87
79
|
TAllContext
|
|
88
80
|
> extends {
|
|
89
81
|
RouteComponent: infer T
|
|
@@ -94,12 +86,10 @@ export type RegisteredRouteComponent<
|
|
|
94
86
|
export type RegisteredErrorRouteComponent<
|
|
95
87
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
96
88
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
97
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
98
89
|
TAllContext extends Record<string, any> = AnyContext,
|
|
99
90
|
> = RegisterErrorRouteComponent<
|
|
100
91
|
TFullSearchSchema,
|
|
101
92
|
TAllParams,
|
|
102
|
-
TRouteContext,
|
|
103
93
|
TAllContext
|
|
104
94
|
> extends {
|
|
105
95
|
ErrorRouteComponent: infer T
|
|
@@ -110,12 +100,10 @@ export type RegisteredErrorRouteComponent<
|
|
|
110
100
|
export type RegisteredPendingRouteComponent<
|
|
111
101
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
112
102
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
113
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
114
103
|
TAllContext extends Record<string, any> = AnyContext,
|
|
115
104
|
> = RegisterPendingRouteComponent<
|
|
116
105
|
TFullSearchSchema,
|
|
117
106
|
TAllParams,
|
|
118
|
-
TRouteContext,
|
|
119
107
|
TAllContext
|
|
120
108
|
> extends {
|
|
121
109
|
PendingRouteComponent: infer T
|
|
@@ -127,13 +115,11 @@ export type RegisteredRouteProps<
|
|
|
127
115
|
TLoader = unknown,
|
|
128
116
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
129
117
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
130
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
131
118
|
TAllContext extends Record<string, any> = AnyContext,
|
|
132
119
|
> = RegisterRouteProps<
|
|
133
120
|
TLoader,
|
|
134
121
|
TFullSearchSchema,
|
|
135
122
|
TAllParams,
|
|
136
|
-
TRouteContext,
|
|
137
123
|
TAllContext
|
|
138
124
|
> extends {
|
|
139
125
|
RouteProps: infer T
|
|
@@ -144,14 +130,8 @@ export type RegisteredRouteProps<
|
|
|
144
130
|
export type RegisteredErrorRouteProps<
|
|
145
131
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
146
132
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
147
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
148
133
|
TAllContext extends Record<string, any> = AnyContext,
|
|
149
|
-
> = RegisterRouteProps<
|
|
150
|
-
TFullSearchSchema,
|
|
151
|
-
TAllParams,
|
|
152
|
-
TRouteContext,
|
|
153
|
-
TAllContext
|
|
154
|
-
> extends {
|
|
134
|
+
> = RegisterRouteProps<TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
155
135
|
ErrorRouteProps: infer T
|
|
156
136
|
}
|
|
157
137
|
? T
|
|
@@ -160,14 +140,8 @@ export type RegisteredErrorRouteProps<
|
|
|
160
140
|
export type RegisteredPendingRouteProps<
|
|
161
141
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
162
142
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
163
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
164
143
|
TAllContext extends Record<string, any> = AnyContext,
|
|
165
|
-
> = RegisterRouteProps<
|
|
166
|
-
TFullSearchSchema,
|
|
167
|
-
TAllParams,
|
|
168
|
-
TRouteContext,
|
|
169
|
-
TAllContext
|
|
170
|
-
> extends {
|
|
144
|
+
> = RegisterRouteProps<TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
171
145
|
PendingRouteProps: infer T
|
|
172
146
|
}
|
|
173
147
|
? T
|
|
@@ -194,7 +168,7 @@ export type MetaOptions = keyof PickRequired<RouteMeta> extends never
|
|
|
194
168
|
meta: RouteMeta
|
|
195
169
|
}
|
|
196
170
|
|
|
197
|
-
export type AnyRouteProps = RegisteredRouteProps<any, any, any, any
|
|
171
|
+
export type AnyRouteProps = RegisteredRouteProps<any, any, any, any>
|
|
198
172
|
|
|
199
173
|
export type RouteOptions<
|
|
200
174
|
TParentRoute extends AnyRoute = AnyRoute,
|
|
@@ -206,8 +180,6 @@ export type RouteOptions<
|
|
|
206
180
|
TFullSearchSchema extends Record<string, any> = TSearchSchema,
|
|
207
181
|
TParams extends AnyPathParams = AnyPathParams,
|
|
208
182
|
TAllParams extends AnyPathParams = TParams,
|
|
209
|
-
TParentContext extends Record<string, any> = AnyContext,
|
|
210
|
-
TAllParentContext extends Record<string, any> = AnyContext,
|
|
211
183
|
TRouteContext extends RouteContext = RouteContext,
|
|
212
184
|
TAllContext extends Record<string, any> = AnyContext,
|
|
213
185
|
> = BaseRouteOptions<
|
|
@@ -220,19 +192,10 @@ export type RouteOptions<
|
|
|
220
192
|
TFullSearchSchema,
|
|
221
193
|
TParams,
|
|
222
194
|
TAllParams,
|
|
223
|
-
TParentContext,
|
|
224
|
-
TAllParentContext,
|
|
225
195
|
TRouteContext,
|
|
226
196
|
TAllContext
|
|
227
197
|
> &
|
|
228
|
-
UpdatableRouteOptions<
|
|
229
|
-
TLoader,
|
|
230
|
-
TSearchSchema,
|
|
231
|
-
TFullSearchSchema,
|
|
232
|
-
TAllParams,
|
|
233
|
-
TRouteContext,
|
|
234
|
-
TAllContext
|
|
235
|
-
>
|
|
198
|
+
UpdatableRouteOptions<TLoader, TFullSearchSchema, TAllParams, TAllContext>
|
|
236
199
|
|
|
237
200
|
export type ParamsFallback<
|
|
238
201
|
TPath extends string,
|
|
@@ -253,8 +216,6 @@ export type BaseRouteOptions<
|
|
|
253
216
|
TFullSearchSchema extends Record<string, any> = TSearchSchema,
|
|
254
217
|
TParams extends AnyPathParams = {},
|
|
255
218
|
TAllParams = ParamsFallback<TPath, TParams>,
|
|
256
|
-
TParentContext extends Record<string, any> = AnyContext,
|
|
257
|
-
TAllParentContext extends Record<string, any> = AnyContext,
|
|
258
219
|
TRouteContext extends RouteContext = RouteContext,
|
|
259
220
|
TAllContext extends Record<string, any> = AnyContext,
|
|
260
221
|
> = RoutePathOptions<TCustomId, TPath> & {
|
|
@@ -270,7 +231,6 @@ export type BaseRouteOptions<
|
|
|
270
231
|
beforeLoad?: BeforeLoadFn<
|
|
271
232
|
TParentRoute,
|
|
272
233
|
TAllParams,
|
|
273
|
-
TAllParentContext,
|
|
274
234
|
NoInfer<TLoaderContext>,
|
|
275
235
|
TRouteContext
|
|
276
236
|
>
|
|
@@ -279,7 +239,6 @@ export type BaseRouteOptions<
|
|
|
279
239
|
beforeLoad: BeforeLoadFn<
|
|
280
240
|
TParentRoute,
|
|
281
241
|
TAllParams,
|
|
282
|
-
TAllParentContext,
|
|
283
242
|
NoInfer<TLoaderContext>,
|
|
284
243
|
TRouteContext
|
|
285
244
|
>
|
|
@@ -315,24 +274,21 @@ export type BaseRouteOptions<
|
|
|
315
274
|
)
|
|
316
275
|
|
|
317
276
|
type BeforeLoadFn<
|
|
318
|
-
TParentRoute,
|
|
277
|
+
TParentRoute extends AnyRoute,
|
|
319
278
|
TAllParams,
|
|
320
|
-
TParentContext,
|
|
321
279
|
TLoaderContext,
|
|
322
280
|
TRouteContext,
|
|
323
281
|
> = (opts: {
|
|
324
282
|
abortController: AbortController
|
|
325
283
|
preload: boolean
|
|
326
284
|
params: TAllParams
|
|
327
|
-
context: Expand<
|
|
285
|
+
context: Expand<TParentRoute['types']['context'] & TLoaderContext>
|
|
328
286
|
}) => Promise<TRouteContext> | TRouteContext | void
|
|
329
287
|
|
|
330
288
|
export type UpdatableRouteOptions<
|
|
331
289
|
TLoader,
|
|
332
|
-
TSearchSchema extends Record<string, any>,
|
|
333
290
|
TFullSearchSchema extends Record<string, any>,
|
|
334
291
|
TAllParams extends AnyPathParams,
|
|
335
|
-
TRouteContext extends Record<string, any>,
|
|
336
292
|
TAllContext extends Record<string, any>,
|
|
337
293
|
> = MetaOptions & {
|
|
338
294
|
// If true, this route will be matched as case-sensitive
|
|
@@ -344,21 +300,18 @@ export type UpdatableRouteOptions<
|
|
|
344
300
|
TLoader,
|
|
345
301
|
TFullSearchSchema,
|
|
346
302
|
TAllParams,
|
|
347
|
-
TRouteContext,
|
|
348
303
|
TAllContext
|
|
349
304
|
>
|
|
350
305
|
// The content to be rendered when the route encounters an error
|
|
351
306
|
errorComponent?: RegisteredErrorRouteComponent<
|
|
352
307
|
TFullSearchSchema,
|
|
353
308
|
TAllParams,
|
|
354
|
-
TRouteContext,
|
|
355
309
|
TAllContext
|
|
356
310
|
> //
|
|
357
311
|
// If supported by your framework, the content to be rendered as the fallback content until the route is ready to render
|
|
358
312
|
pendingComponent?: RegisteredPendingRouteComponent<
|
|
359
313
|
TFullSearchSchema,
|
|
360
314
|
TAllParams,
|
|
361
|
-
TRouteContext,
|
|
362
315
|
TAllContext
|
|
363
316
|
>
|
|
364
317
|
// Filter functions that can manipulate search params *before* they are passed to links and navigate
|
|
@@ -447,7 +400,7 @@ export interface LoaderContext<
|
|
|
447
400
|
abortController: AbortController
|
|
448
401
|
preload: boolean
|
|
449
402
|
params: TAllParams
|
|
450
|
-
context: DeepMergeAll<[TAllContext, TLoaderContext, TRouteContext]
|
|
403
|
+
context: Expand<DeepMergeAll<[TAllContext, TLoaderContext, TRouteContext]>>
|
|
451
404
|
}
|
|
452
405
|
|
|
453
406
|
export type SearchFilter<T, U = T> = (prev: T) => U
|
|
@@ -489,8 +442,6 @@ export interface AnyRoute
|
|
|
489
442
|
any,
|
|
490
443
|
any,
|
|
491
444
|
any,
|
|
492
|
-
any,
|
|
493
|
-
any,
|
|
494
445
|
any
|
|
495
446
|
> {}
|
|
496
447
|
|
|
@@ -535,7 +486,6 @@ export type RouteConstraints = {
|
|
|
535
486
|
TParams: Record<string, any>
|
|
536
487
|
TAllParams: Record<string, any>
|
|
537
488
|
TParentContext: AnyContext
|
|
538
|
-
TAllParentContext: AnyContext
|
|
539
489
|
TRouteContext: RouteContext
|
|
540
490
|
TAllContext: AnyContext
|
|
541
491
|
TRouterContext: AnyContext
|
|
@@ -556,7 +506,7 @@ export class Route<
|
|
|
556
506
|
TCustomId,
|
|
557
507
|
TPath
|
|
558
508
|
>,
|
|
559
|
-
TLoaderContext extends RouteConstraints['TLoaderContext'] =
|
|
509
|
+
TLoaderContext extends RouteConstraints['TLoaderContext'] = {},
|
|
560
510
|
TLoader = unknown,
|
|
561
511
|
TSearchSchema extends RouteConstraints['TSearchSchema'] = {},
|
|
562
512
|
TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<
|
|
@@ -570,12 +520,15 @@ export class Route<
|
|
|
570
520
|
TParentRoute,
|
|
571
521
|
TParams
|
|
572
522
|
>,
|
|
573
|
-
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['types']['routeContext'],
|
|
574
|
-
TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['types']['context'],
|
|
575
523
|
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
576
|
-
TAllContext extends RouteConstraints['TAllContext'] =
|
|
577
|
-
|
|
578
|
-
|
|
524
|
+
TAllContext extends RouteConstraints['TAllContext'] = Expand<
|
|
525
|
+
DeepMergeAll<
|
|
526
|
+
[
|
|
527
|
+
IsAny<TParentRoute['types']['context'], {}>,
|
|
528
|
+
TLoaderContext,
|
|
529
|
+
TRouteContext,
|
|
530
|
+
]
|
|
531
|
+
>
|
|
579
532
|
>,
|
|
580
533
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
581
534
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
@@ -593,8 +546,6 @@ export class Route<
|
|
|
593
546
|
fullSearchSchema: TFullSearchSchema
|
|
594
547
|
params: TParams
|
|
595
548
|
allParams: TAllParams
|
|
596
|
-
parentContext: TParentContext
|
|
597
|
-
allParentContext: TAllParentContext
|
|
598
549
|
routeContext: TRouteContext
|
|
599
550
|
context: TAllContext
|
|
600
551
|
children: TChildren
|
|
@@ -612,8 +563,6 @@ export class Route<
|
|
|
612
563
|
TFullSearchSchema,
|
|
613
564
|
TParams,
|
|
614
565
|
TAllParams,
|
|
615
|
-
TParentContext,
|
|
616
|
-
TAllParentContext,
|
|
617
566
|
TRouteContext,
|
|
618
567
|
TAllContext
|
|
619
568
|
>
|
|
@@ -643,17 +592,13 @@ export class Route<
|
|
|
643
592
|
TFullSearchSchema,
|
|
644
593
|
TParams,
|
|
645
594
|
TAllParams,
|
|
646
|
-
TParentContext,
|
|
647
|
-
TAllParentContext,
|
|
648
595
|
TRouteContext,
|
|
649
596
|
TAllContext
|
|
650
597
|
> &
|
|
651
598
|
UpdatableRouteOptions<
|
|
652
599
|
TLoader,
|
|
653
|
-
TSearchSchema,
|
|
654
600
|
TFullSearchSchema,
|
|
655
601
|
TAllParams,
|
|
656
|
-
TRouteContext,
|
|
657
602
|
TAllContext
|
|
658
603
|
>,
|
|
659
604
|
) {
|
|
@@ -676,8 +621,6 @@ export class Route<
|
|
|
676
621
|
TFullSearchSchema,
|
|
677
622
|
TParams,
|
|
678
623
|
TAllParams,
|
|
679
|
-
TParentContext,
|
|
680
|
-
TAllParentContext,
|
|
681
624
|
TRouteContext,
|
|
682
625
|
TAllContext
|
|
683
626
|
> &
|
|
@@ -747,8 +690,6 @@ export class Route<
|
|
|
747
690
|
TFullSearchSchema,
|
|
748
691
|
TParams,
|
|
749
692
|
TAllParams,
|
|
750
|
-
TParentContext,
|
|
751
|
-
TAllParentContext,
|
|
752
693
|
TRouteContext,
|
|
753
694
|
TAllContext,
|
|
754
695
|
TRouterContext,
|
|
@@ -762,10 +703,8 @@ export class Route<
|
|
|
762
703
|
update = (
|
|
763
704
|
options: UpdatableRouteOptions<
|
|
764
705
|
TLoader,
|
|
765
|
-
TSearchSchema,
|
|
766
706
|
TFullSearchSchema,
|
|
767
707
|
TAllParams,
|
|
768
|
-
TRouteContext,
|
|
769
708
|
TAllContext
|
|
770
709
|
>,
|
|
771
710
|
) => {
|
|
@@ -792,19 +731,17 @@ export class RouterContext<TRouterContext extends {}> {
|
|
|
792
731
|
>(
|
|
793
732
|
options?: Omit<
|
|
794
733
|
RouteOptions<
|
|
795
|
-
AnyRoute,
|
|
796
|
-
RootRouteId,
|
|
797
|
-
'',
|
|
798
|
-
TLoaderContext,
|
|
799
|
-
TLoader,
|
|
800
|
-
TSearchSchema,
|
|
801
|
-
TSearchSchema,
|
|
802
|
-
{},
|
|
803
|
-
{},
|
|
804
|
-
|
|
805
|
-
TRouterContext,
|
|
806
|
-
TRouteContext,
|
|
807
|
-
MergeFromFromParent<TRouterContext, TRouteContext>
|
|
734
|
+
AnyRoute, // TParentRoute
|
|
735
|
+
RootRouteId, // TCustomId
|
|
736
|
+
'', // TPath
|
|
737
|
+
TLoaderContext, // TLoaderContext
|
|
738
|
+
TLoader, // TLoader
|
|
739
|
+
TSearchSchema, // TSearchSchema
|
|
740
|
+
TSearchSchema, // TFullSearchSchema
|
|
741
|
+
{}, // TParams
|
|
742
|
+
{}, // TAllParams
|
|
743
|
+
TRouteContext, // TRouteContext
|
|
744
|
+
DeepMergeAll<[TRouterContext, TLoaderContext, TRouteContext]> // TAllContext
|
|
808
745
|
>,
|
|
809
746
|
| 'path'
|
|
810
747
|
| 'id'
|
|
@@ -831,41 +768,37 @@ export class RootRoute<
|
|
|
831
768
|
TRouteContext extends RouteContext = RouteContext,
|
|
832
769
|
TRouterContext extends {} = {},
|
|
833
770
|
> extends Route<
|
|
834
|
-
any,
|
|
835
|
-
'/',
|
|
836
|
-
'/',
|
|
837
|
-
string,
|
|
838
|
-
RootRouteId,
|
|
839
|
-
TLoaderContext,
|
|
840
|
-
TLoader,
|
|
841
|
-
TSearchSchema,
|
|
842
|
-
TSearchSchema,
|
|
843
|
-
{},
|
|
844
|
-
{},
|
|
845
|
-
|
|
846
|
-
TRouterContext,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
any,
|
|
851
|
-
any
|
|
771
|
+
any, // TParentRoute
|
|
772
|
+
'/', // TPath
|
|
773
|
+
'/', // TFullPath
|
|
774
|
+
string, // TCustomId
|
|
775
|
+
RootRouteId, // TId
|
|
776
|
+
TLoaderContext, // TLoaderContext
|
|
777
|
+
TLoader, // TLoader
|
|
778
|
+
TSearchSchema, // TSearchSchema
|
|
779
|
+
TSearchSchema, // TFullSearchSchema
|
|
780
|
+
{}, // TParams
|
|
781
|
+
{}, // TAllParams
|
|
782
|
+
TRouteContext, // TRouteContext
|
|
783
|
+
DeepMergeAll<[TRouterContext, TLoaderContext, TRouteContext]>, // TAllContext
|
|
784
|
+
TRouterContext, // TRouterContext
|
|
785
|
+
any, // TChildren
|
|
786
|
+
any // TRouteTree
|
|
852
787
|
> {
|
|
853
788
|
constructor(
|
|
854
789
|
options?: Omit<
|
|
855
790
|
RouteOptions<
|
|
856
|
-
AnyRoute,
|
|
857
|
-
RootRouteId,
|
|
858
|
-
'',
|
|
859
|
-
TLoaderContext,
|
|
860
|
-
TLoader,
|
|
861
|
-
TSearchSchema,
|
|
862
|
-
TSearchSchema,
|
|
863
|
-
{},
|
|
864
|
-
{},
|
|
865
|
-
|
|
866
|
-
TRouterContext,
|
|
867
|
-
TRouteContext,
|
|
868
|
-
MergeFromFromParent<TRouterContext, TRouteContext>
|
|
791
|
+
AnyRoute, // TParentRoute
|
|
792
|
+
RootRouteId, // TCustomId
|
|
793
|
+
'', // TPath
|
|
794
|
+
TLoaderContext, // TLoaderContext
|
|
795
|
+
TLoader, // TLoader
|
|
796
|
+
TSearchSchema, // TSearchSchema
|
|
797
|
+
TSearchSchema, // TFullSearchSchema
|
|
798
|
+
{}, // TParams
|
|
799
|
+
{}, // TAllParams
|
|
800
|
+
TRouteContext, // TRouteContext
|
|
801
|
+
DeepMergeAll<[TRouterContext, TLoaderContext, TRouteContext]> // TAllContext
|
|
869
802
|
>,
|
|
870
803
|
| 'path'
|
|
871
804
|
| 'id'
|
package/src/routeInfo.ts
CHANGED
|
@@ -21,8 +21,6 @@ export type ParseRouteChildren<TRouteTree extends AnyRoute> =
|
|
|
21
21
|
any,
|
|
22
22
|
any,
|
|
23
23
|
any,
|
|
24
|
-
any,
|
|
25
|
-
any,
|
|
26
24
|
infer TChildren,
|
|
27
25
|
any
|
|
28
26
|
>
|
|
@@ -63,9 +61,7 @@ export type RoutePaths<TRouteTree extends AnyRoute> =
|
|
|
63
61
|
|
|
64
62
|
export type FullSearchSchema<TRouteTree extends AnyRoute> = Partial<
|
|
65
63
|
Expand<
|
|
66
|
-
UnionToIntersection<
|
|
67
|
-
ParseRoute<TRouteTree>['types']['fullSearchSchema']
|
|
68
|
-
> & {}
|
|
64
|
+
UnionToIntersection<ParseRoute<TRouteTree>['types']['fullSearchSchema']>
|
|
69
65
|
>
|
|
70
66
|
>
|
|
71
67
|
|
package/src/router.ts
CHANGED
|
@@ -163,19 +163,16 @@ export interface RouterOptions<
|
|
|
163
163
|
unknown,
|
|
164
164
|
AnySearchSchema,
|
|
165
165
|
AnyPathParams,
|
|
166
|
-
AnyContext,
|
|
167
166
|
AnyContext
|
|
168
167
|
>
|
|
169
168
|
defaultErrorComponent?: RegisteredErrorRouteComponent<
|
|
170
169
|
AnySearchSchema,
|
|
171
170
|
AnyPathParams,
|
|
172
|
-
AnyContext,
|
|
173
171
|
AnyContext
|
|
174
172
|
>
|
|
175
173
|
defaultPendingComponent?: RegisteredPendingRouteComponent<
|
|
176
174
|
AnySearchSchema,
|
|
177
175
|
AnyPathParams,
|
|
178
|
-
AnyContext,
|
|
179
176
|
AnyContext
|
|
180
177
|
>
|
|
181
178
|
defaultMaxAge?: number
|
|
@@ -1050,7 +1047,7 @@ export class Router<
|
|
|
1050
1047
|
|
|
1051
1048
|
this.setRouteMatch(match.id, (s) => ({
|
|
1052
1049
|
...s,
|
|
1053
|
-
context,
|
|
1050
|
+
context: replaceEqualDeep(s.context, context),
|
|
1054
1051
|
}))
|
|
1055
1052
|
} catch (err) {
|
|
1056
1053
|
handleError(err, 'BEFORE_LOAD')
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type NoInfer<T> = [T][T extends any ? 0 : never]
|
|
2
|
-
export type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N
|
|
2
|
+
export type IsAny<T, Y, N = T> = 1 extends 0 & T ? Y : N
|
|
3
3
|
export type IsAnyBoolean<T> = 1 extends 0 & T ? true : false
|
|
4
4
|
export type IsKnown<T, Y, N> = unknown extends T ? N : Y
|
|
5
5
|
export type PickAsRequired<T, K extends keyof T> = Omit<T, K> &
|
|
@@ -19,6 +19,7 @@ export type PickRequired<T> = {
|
|
|
19
19
|
[K in keyof T as undefined extends T[K] ? never : K]: T[K]
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// export type Expand<T> = T
|
|
22
23
|
export type Expand<T> = T extends object
|
|
23
24
|
? T extends infer O
|
|
24
25
|
? { [K in keyof O]: O[K] }
|