@tanstack/react-router 1.18.3 → 1.19.0
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/dist/cjs/Matches.cjs +75 -24
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +2 -3
- package/dist/cjs/RouterProvider.cjs +1 -10
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/awaited.cjs +2 -4
- package/dist/cjs/awaited.cjs.map +1 -1
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +6 -5
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/link.d.cts +2 -2
- package/dist/cjs/not-found.cjs.map +1 -1
- package/dist/cjs/not-found.d.cts +11 -1
- package/dist/cjs/redirects.cjs +1 -1
- package/dist/cjs/redirects.cjs.map +1 -1
- package/dist/cjs/route.cjs +3 -2
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +25 -24
- package/dist/cjs/router.cjs +172 -143
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +12 -8
- package/dist/esm/Matches.d.ts +2 -3
- package/dist/esm/Matches.js +67 -16
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.js +1 -10
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/awaited.js +2 -4
- package/dist/esm/awaited.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +6 -5
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/link.d.ts +2 -2
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/not-found.d.ts +11 -1
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/redirects.js +1 -1
- package/dist/esm/redirects.js.map +1 -1
- package/dist/esm/route.d.ts +25 -24
- package/dist/esm/route.js +3 -2
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +12 -8
- package/dist/esm/router.js +163 -134
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/Matches.tsx +100 -27
- package/src/RouterProvider.tsx +1 -12
- package/src/awaited.tsx +3 -5
- package/src/fileRoute.ts +8 -3
- package/src/link.tsx +7 -5
- package/src/not-found.tsx +11 -1
- package/src/redirects.ts +2 -1
- package/src/route.ts +55 -114
- package/src/router.ts +267 -175
package/src/RouterProvider.tsx
CHANGED
|
@@ -137,22 +137,11 @@ function Transitioner() {
|
|
|
137
137
|
useLayoutEffect(() => {
|
|
138
138
|
const unsub = router.history.subscribe(() => {
|
|
139
139
|
router.latestLocation = router.parseLocation(router.latestLocation)
|
|
140
|
-
if (
|
|
140
|
+
if (router.state.location !== router.latestLocation) {
|
|
141
141
|
tryLoad()
|
|
142
142
|
}
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
-
const nextLocation = router.buildLocation({
|
|
146
|
-
search: true,
|
|
147
|
-
params: true,
|
|
148
|
-
hash: true,
|
|
149
|
-
state: true,
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
if (routerState.location.href !== nextLocation.href) {
|
|
153
|
-
router.commitLocation({ ...nextLocation, replace: true })
|
|
154
|
-
}
|
|
155
|
-
|
|
156
145
|
return () => {
|
|
157
146
|
unsub()
|
|
158
147
|
}
|
package/src/awaited.tsx
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useRouter } from './useRouter'
|
|
3
|
+
import { defaultSerializeError } from './router'
|
|
3
4
|
import { DeferredPromise, isDehydratedDeferred } from './defer'
|
|
5
|
+
import { defaultDeserializeError, isServerSideError } from './Matches'
|
|
6
|
+
|
|
4
7
|
import warning from 'tiny-warning'
|
|
5
|
-
import {
|
|
6
|
-
isServerSideError,
|
|
7
|
-
defaultDeserializeError,
|
|
8
|
-
defaultSerializeError,
|
|
9
|
-
} from '.'
|
|
10
8
|
|
|
11
9
|
export type AwaitOptions<T> = {
|
|
12
10
|
promise: DeferredPromise<T>
|
package/src/fileRoute.ts
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
RouteConstraints,
|
|
17
17
|
ResolveFullSearchSchemaInput,
|
|
18
18
|
SearchSchemaInput,
|
|
19
|
-
LoaderFnContext,
|
|
20
19
|
RouteLoaderFn,
|
|
21
20
|
AnyPathParams,
|
|
22
21
|
AnySearchSchema,
|
|
@@ -26,7 +25,8 @@ import { useMatch, useLoaderDeps, useLoaderData, RouteMatch } from './Matches'
|
|
|
26
25
|
import { useSearch } from './useSearch'
|
|
27
26
|
import { useParams } from './useParams'
|
|
28
27
|
import warning from 'tiny-warning'
|
|
29
|
-
import { RegisteredRouter
|
|
28
|
+
import { RegisteredRouter } from './router'
|
|
29
|
+
import { RouteById, RouteIds } from './routeInfo'
|
|
30
30
|
|
|
31
31
|
export interface FileRoutesByPath {
|
|
32
32
|
// '/': {
|
|
@@ -188,7 +188,10 @@ export class FileRoute<
|
|
|
188
188
|
>,
|
|
189
189
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
190
190
|
TLoaderDeps extends Record<string, any> = {},
|
|
191
|
-
|
|
191
|
+
TLoaderDataReturn extends any = unknown,
|
|
192
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
193
|
+
? undefined
|
|
194
|
+
: TLoaderDataReturn,
|
|
192
195
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
193
196
|
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
194
197
|
>(
|
|
@@ -209,6 +212,7 @@ export class FileRoute<
|
|
|
209
212
|
TRouterContext,
|
|
210
213
|
TAllContext,
|
|
211
214
|
TLoaderDeps,
|
|
215
|
+
TLoaderDataReturn,
|
|
212
216
|
TLoaderData
|
|
213
217
|
>,
|
|
214
218
|
'getParentRoute' | 'path' | 'id'
|
|
@@ -232,6 +236,7 @@ export class FileRoute<
|
|
|
232
236
|
TAllContext,
|
|
233
237
|
TRouterContext,
|
|
234
238
|
TLoaderDeps,
|
|
239
|
+
TLoaderDataReturn,
|
|
235
240
|
TLoaderData,
|
|
236
241
|
TChildren,
|
|
237
242
|
TRouteTree
|
package/src/link.tsx
CHANGED
|
@@ -111,7 +111,7 @@ export type RelativeToCurrentPathAutoComplete<
|
|
|
111
111
|
|
|
112
112
|
export type AbsolutePathAutoComplete<TFrom extends string, TPaths> =
|
|
113
113
|
| (string extends TFrom
|
|
114
|
-
?
|
|
114
|
+
? './'
|
|
115
115
|
: TFrom extends `/`
|
|
116
116
|
? never
|
|
117
117
|
: SearchPaths<
|
|
@@ -122,7 +122,7 @@ export type AbsolutePathAutoComplete<TFrom extends string, TPaths> =
|
|
|
122
122
|
? never
|
|
123
123
|
: './'
|
|
124
124
|
: never)
|
|
125
|
-
| (string extends TFrom ?
|
|
125
|
+
| (string extends TFrom ? '../' : TFrom extends `/` ? never : '../')
|
|
126
126
|
| TPaths
|
|
127
127
|
|
|
128
128
|
export type RelativeToPathAutoComplete<
|
|
@@ -179,9 +179,7 @@ export type ToSubOptions<
|
|
|
179
179
|
TTo extends string = '',
|
|
180
180
|
> = {
|
|
181
181
|
to?: ToPathOption<TRouteTree, TFrom, TTo>
|
|
182
|
-
// The new has string or a function to update it
|
|
183
182
|
hash?: true | Updater<string>
|
|
184
|
-
// State to pass to the history stack
|
|
185
183
|
state?: true | NonNullableUpdater<HistoryState>
|
|
186
184
|
// The source route path. This is automatically set when using route-level APIs, but for type-safe relative routing on the router itself, this is required
|
|
187
185
|
from?: RoutePathsAutoComplete<TRouteTree, TFrom>
|
|
@@ -312,7 +310,11 @@ export type LinkOptions<
|
|
|
312
310
|
|
|
313
311
|
export type CheckPath<TRouteTree extends AnyRoute, TPass, TFrom, TTo> =
|
|
314
312
|
ResolveRoute<TRouteTree, TFrom, TTo> extends never
|
|
315
|
-
?
|
|
313
|
+
? string extends TFrom
|
|
314
|
+
? RemoveTrailingSlashes<TTo> extends '.' | '..'
|
|
315
|
+
? TPass
|
|
316
|
+
: CheckPathError<TRouteTree>
|
|
317
|
+
: CheckPathError<TRouteTree>
|
|
316
318
|
: TPass
|
|
317
319
|
|
|
318
320
|
export type CheckPathError<TRouteTree extends AnyRoute> = {
|
package/src/not-found.tsx
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { CatchBoundary } from './CatchBoundary'
|
|
3
3
|
import { useRouterState } from './useRouterState'
|
|
4
|
-
import { RegisteredRouter
|
|
4
|
+
import { RegisteredRouter } from './router'
|
|
5
|
+
import { RouteIds } from './routeInfo'
|
|
5
6
|
|
|
6
7
|
export type NotFoundError = {
|
|
8
|
+
/**
|
|
9
|
+
@deprecated
|
|
10
|
+
Use `routeId: rootRouteId` instead
|
|
11
|
+
*/
|
|
7
12
|
global?: boolean
|
|
13
|
+
/**
|
|
14
|
+
@private
|
|
15
|
+
Do not use this. It's used internally to indicate a path matching error
|
|
16
|
+
*/
|
|
17
|
+
_global?: boolean
|
|
8
18
|
data?: any
|
|
9
19
|
throw?: boolean
|
|
10
20
|
routeId?: RouteIds<RegisteredRouter['routeTree']>
|
package/src/redirects.ts
CHANGED
|
@@ -29,9 +29,10 @@ export function redirect<
|
|
|
29
29
|
opts: Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
|
|
30
30
|
): Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> {
|
|
31
31
|
;(opts as any).isRedirect = true
|
|
32
|
-
if (opts.throw) {
|
|
32
|
+
if (opts.throw ?? true) {
|
|
33
33
|
throw opts
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
return opts
|
|
36
37
|
}
|
|
37
38
|
|
package/src/route.ts
CHANGED
|
@@ -18,9 +18,8 @@ import {
|
|
|
18
18
|
UnionToIntersection,
|
|
19
19
|
} from './utils'
|
|
20
20
|
import { BuildLocationFn, NavigateFn } from './RouterProvider'
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import { NotFoundError, notFound } from '.'
|
|
21
|
+
import { NotFoundError, notFound } from './not-found'
|
|
22
|
+
import { LazyRoute } from './fileRoute'
|
|
24
23
|
|
|
25
24
|
export const rootRouteId = '__root__' as const
|
|
26
25
|
export type RootRouteId = typeof rootRouteId
|
|
@@ -67,7 +66,10 @@ export type RouteOptions<
|
|
|
67
66
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
68
67
|
TAllContext extends Record<string, any> = AnyContext,
|
|
69
68
|
TLoaderDeps extends Record<string, any> = {},
|
|
70
|
-
|
|
69
|
+
TLoaderDataReturn extends any = unknown,
|
|
70
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
71
|
+
? undefined
|
|
72
|
+
: TLoaderDataReturn,
|
|
71
73
|
> = BaseRouteOptions<
|
|
72
74
|
TParentRoute,
|
|
73
75
|
TCustomId,
|
|
@@ -84,6 +86,7 @@ export type RouteOptions<
|
|
|
84
86
|
TRouterContext,
|
|
85
87
|
TAllContext,
|
|
86
88
|
TLoaderDeps,
|
|
89
|
+
TLoaderDataReturn,
|
|
87
90
|
TLoaderData
|
|
88
91
|
> &
|
|
89
92
|
UpdatableRouteOptions<
|
|
@@ -113,7 +116,10 @@ export type BaseRouteOptions<
|
|
|
113
116
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
114
117
|
TAllContext extends Record<string, any> = AnyContext,
|
|
115
118
|
TLoaderDeps extends Record<string, any> = {},
|
|
116
|
-
|
|
119
|
+
TLoaderDataReturn extends any = unknown,
|
|
120
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
121
|
+
? undefined
|
|
122
|
+
: TLoaderDataReturn,
|
|
117
123
|
> = RoutePathOptions<TCustomId, TPath> & {
|
|
118
124
|
getParentRoute: () => TParentRoute
|
|
119
125
|
validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>
|
|
@@ -146,7 +152,7 @@ export type BaseRouteOptions<
|
|
|
146
152
|
NoInfer<TLoaderDeps>,
|
|
147
153
|
NoInfer<TAllContext>,
|
|
148
154
|
NoInfer<TRouteContext>,
|
|
149
|
-
|
|
155
|
+
TLoaderDataReturn
|
|
150
156
|
>
|
|
151
157
|
} & (
|
|
152
158
|
| {
|
|
@@ -295,7 +301,7 @@ export type RouteLoaderFn<
|
|
|
295
301
|
TLoaderData extends any = unknown,
|
|
296
302
|
> = (
|
|
297
303
|
match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext, TRouteContext>,
|
|
298
|
-
) => Promise<TLoaderData> | TLoaderData
|
|
304
|
+
) => Promise<TLoaderData> | TLoaderData | void
|
|
299
305
|
|
|
300
306
|
export interface LoaderFnContext<
|
|
301
307
|
TAllParams = {},
|
|
@@ -312,6 +318,7 @@ export interface LoaderFnContext<
|
|
|
312
318
|
navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>
|
|
313
319
|
parentMatchPromise?: Promise<void>
|
|
314
320
|
cause: 'preload' | 'enter' | 'stay'
|
|
321
|
+
route: Route
|
|
315
322
|
}
|
|
316
323
|
|
|
317
324
|
export type SearchFilter<T, U = T> = (prev: T) => U
|
|
@@ -376,6 +383,7 @@ export interface AnyRoute
|
|
|
376
383
|
any,
|
|
377
384
|
any,
|
|
378
385
|
any,
|
|
386
|
+
any,
|
|
379
387
|
any
|
|
380
388
|
> {}
|
|
381
389
|
|
|
@@ -409,104 +417,6 @@ export type RouteConstraints = {
|
|
|
409
417
|
TRouteTree: AnyRoute
|
|
410
418
|
}
|
|
411
419
|
|
|
412
|
-
// TODO: This is part of a future APi to move away from classes and
|
|
413
|
-
// towards a more functional API. It's not ready yet.
|
|
414
|
-
|
|
415
|
-
// type RouteApiInstance<
|
|
416
|
-
// TId extends RouteIds<RegisteredRouter['routeTree']>,
|
|
417
|
-
// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
|
|
418
|
-
// TFullSearchSchema extends Record<
|
|
419
|
-
// string,
|
|
420
|
-
// any
|
|
421
|
-
// > = TRoute['types']['fullSearchSchema'],
|
|
422
|
-
// TAllParams extends AnyPathParams = TRoute['types']['allParams'],
|
|
423
|
-
// TAllContext extends Record<string, any> = TRoute['types']['allContext'],
|
|
424
|
-
// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],
|
|
425
|
-
// TLoaderData extends any = TRoute['types']['loaderData'],
|
|
426
|
-
// > = {
|
|
427
|
-
// id: TId
|
|
428
|
-
// useMatch: <TSelected = TAllContext>(opts?: {
|
|
429
|
-
// select?: (s: TAllContext) => TSelected
|
|
430
|
-
// }) => TSelected
|
|
431
|
-
|
|
432
|
-
// useRouteContext: <TSelected = TAllContext>(opts?: {
|
|
433
|
-
// select?: (s: TAllContext) => TSelected
|
|
434
|
-
// }) => TSelected
|
|
435
|
-
|
|
436
|
-
// useSearch: <TSelected = TFullSearchSchema>(opts?: {
|
|
437
|
-
// select?: (s: TFullSearchSchema) => TSelected
|
|
438
|
-
// }) => TSelected
|
|
439
|
-
|
|
440
|
-
// useParams: <TSelected = TAllParams>(opts?: {
|
|
441
|
-
// select?: (s: TAllParams) => TSelected
|
|
442
|
-
// }) => TSelected
|
|
443
|
-
|
|
444
|
-
// useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {
|
|
445
|
-
// select?: (s: TLoaderDeps) => TSelected
|
|
446
|
-
// }) => TSelected
|
|
447
|
-
|
|
448
|
-
// useLoaderData: <TSelected = TLoaderData>(opts?: {
|
|
449
|
-
// select?: (s: TLoaderData) => TSelected
|
|
450
|
-
// }) => TSelected
|
|
451
|
-
// }
|
|
452
|
-
|
|
453
|
-
// export function RouteApi_v2<
|
|
454
|
-
// TId extends RouteIds<RegisteredRouter['routeTree']>,
|
|
455
|
-
// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
|
|
456
|
-
// TFullSearchSchema extends Record<
|
|
457
|
-
// string,
|
|
458
|
-
// any
|
|
459
|
-
// > = TRoute['types']['fullSearchSchema'],
|
|
460
|
-
// TAllParams extends AnyPathParams = TRoute['types']['allParams'],
|
|
461
|
-
// TAllContext extends Record<string, any> = TRoute['types']['allContext'],
|
|
462
|
-
// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],
|
|
463
|
-
// TLoaderData extends any = TRoute['types']['loaderData'],
|
|
464
|
-
// >({
|
|
465
|
-
// id,
|
|
466
|
-
// }: {
|
|
467
|
-
// id: TId
|
|
468
|
-
// }): RouteApiInstance<
|
|
469
|
-
// TId,
|
|
470
|
-
// TRoute,
|
|
471
|
-
// TFullSearchSchema,
|
|
472
|
-
// TAllParams,
|
|
473
|
-
// TAllContext,
|
|
474
|
-
// TLoaderDeps,
|
|
475
|
-
// TLoaderData
|
|
476
|
-
// > {
|
|
477
|
-
// return {
|
|
478
|
-
// id,
|
|
479
|
-
|
|
480
|
-
// useMatch: (opts) => {
|
|
481
|
-
// return useMatch({ ...opts, from: id })
|
|
482
|
-
// },
|
|
483
|
-
|
|
484
|
-
// useRouteContext: (opts) => {
|
|
485
|
-
// return useMatch({
|
|
486
|
-
// ...opts,
|
|
487
|
-
// from: id,
|
|
488
|
-
// select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),
|
|
489
|
-
// } as any)
|
|
490
|
-
// },
|
|
491
|
-
|
|
492
|
-
// useSearch: (opts) => {
|
|
493
|
-
// return useSearch({ ...opts, from: id } as any)
|
|
494
|
-
// },
|
|
495
|
-
|
|
496
|
-
// useParams: (opts) => {
|
|
497
|
-
// return useParams({ ...opts, from: id } as any)
|
|
498
|
-
// },
|
|
499
|
-
|
|
500
|
-
// useLoaderDeps: (opts) => {
|
|
501
|
-
// return useLoaderDeps({ ...opts, from: id } as any) as any
|
|
502
|
-
// },
|
|
503
|
-
|
|
504
|
-
// useLoaderData: (opts) => {
|
|
505
|
-
// return useLoaderData({ ...opts, from: id } as any) as any
|
|
506
|
-
// },
|
|
507
|
-
// }
|
|
508
|
-
// }
|
|
509
|
-
|
|
510
420
|
export function getRouteApi<
|
|
511
421
|
TId extends RouteIds<RegisteredRouter['routeTree']>,
|
|
512
422
|
TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
|
|
@@ -599,9 +509,6 @@ export class RouteApi<
|
|
|
599
509
|
}
|
|
600
510
|
}
|
|
601
511
|
|
|
602
|
-
/**
|
|
603
|
-
* @deprecated Use the `createRoute` function instead.
|
|
604
|
-
*/
|
|
605
512
|
export class Route<
|
|
606
513
|
TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,
|
|
607
514
|
in out TPath extends RouteConstraints['TPath'] = '/',
|
|
@@ -652,7 +559,10 @@ export class Route<
|
|
|
652
559
|
>,
|
|
653
560
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
654
561
|
TLoaderDeps extends Record<string, any> = {},
|
|
655
|
-
|
|
562
|
+
TLoaderDataReturn extends any = unknown,
|
|
563
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
564
|
+
? undefined
|
|
565
|
+
: TLoaderDataReturn,
|
|
656
566
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
657
567
|
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
658
568
|
> {
|
|
@@ -673,6 +583,7 @@ export class Route<
|
|
|
673
583
|
TRouterContext,
|
|
674
584
|
TAllContext,
|
|
675
585
|
TLoaderDeps,
|
|
586
|
+
TLoaderDataReturn,
|
|
676
587
|
TLoaderData
|
|
677
588
|
>
|
|
678
589
|
|
|
@@ -691,6 +602,9 @@ export class Route<
|
|
|
691
602
|
rank!: number
|
|
692
603
|
lazyFn?: () => Promise<LazyRoute<any>>
|
|
693
604
|
|
|
605
|
+
/**
|
|
606
|
+
* @deprecated Use the `createRoute` function instead.
|
|
607
|
+
*/
|
|
694
608
|
constructor(
|
|
695
609
|
options: RouteOptions<
|
|
696
610
|
TParentRoute,
|
|
@@ -708,6 +622,7 @@ export class Route<
|
|
|
708
622
|
TRouterContext,
|
|
709
623
|
TAllContext,
|
|
710
624
|
TLoaderDeps,
|
|
625
|
+
TLoaderDataReturn,
|
|
711
626
|
TLoaderData
|
|
712
627
|
>,
|
|
713
628
|
) {
|
|
@@ -762,6 +677,7 @@ export class Route<
|
|
|
762
677
|
TRouterContext,
|
|
763
678
|
TAllContext,
|
|
764
679
|
TLoaderDeps,
|
|
680
|
+
TLoaderDataReturn,
|
|
765
681
|
TLoaderData
|
|
766
682
|
> &
|
|
767
683
|
RoutePathOptionsIntersection<TCustomId, TPath>
|
|
@@ -836,6 +752,7 @@ export class Route<
|
|
|
836
752
|
TAllContext,
|
|
837
753
|
TRouterContext,
|
|
838
754
|
TLoaderDeps,
|
|
755
|
+
TLoaderDataReturn,
|
|
839
756
|
TLoaderData,
|
|
840
757
|
TNewChildren,
|
|
841
758
|
TRouteTree
|
|
@@ -985,7 +902,10 @@ export function createRoute<
|
|
|
985
902
|
>,
|
|
986
903
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
987
904
|
TLoaderDeps extends Record<string, any> = {},
|
|
988
|
-
|
|
905
|
+
TLoaderDataReturn extends any = unknown,
|
|
906
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
907
|
+
? undefined
|
|
908
|
+
: TLoaderDataReturn,
|
|
989
909
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
990
910
|
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
991
911
|
>(
|
|
@@ -1005,6 +925,7 @@ export function createRoute<
|
|
|
1005
925
|
TRouterContext,
|
|
1006
926
|
TAllContext,
|
|
1007
927
|
TLoaderDeps,
|
|
928
|
+
TLoaderDataReturn,
|
|
1008
929
|
TLoaderData
|
|
1009
930
|
>,
|
|
1010
931
|
) {
|
|
@@ -1026,6 +947,7 @@ export function createRoute<
|
|
|
1026
947
|
TAllContext,
|
|
1027
948
|
TRouterContext,
|
|
1028
949
|
TLoaderDeps,
|
|
950
|
+
TLoaderDataReturn,
|
|
1029
951
|
TLoaderData,
|
|
1030
952
|
TChildren,
|
|
1031
953
|
TRouteTree
|
|
@@ -1044,7 +966,10 @@ export function createRootRouteWithContext<TRouterContext extends {}>() {
|
|
|
1044
966
|
? RouteContext
|
|
1045
967
|
: TRouteContextReturn,
|
|
1046
968
|
TLoaderDeps extends Record<string, any> = {},
|
|
1047
|
-
|
|
969
|
+
TLoaderDataReturn extends any = unknown,
|
|
970
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
971
|
+
? undefined
|
|
972
|
+
: TLoaderDataReturn,
|
|
1048
973
|
>(
|
|
1049
974
|
options?: Omit<
|
|
1050
975
|
RouteOptions<
|
|
@@ -1063,6 +988,7 @@ export function createRootRouteWithContext<TRouterContext extends {}>() {
|
|
|
1063
988
|
TRouterContext,
|
|
1064
989
|
Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
1065
990
|
TLoaderDeps,
|
|
991
|
+
TLoaderDataReturn, // TLoaderDataReturn,
|
|
1066
992
|
TLoaderData // TLoaderData,
|
|
1067
993
|
>,
|
|
1068
994
|
| 'path'
|
|
@@ -1105,7 +1031,10 @@ export class RootRoute<
|
|
|
1105
1031
|
: TRouteContextReturn,
|
|
1106
1032
|
TRouterContext extends {} = {},
|
|
1107
1033
|
TLoaderDeps extends Record<string, any> = {},
|
|
1108
|
-
|
|
1034
|
+
TLoaderDataReturn extends any = unknown,
|
|
1035
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
1036
|
+
? undefined
|
|
1037
|
+
: TLoaderDataReturn,
|
|
1109
1038
|
> extends Route<
|
|
1110
1039
|
any, // TParentRoute
|
|
1111
1040
|
'/', // TPath
|
|
@@ -1124,6 +1053,7 @@ export class RootRoute<
|
|
|
1124
1053
|
Expand<Assign<TRouterContext, TRouteContext>>, // TAllContext
|
|
1125
1054
|
TRouterContext, // TRouterContext
|
|
1126
1055
|
TLoaderDeps,
|
|
1056
|
+
TLoaderDataReturn,
|
|
1127
1057
|
TLoaderData,
|
|
1128
1058
|
any, // TChildren
|
|
1129
1059
|
any // TRouteTree
|
|
@@ -1149,6 +1079,7 @@ export class RootRoute<
|
|
|
1149
1079
|
TRouterContext,
|
|
1150
1080
|
Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
1151
1081
|
TLoaderDeps,
|
|
1082
|
+
TLoaderDataReturn,
|
|
1152
1083
|
TLoaderData
|
|
1153
1084
|
>,
|
|
1154
1085
|
| 'path'
|
|
@@ -1173,7 +1104,10 @@ export function createRootRoute<
|
|
|
1173
1104
|
: TRouteContextReturn,
|
|
1174
1105
|
TRouterContext extends {} = {},
|
|
1175
1106
|
TLoaderDeps extends Record<string, any> = {},
|
|
1176
|
-
|
|
1107
|
+
TLoaderDataReturn extends any = unknown,
|
|
1108
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
1109
|
+
? undefined
|
|
1110
|
+
: TLoaderDataReturn,
|
|
1177
1111
|
>(
|
|
1178
1112
|
options?: Omit<
|
|
1179
1113
|
RouteOptions<
|
|
@@ -1192,6 +1126,7 @@ export function createRootRoute<
|
|
|
1192
1126
|
TRouterContext,
|
|
1193
1127
|
Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
1194
1128
|
TLoaderDeps,
|
|
1129
|
+
TLoaderDataReturn,
|
|
1195
1130
|
TLoaderData
|
|
1196
1131
|
>,
|
|
1197
1132
|
| 'path'
|
|
@@ -1210,6 +1145,7 @@ export function createRootRoute<
|
|
|
1210
1145
|
TRouteContext,
|
|
1211
1146
|
TRouterContext,
|
|
1212
1147
|
TLoaderDeps,
|
|
1148
|
+
TLoaderDataReturn,
|
|
1213
1149
|
TLoaderData
|
|
1214
1150
|
>(options)
|
|
1215
1151
|
}
|
|
@@ -1333,7 +1269,10 @@ export class NotFoundRoute<
|
|
|
1333
1269
|
>,
|
|
1334
1270
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
1335
1271
|
TLoaderDeps extends Record<string, any> = {},
|
|
1336
|
-
|
|
1272
|
+
TLoaderDataReturn extends any = unknown,
|
|
1273
|
+
TLoaderData extends any = [TLoaderDataReturn] extends [never]
|
|
1274
|
+
? undefined
|
|
1275
|
+
: TLoaderDataReturn,
|
|
1337
1276
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
1338
1277
|
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
1339
1278
|
> extends Route<
|
|
@@ -1354,6 +1293,7 @@ export class NotFoundRoute<
|
|
|
1354
1293
|
TAllContext,
|
|
1355
1294
|
TRouterContext,
|
|
1356
1295
|
TLoaderDeps,
|
|
1296
|
+
TLoaderDataReturn,
|
|
1357
1297
|
TLoaderData,
|
|
1358
1298
|
TChildren,
|
|
1359
1299
|
TRouteTree
|
|
@@ -1376,6 +1316,7 @@ export class NotFoundRoute<
|
|
|
1376
1316
|
TRouterContext,
|
|
1377
1317
|
TAllContext,
|
|
1378
1318
|
TLoaderDeps,
|
|
1319
|
+
TLoaderDataReturn,
|
|
1379
1320
|
TLoaderData
|
|
1380
1321
|
>,
|
|
1381
1322
|
'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'
|