@tanstack/router-core 0.0.1-beta.151 → 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 +4 -2
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +4 -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 +153 -186
- package/build/umd/index.development.js +4 -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 +79 -37
- package/src/link.ts +62 -62
- package/src/route.ts +63 -88
- package/src/routeInfo.ts +58 -139
- package/src/router.ts +106 -114
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,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParsePathParams } from './link'
|
|
2
2
|
import {
|
|
3
3
|
AnyRoute,
|
|
4
4
|
ResolveFullPath,
|
|
5
|
-
ResolveId,
|
|
6
5
|
AnySearchSchema,
|
|
7
6
|
ResolveFullSearchSchema,
|
|
8
7
|
MergeParamsFromParent,
|
|
@@ -12,8 +11,11 @@ import {
|
|
|
12
11
|
InferFullSearchSchema,
|
|
13
12
|
UpdatableRouteOptions,
|
|
14
13
|
Route,
|
|
14
|
+
AnyPathParams,
|
|
15
|
+
RootRouteId,
|
|
16
|
+
TrimPathLeft,
|
|
17
|
+
RouteConstraints,
|
|
15
18
|
} from './route'
|
|
16
|
-
import { DefaultRoutesInfo } from './routeInfo'
|
|
17
19
|
|
|
18
20
|
export interface FileRoutesByPath {
|
|
19
21
|
// '/': {
|
|
@@ -21,62 +23,102 @@ export interface FileRoutesByPath {
|
|
|
21
23
|
// }
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
type Replace<
|
|
27
|
+
S extends string,
|
|
28
|
+
From extends string,
|
|
29
|
+
To extends string,
|
|
30
|
+
> = S extends `${infer Start}${From}${infer Rest}`
|
|
31
|
+
? `${Start}${To}${Replace<Rest, From, To>}`
|
|
32
|
+
: S
|
|
33
|
+
|
|
34
|
+
export type TrimLeft<
|
|
35
|
+
T extends string,
|
|
36
|
+
S extends string,
|
|
37
|
+
> = T extends `${S}${infer U}` ? U : T
|
|
38
|
+
|
|
39
|
+
export type TrimRight<
|
|
40
|
+
T extends string,
|
|
41
|
+
S extends string,
|
|
42
|
+
> = T extends `${infer U}${S}` ? U : T
|
|
43
|
+
|
|
44
|
+
export type Trim<T extends string, S extends string> = TrimLeft<
|
|
45
|
+
TrimRight<T, S>,
|
|
46
|
+
S
|
|
47
|
+
>
|
|
48
|
+
|
|
49
|
+
export type RemoveUnderScores<T extends string> = Replace<
|
|
50
|
+
Replace<TrimRight<TrimLeft<T, '/_'>, '_'>, '_/', '/'>,
|
|
51
|
+
'/_',
|
|
52
|
+
'/'
|
|
53
|
+
>
|
|
54
|
+
|
|
55
|
+
export type ResolveFilePath<
|
|
56
|
+
TParentRoute extends AnyRoute,
|
|
57
|
+
TFilePath extends string,
|
|
58
|
+
> = TParentRoute['id'] extends RootRouteId
|
|
59
|
+
? TrimPathLeft<TFilePath>
|
|
60
|
+
: Replace<
|
|
61
|
+
TrimPathLeft<TFilePath>,
|
|
62
|
+
TrimPathLeft<TParentRoute['__types']['customId']>,
|
|
63
|
+
''
|
|
64
|
+
>
|
|
65
|
+
|
|
66
|
+
export type FileRoutePath<
|
|
67
|
+
TParentRoute extends AnyRoute,
|
|
68
|
+
TFilePath extends string,
|
|
69
|
+
> = ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}`
|
|
70
|
+
? string
|
|
71
|
+
: ResolveFilePath<TParentRoute, TFilePath>
|
|
72
|
+
|
|
24
73
|
export class FileRoute<
|
|
25
74
|
TFilePath extends keyof FileRoutesByPath,
|
|
26
75
|
TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
>,
|
|
29
85
|
> {
|
|
30
86
|
constructor(public path: TFilePath) {}
|
|
31
87
|
|
|
32
88
|
createRoute = <
|
|
33
|
-
TFullPath extends ResolveFullPath<TParentRoute, TPath> = ResolveFullPath<
|
|
34
|
-
TParentRoute,
|
|
35
|
-
TPath
|
|
36
|
-
>,
|
|
37
|
-
TId extends ResolveId<TParentRoute, TCustomId, TPath> = ResolveId<
|
|
38
|
-
TParentRoute,
|
|
39
|
-
TCustomId,
|
|
40
|
-
TPath
|
|
41
|
-
>,
|
|
42
89
|
TLoader = unknown,
|
|
43
|
-
TSearchSchema extends
|
|
44
|
-
TFullSearchSchema extends
|
|
90
|
+
TSearchSchema extends RouteConstraints['TSearchSchema'] = {},
|
|
91
|
+
TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<
|
|
45
92
|
TParentRoute,
|
|
46
93
|
TSearchSchema
|
|
47
94
|
>,
|
|
48
|
-
TParams extends
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
TAllParams extends MergeParamsFromParent<
|
|
95
|
+
TParams extends RouteConstraints['TParams'] = ParsePathParams<TPath> extends never
|
|
96
|
+
? AnyPathParams
|
|
97
|
+
: Record<ParsePathParams<TPath>, RouteConstraints['TPath']>,
|
|
98
|
+
TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<
|
|
53
99
|
TParentRoute['__types']['allParams'],
|
|
54
100
|
TParams
|
|
55
|
-
|
|
56
|
-
TParentContext extends
|
|
57
|
-
TAllParentContext extends
|
|
58
|
-
TRouteContext extends
|
|
59
|
-
TContext extends MergeParamsFromParent<
|
|
60
|
-
TParentRoute['__types']['context'],
|
|
61
|
-
TRouteContext
|
|
62
|
-
> = 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<
|
|
63
106
|
TParentRoute['__types']['context'],
|
|
64
107
|
TRouteContext
|
|
65
108
|
>,
|
|
66
|
-
TRouterContext extends
|
|
67
|
-
TChildren extends
|
|
68
|
-
|
|
109
|
+
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
110
|
+
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
111
|
+
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
69
112
|
>(
|
|
70
113
|
options: Omit<
|
|
71
114
|
RouteOptions<
|
|
72
115
|
TParentRoute,
|
|
73
|
-
|
|
74
|
-
|
|
116
|
+
string,
|
|
117
|
+
string,
|
|
75
118
|
TLoader,
|
|
76
119
|
InferFullSearchSchema<TParentRoute>,
|
|
77
120
|
TSearchSchema,
|
|
78
121
|
TFullSearchSchema,
|
|
79
|
-
TParentRoute['__types']['allParams'],
|
|
80
122
|
TParams,
|
|
81
123
|
TAllParams,
|
|
82
124
|
TParentContext,
|
|
@@ -98,7 +140,7 @@ export class FileRoute<
|
|
|
98
140
|
TParentRoute,
|
|
99
141
|
TPath,
|
|
100
142
|
TFullPath,
|
|
101
|
-
|
|
143
|
+
TFilePath,
|
|
102
144
|
TId,
|
|
103
145
|
TLoader,
|
|
104
146
|
TSearchSchema,
|
|
@@ -111,7 +153,7 @@ export class FileRoute<
|
|
|
111
153
|
TContext,
|
|
112
154
|
TRouterContext,
|
|
113
155
|
TChildren,
|
|
114
|
-
|
|
156
|
+
TRouteTree
|
|
115
157
|
> => {
|
|
116
158
|
const route = new Route(options as any)
|
|
117
159
|
;(route as any).isRoot = false
|
package/src/link.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Trim } from './fileRoute'
|
|
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'
|
|
3
11
|
import { NoInfer, PickRequired, UnionToIntersection, Updater } from './utils'
|
|
4
12
|
|
|
5
13
|
export type LinkInfo =
|
|
@@ -19,7 +27,7 @@ export type LinkInfo =
|
|
|
19
27
|
disabled?: boolean
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
type CleanPath<T extends string> = T extends `${infer L}//${infer R}`
|
|
30
|
+
export type CleanPath<T extends string> = T extends `${infer L}//${infer R}`
|
|
23
31
|
? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`>
|
|
24
32
|
: T extends `${infer L}//`
|
|
25
33
|
? `${CleanPath<L>}/`
|
|
@@ -49,11 +57,9 @@ export type Split<S, TIncludeTrailingSlash = true> = S extends unknown
|
|
|
49
57
|
: never
|
|
50
58
|
: never
|
|
51
59
|
|
|
52
|
-
export type ParsePathParams<T extends string> =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
: never
|
|
56
|
-
: never
|
|
60
|
+
export type ParsePathParams<T extends string> = keyof {
|
|
61
|
+
[K in Trim<Split<T>[number], '_'> as K extends `$${infer L}` ? L : never]: K
|
|
62
|
+
}
|
|
57
63
|
|
|
58
64
|
export type Join<T, Delimiter extends string = '/'> = T extends []
|
|
59
65
|
? ''
|
|
@@ -112,21 +118,21 @@ export type RelativeToPathAutoComplete<
|
|
|
112
118
|
| AllPaths
|
|
113
119
|
|
|
114
120
|
export type NavigateOptions<
|
|
115
|
-
|
|
116
|
-
TFrom extends
|
|
121
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
122
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
117
123
|
TTo extends string = '',
|
|
118
|
-
> = ToOptions<
|
|
124
|
+
> = ToOptions<TRouteTree, TFrom, TTo> & {
|
|
119
125
|
// `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.
|
|
120
126
|
replace?: boolean
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
export type ToOptions<
|
|
124
|
-
|
|
125
|
-
TFrom extends
|
|
130
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
131
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
126
132
|
TTo extends string = '',
|
|
127
133
|
TResolvedTo = ResolveRelativePath<TFrom, NoInfer<TTo>>,
|
|
128
134
|
> = {
|
|
129
|
-
to?: ToPathOption<
|
|
135
|
+
to?: ToPathOption<TRouteTree, TFrom, TTo>
|
|
130
136
|
// The new has string or a function to update it
|
|
131
137
|
hash?: Updater<string>
|
|
132
138
|
// State to pass to the history stack
|
|
@@ -135,37 +141,34 @@ export type ToOptions<
|
|
|
135
141
|
from?: TFrom
|
|
136
142
|
// // When using relative route paths, this option forces resolution from the current path, instead of the route API's path or `from` path
|
|
137
143
|
// fromCurrent?: boolean
|
|
138
|
-
} & CheckPath<
|
|
139
|
-
SearchParamOptions<
|
|
140
|
-
PathParamOptions<
|
|
144
|
+
} & CheckPath<TRouteTree, NoInfer<TResolvedTo>, {}> &
|
|
145
|
+
SearchParamOptions<TRouteTree, TFrom, TResolvedTo> &
|
|
146
|
+
PathParamOptions<TRouteTree, TFrom, TResolvedTo>
|
|
141
147
|
|
|
142
148
|
export type SearchParamOptions<
|
|
143
|
-
|
|
149
|
+
TRouteTree extends AnyRoute,
|
|
144
150
|
TFrom,
|
|
145
151
|
TTo,
|
|
146
152
|
TFromSchema = UnionToIntersection<
|
|
147
|
-
|
|
148
|
-
RouteByPath<TRoutesInfo, TFrom> extends never
|
|
153
|
+
FullSearchSchema<TRouteTree> & RouteByPath<TRouteTree, TFrom> extends never
|
|
149
154
|
? {}
|
|
150
|
-
: RouteByPath<
|
|
155
|
+
: RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']
|
|
151
156
|
>,
|
|
152
157
|
// Find the schema for the new path, and make optional any keys
|
|
153
158
|
// that are already defined in the current schema
|
|
154
159
|
TToSchema = Partial<
|
|
155
|
-
RouteByPath<
|
|
160
|
+
RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']
|
|
156
161
|
> &
|
|
157
162
|
Omit<
|
|
158
|
-
RouteByPath<
|
|
163
|
+
RouteByPath<TRouteTree, TTo>['__types']['fullSearchSchema'],
|
|
159
164
|
keyof PickRequired<
|
|
160
|
-
RouteByPath<
|
|
165
|
+
RouteByPath<TRouteTree, TFrom>['__types']['fullSearchSchema']
|
|
161
166
|
>
|
|
162
167
|
>,
|
|
163
168
|
TFromFullSchema = UnionToIntersection<
|
|
164
|
-
|
|
165
|
-
>,
|
|
166
|
-
TToFullSchema = UnionToIntersection<
|
|
167
|
-
TRoutesInfo['fullSearchSchema'] & TToSchema
|
|
169
|
+
FullSearchSchema<TRouteTree> & TFromSchema
|
|
168
170
|
>,
|
|
171
|
+
TToFullSchema = UnionToIntersection<FullSearchSchema<TRouteTree> & TToSchema>,
|
|
169
172
|
> = keyof PickRequired<TToSchema> extends never
|
|
170
173
|
? {
|
|
171
174
|
search?: true | SearchReducer<TFromFullSchema, TToFullSchema>
|
|
@@ -179,25 +182,23 @@ type SearchReducer<TFrom, TTo> =
|
|
|
179
182
|
| ((current: TFrom) => TTo)
|
|
180
183
|
|
|
181
184
|
export type PathParamOptions<
|
|
182
|
-
|
|
185
|
+
TRouteTree extends AnyRoute,
|
|
183
186
|
TFrom,
|
|
184
187
|
TTo,
|
|
185
188
|
TFromSchema = UnionToIntersection<
|
|
186
|
-
RouteByPath<
|
|
189
|
+
RouteByPath<TRouteTree, TFrom> extends never
|
|
187
190
|
? {}
|
|
188
|
-
: RouteByPath<
|
|
191
|
+
: RouteByPath<TRouteTree, TFrom>['__types']['allParams']
|
|
189
192
|
>,
|
|
190
193
|
// Find the schema for the new path, and make optional any keys
|
|
191
194
|
// that are already defined in the current schema
|
|
192
|
-
TToSchema = Partial<RouteByPath<
|
|
195
|
+
TToSchema = Partial<RouteByPath<TRouteTree, TFrom>['__types']['allParams']> &
|
|
193
196
|
Omit<
|
|
194
|
-
RouteByPath<
|
|
195
|
-
keyof PickRequired<
|
|
196
|
-
RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']
|
|
197
|
-
>
|
|
197
|
+
RouteByPath<TRouteTree, TTo>['__types']['allParams'],
|
|
198
|
+
keyof PickRequired<RouteByPath<TRouteTree, TFrom>['__types']['allParams']>
|
|
198
199
|
>,
|
|
199
|
-
TFromFullParams = UnionToIntersection<
|
|
200
|
-
TToFullParams = UnionToIntersection<
|
|
200
|
+
TFromFullParams = UnionToIntersection<AllParams<TRouteTree> & TFromSchema>,
|
|
201
|
+
TToFullParams = UnionToIntersection<AllParams<TRouteTree> & TToSchema>,
|
|
201
202
|
> = keyof PickRequired<TToSchema> extends never
|
|
202
203
|
? {
|
|
203
204
|
params?: ParamsReducer<TFromFullParams, TToFullParams>
|
|
@@ -209,25 +210,25 @@ export type PathParamOptions<
|
|
|
209
210
|
type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo)
|
|
210
211
|
|
|
211
212
|
export type ToPathOption<
|
|
212
|
-
|
|
213
|
-
TFrom extends
|
|
213
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
214
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
214
215
|
TTo extends string = '',
|
|
215
216
|
> =
|
|
216
217
|
| TTo
|
|
217
218
|
| RelativeToPathAutoComplete<
|
|
218
|
-
|
|
219
|
+
RoutePaths<TRouteTree>,
|
|
219
220
|
NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',
|
|
220
221
|
NoInfer<TTo> & string
|
|
221
222
|
>
|
|
222
223
|
|
|
223
224
|
export type ToIdOption<
|
|
224
|
-
|
|
225
|
-
TFrom extends
|
|
225
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
226
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
226
227
|
TTo extends string = '',
|
|
227
228
|
> =
|
|
228
229
|
| TTo
|
|
229
230
|
| RelativeToPathAutoComplete<
|
|
230
|
-
|
|
231
|
+
RouteIds<TRouteTree>,
|
|
231
232
|
NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',
|
|
232
233
|
NoInfer<TTo> & string
|
|
233
234
|
>
|
|
@@ -239,10 +240,10 @@ export interface ActiveOptions {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
export type LinkOptions<
|
|
242
|
-
|
|
243
|
-
TFrom extends
|
|
243
|
+
TRouteTree extends AnyRoute = AnyRoute,
|
|
244
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
244
245
|
TTo extends string = '',
|
|
245
|
-
> = NavigateOptions<
|
|
246
|
+
> = NavigateOptions<TRouteTree, TFrom, TTo> & {
|
|
246
247
|
// The standard anchor tag target attribute
|
|
247
248
|
target?: HTMLAnchorElement['target']
|
|
248
249
|
// Defaults to `{ exact: false, includeHash: false }`
|
|
@@ -256,47 +257,46 @@ export type LinkOptions<
|
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
export type CheckRelativePath<
|
|
259
|
-
|
|
260
|
+
TRouteTree extends AnyRoute,
|
|
260
261
|
TFrom,
|
|
261
262
|
TTo,
|
|
262
263
|
> = TTo extends string
|
|
263
264
|
? TFrom extends string
|
|
264
|
-
? ResolveRelativePath<TFrom, TTo> extends
|
|
265
|
+
? ResolveRelativePath<TFrom, TTo> extends RoutePaths<TRouteTree>
|
|
265
266
|
? {}
|
|
266
267
|
: {
|
|
267
268
|
Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<
|
|
268
269
|
TFrom,
|
|
269
270
|
TTo
|
|
270
271
|
>}, which is not a valid route path.`
|
|
271
|
-
'Valid Route Paths':
|
|
272
|
+
'Valid Route Paths': RoutePaths<TRouteTree>
|
|
272
273
|
}
|
|
273
274
|
: {}
|
|
274
275
|
: {}
|
|
275
276
|
|
|
276
|
-
export type CheckPath<
|
|
277
|
-
TRoutesInfo extends AnyRoutesInfo,
|
|
277
|
+
export type CheckPath<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<
|
|
278
278
|
TPath,
|
|
279
|
-
|
|
280
|
-
>
|
|
279
|
+
RoutePaths<TRouteTree>
|
|
280
|
+
> extends never
|
|
281
281
|
? TPass
|
|
282
|
-
: CheckPathError<
|
|
282
|
+
: CheckPathError<TRouteTree, Exclude<TPath, RoutePaths<TRouteTree>>>
|
|
283
283
|
|
|
284
|
-
export type CheckPathError<
|
|
285
|
-
to:
|
|
284
|
+
export type CheckPathError<TRouteTree extends AnyRoute, TInvalids> = {
|
|
285
|
+
to: RoutePaths<TRouteTree>
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
export type CheckId<
|
|
288
|
+
export type CheckId<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<
|
|
289
289
|
TPath,
|
|
290
|
-
|
|
290
|
+
RouteIds<TRouteTree>
|
|
291
291
|
> extends never
|
|
292
292
|
? TPass
|
|
293
|
-
: CheckIdError<
|
|
293
|
+
: CheckIdError<TRouteTree, Exclude<TPath, RouteIds<TRouteTree>>>
|
|
294
294
|
|
|
295
|
-
export type CheckIdError<
|
|
295
|
+
export type CheckIdError<TRouteTree extends AnyRoute, TInvalids> = {
|
|
296
296
|
Error: `${TInvalids extends string
|
|
297
297
|
? TInvalids
|
|
298
298
|
: never} is not a valid route ID.`
|
|
299
|
-
'Valid Route IDs':
|
|
299
|
+
'Valid Route IDs': RouteIds<TRouteTree>
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
export type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string
|