@tanstack/react-router 1.39.6 → 1.39.8
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/RouterProvider.cjs.map +1 -1
- package/dist/cjs/RouterProvider.d.cts +1 -1
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +6 -6
- package/dist/cjs/path.cjs +12 -3
- package/dist/cjs/path.cjs.map +1 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +38 -29
- package/dist/cjs/router.cjs +0 -7
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +7 -6
- package/dist/esm/RouterProvider.d.ts +1 -1
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +6 -6
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/path.js +12 -3
- package/dist/esm/path.js.map +1 -1
- package/dist/esm/route.d.ts +38 -29
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +7 -6
- package/dist/esm/router.js +0 -7
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/RouterProvider.tsx +5 -10
- package/src/fileRoute.ts +2 -7
- package/src/path.ts +15 -3
- package/src/route.ts +41 -70
- package/src/router.ts +21 -15
package/dist/cjs/route.d.cts
CHANGED
|
@@ -33,16 +33,16 @@ export type RoutePathOptionsIntersection<TCustomId, TPath> = {
|
|
|
33
33
|
path: TPath;
|
|
34
34
|
id: TCustomId;
|
|
35
35
|
};
|
|
36
|
-
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = AnyPathParams, TAllParams = TParams, TRouteContextReturn = RouteContext, TRouteContext = RouteContext,
|
|
36
|
+
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = AnyPathParams, TAllParams = TParams, TRouteContextReturn = RouteContext, TRouteContext = RouteContext, TParentAllContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TParentAllContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & UpdatableRouteOptions<NoInfer<TCustomId>, NoInfer<TAllParams>, NoInfer<TFullSearchSchema>, NoInfer<TLoaderData>, NoInfer<TAllContext>, NoInfer<TRouteContext>, NoInfer<TLoaderDeps>>;
|
|
37
37
|
export type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
|
|
38
|
-
export type FileBaseRouteOptions<
|
|
38
|
+
export type FileBaseRouteOptions<TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn = RouteContext, TParentAllContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}> = {
|
|
39
39
|
validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>;
|
|
40
|
-
shouldReload?: boolean | ((match: LoaderFnContext<TAllParams, TFullSearchSchema, TAllContext
|
|
41
|
-
beforeLoad?: BeforeLoadFn<TFullSearchSchema,
|
|
40
|
+
shouldReload?: boolean | ((match: LoaderFnContext<TAllParams, TFullSearchSchema, TAllContext>) => any);
|
|
41
|
+
beforeLoad?: BeforeLoadFn<TFullSearchSchema, TAllParams, TRouteContextReturn, TParentAllContext>;
|
|
42
42
|
loaderDeps?: (opts: {
|
|
43
43
|
search: TFullSearchSchema;
|
|
44
44
|
}) => TLoaderDeps;
|
|
45
|
-
loader?: RouteLoaderFn<TAllParams, NoInfer<TLoaderDeps>, NoInfer<TAllContext>,
|
|
45
|
+
loader?: RouteLoaderFn<TAllParams, NoInfer<TLoaderDeps>, NoInfer<TAllContext>, TLoaderDataReturn>;
|
|
46
46
|
} & ({
|
|
47
47
|
parseParams?: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams extends Record<ParsePathParams<TPath>, any> ? TParams : 'parseParams must return an object';
|
|
48
48
|
stringifyParams?: (params: NoInfer<ParamsFallback<TPath, TParams>>) => Record<ParsePathParams<TPath>, string>;
|
|
@@ -50,21 +50,21 @@ export type FileBaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TPath
|
|
|
50
50
|
stringifyParams?: never;
|
|
51
51
|
parseParams?: never;
|
|
52
52
|
});
|
|
53
|
-
export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn = RouteContext,
|
|
53
|
+
export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TFullSearchSchema = TSearchSchema, TParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn = RouteContext, TParentAllContext = AnyContext, TAllContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TParentAllContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & {
|
|
54
54
|
getParentRoute: () => TParentRoute;
|
|
55
55
|
};
|
|
56
|
-
type BeforeLoadFn<in out TFullSearchSchema, in out
|
|
56
|
+
type BeforeLoadFn<in out TFullSearchSchema, in out TAllParams, TRouteContextReturn, in out TParentAllContext> = (opts: {
|
|
57
57
|
search: TFullSearchSchema;
|
|
58
58
|
abortController: AbortController;
|
|
59
59
|
preload: boolean;
|
|
60
60
|
params: TAllParams;
|
|
61
|
-
context:
|
|
61
|
+
context: TParentAllContext;
|
|
62
62
|
location: ParsedLocation;
|
|
63
63
|
/**
|
|
64
64
|
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
65
65
|
**/
|
|
66
66
|
navigate: NavigateFn;
|
|
67
|
-
buildLocation: BuildLocationFn
|
|
67
|
+
buildLocation: BuildLocationFn;
|
|
68
68
|
cause: 'preload' | 'enter' | 'stay';
|
|
69
69
|
}) => Promise<TRouteContextReturn> | TRouteContextReturn | void;
|
|
70
70
|
export type UpdatableRouteOptions<TRouteId, TAllParams, TFullSearchSchema, TLoaderData, TAllContext, TRouteContext, TLoaderDeps, TRouteMatch = RouteMatch<TRouteId, TAllParams, TFullSearchSchema, TLoaderData, TAllContext, TRouteContext, TLoaderDeps>> = {
|
|
@@ -141,13 +141,13 @@ export type SearchSchemaValidatorObj<TInput, TReturn> = {
|
|
|
141
141
|
parse?: SearchSchemaValidatorFn<TInput, TReturn>;
|
|
142
142
|
};
|
|
143
143
|
export type SearchSchemaValidatorFn<TInput, TReturn> = (searchObj: TInput) => TReturn;
|
|
144
|
-
export type RouteLoaderFn<in out TAllParams = {}, in out TLoaderDeps extends Record<string, any> = {}, in out TAllContext = AnyContext,
|
|
145
|
-
export interface LoaderFnContext<in out TAllParams = {}, in out TLoaderDeps = {}, in out TAllContext = AnyContext
|
|
144
|
+
export type RouteLoaderFn<in out TAllParams = {}, in out TLoaderDeps extends Record<string, any> = {}, in out TAllContext = AnyContext, TLoaderData = undefined> = (match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext>) => Promise<TLoaderData> | TLoaderData;
|
|
145
|
+
export interface LoaderFnContext<in out TAllParams = {}, in out TLoaderDeps = {}, in out TAllContext = AnyContext> {
|
|
146
146
|
abortController: AbortController;
|
|
147
147
|
preload: boolean;
|
|
148
148
|
params: TAllParams;
|
|
149
149
|
deps: TLoaderDeps;
|
|
150
|
-
context:
|
|
150
|
+
context: TAllContext;
|
|
151
151
|
location: ParsedLocation;
|
|
152
152
|
/**
|
|
153
153
|
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
@@ -171,19 +171,29 @@ export type InferFullSearchSchemaInput<TRoute> = TRoute extends {
|
|
|
171
171
|
fullSearchSchemaInput: infer TFullSearchSchemaInput;
|
|
172
172
|
};
|
|
173
173
|
} ? TFullSearchSchemaInput : {};
|
|
174
|
+
export type InferAllParams<TRoute> = TRoute extends {
|
|
175
|
+
types: {
|
|
176
|
+
allParams: infer TAllParams;
|
|
177
|
+
};
|
|
178
|
+
} ? TAllParams : {};
|
|
179
|
+
export type InferAllContext<TRoute> = TRoute extends {
|
|
180
|
+
types: {
|
|
181
|
+
allContext: infer TAllContext;
|
|
182
|
+
};
|
|
183
|
+
} ? TAllContext : {};
|
|
174
184
|
export type ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : TSearchSchema;
|
|
175
|
-
export type ResolveFullSearchSchema<TParentRoute extends AnyRoute, TSearchSchema> =
|
|
176
|
-
export type ResolveFullSearchSchemaInput<TParentRoute extends AnyRoute, TSearchSchemaUsed> =
|
|
185
|
+
export type ResolveFullSearchSchema<TParentRoute extends AnyRoute, TSearchSchema> = Assign<InferFullSearchSchema<TParentRoute>, TSearchSchema>;
|
|
186
|
+
export type ResolveFullSearchSchemaInput<TParentRoute extends AnyRoute, TSearchSchemaUsed> = Assign<InferFullSearchSchemaInput<TParentRoute>, TSearchSchemaUsed>;
|
|
177
187
|
export type ResolveRouteContext<TRouteContextReturn> = [
|
|
178
188
|
TRouteContextReturn
|
|
179
189
|
] extends [never] ? RouteContext : TRouteContextReturn;
|
|
180
|
-
export type ResolveAllContext<TParentRoute extends AnyRoute, TRouteContext> = Assign<
|
|
190
|
+
export type ResolveAllContext<TParentRoute extends AnyRoute, TRouteContext> = Assign<InferAllContext<TParentRoute>, TRouteContext>;
|
|
181
191
|
export type ResolveLoaderData<TLoaderDataReturn> = [TLoaderDataReturn] extends [
|
|
182
192
|
never
|
|
183
193
|
] ? undefined : TLoaderDataReturn;
|
|
184
|
-
export interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any
|
|
194
|
+
export interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
185
195
|
}
|
|
186
|
-
export type ResolveAllParamsFromParent<TParentRoute extends AnyRoute, TParams> =
|
|
196
|
+
export type ResolveAllParamsFromParent<TParentRoute extends AnyRoute, TParams> = Assign<InferAllParams<TParentRoute>, TParams>;
|
|
187
197
|
export type RouteConstraints = {
|
|
188
198
|
TParentRoute: AnyRoute;
|
|
189
199
|
TPath: string;
|
|
@@ -231,9 +241,9 @@ export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']
|
|
|
231
241
|
useNavigate: () => UseNavigateResult<TRoute['fullPath']>;
|
|
232
242
|
notFound: (opts?: NotFoundError) => NotFoundError;
|
|
233
243
|
}
|
|
234
|
-
export declare class Route<in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchSchemaInput = Record<string, unknown>, in out TSearchSchema = {}, in out TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, in out TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, in out TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, in out TParams = Record<ParsePathParams<TPath>, string>, in out TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, in out TRouteContext = ResolveRouteContext<TRouteContextReturn>, in out TAllContext =
|
|
244
|
+
export declare class Route<in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchSchemaInput = Record<string, unknown>, in out TSearchSchema = {}, in out TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, in out TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, in out TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, in out TParams = Record<ParsePathParams<TPath>, string>, in out TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, in out TRouteContext = ResolveRouteContext<TRouteContextReturn>, in out TAllContext = ResolveAllContext<TParentRoute, TRouteContext>, in out TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, in out TLoaderData = ResolveLoaderData<TLoaderDataReturn>, in out TChildren = unknown> {
|
|
235
245
|
isRoot: TParentRoute extends Route<any> ? true : false;
|
|
236
|
-
options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext,
|
|
246
|
+
options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, InferAllContext<TParentRoute>, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>;
|
|
237
247
|
parentRoute: TParentRoute;
|
|
238
248
|
id: TId;
|
|
239
249
|
path: TPath;
|
|
@@ -247,7 +257,7 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
|
|
|
247
257
|
/**
|
|
248
258
|
* @deprecated Use the `createRoute` function instead.
|
|
249
259
|
*/
|
|
250
|
-
constructor(options?: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext,
|
|
260
|
+
constructor(options?: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, InferAllContext<TParentRoute>, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>);
|
|
251
261
|
types: {
|
|
252
262
|
parentRoute: TParentRoute;
|
|
253
263
|
path: TPath;
|
|
@@ -265,17 +275,16 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
|
|
|
265
275
|
routeContext: TRouteContext;
|
|
266
276
|
allContext: TAllContext;
|
|
267
277
|
children: TChildren;
|
|
268
|
-
routerContext: TRouterContext;
|
|
269
278
|
loaderData: TLoaderData;
|
|
270
279
|
loaderDeps: TLoaderDeps;
|
|
271
280
|
};
|
|
272
281
|
init: (opts: {
|
|
273
282
|
originalIndex: number;
|
|
274
283
|
}) => void;
|
|
275
|
-
addChildren: <const TNewChildren extends Record<string, AnyRoute> | readonly AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext,
|
|
284
|
+
addChildren: <const TNewChildren extends Record<string, AnyRoute> | readonly AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TNewChildren>;
|
|
276
285
|
updateLoader: <TNewLoaderData = unknown>(options: {
|
|
277
|
-
loader: RouteLoaderFn<TAllParams, TLoaderDeps, TAllContext,
|
|
278
|
-
}) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext,
|
|
286
|
+
loader: RouteLoaderFn<TAllParams, TLoaderDeps, TAllContext, TNewLoaderData>;
|
|
287
|
+
}) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TLoaderDeps, TNewLoaderData, TChildren, unknown>;
|
|
279
288
|
update: (options: UpdatableRouteOptions<TCustomId, TAllParams, TFullSearchSchema, TLoaderData, TAllContext, TRouteContext, TLoaderDeps>) => this;
|
|
280
289
|
lazy: (lazyFn: () => Promise<LazyRoute<any>>) => this;
|
|
281
290
|
useMatch: <TRouter extends AnyRouter = AnyRouter, TRouteTree extends AnyRoute = TRouter["routeTree"], TRouteMatch = MakeRouteMatch<TRouteTree, TId>, TSelected = TRouteMatch>(opts?: {
|
|
@@ -298,7 +307,7 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
|
|
|
298
307
|
}) => TSelected;
|
|
299
308
|
useNavigate: () => UseNavigateResult<string>;
|
|
300
309
|
}
|
|
301
|
-
export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams = Record<ParsePathParams<TPath>, string>, TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TAllContext =
|
|
310
|
+
export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams = Record<ParsePathParams<TPath>, string>, TAllParams = ResolveAllParamsFromParent<TParentRoute, TParams>, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TAllContext = ResolveAllContext<TParentRoute, TRouteContext>, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, TChildren = unknown>(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, InferAllContext<TParentRoute>, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren>;
|
|
302
311
|
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
|
|
303
312
|
export type RootRouteOptions<TSearchSchemaInput = {}, TSearchSchema = {}, TRouteContextReturn = RouteContext, TRouteContext = ResolveRouteContext<TRouteContextReturn>, TRouterContext = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>> = Omit<RouteOptions<any, // TParentRoute
|
|
304
313
|
RootRouteId, // TCustomId
|
|
@@ -310,7 +319,8 @@ TSearchSchema, // TFullSearchSchema
|
|
|
310
319
|
{}, // TAllParams
|
|
311
320
|
TRouteContextReturn, // TRouteContextReturn
|
|
312
321
|
TRouteContext, // TRouteContext
|
|
313
|
-
TRouterContext,
|
|
322
|
+
TRouterContext, // TParentAllContext
|
|
323
|
+
Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
314
324
|
TLoaderDeps, TLoaderDataReturn, // TLoaderDataReturn,
|
|
315
325
|
TLoaderData>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>;
|
|
316
326
|
export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TSearchSchemaInput = {}, TSearchSchema = {}, TSearchSchemaUsed = ResolveSearchSchemaUsed<TSearchSchemaInput, TSearchSchema>, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = ResolveRouteContext<TRouteContextReturn>, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>>(options?: RootRouteOptions<TSearchSchemaInput, TSearchSchema, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>) => RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderData, ResolveLoaderData<TLoaderData>>;
|
|
@@ -332,7 +342,6 @@ TSearchSchema, // TFullSearchSchema
|
|
|
332
342
|
TRouteContextReturn, // TRouteContextReturn
|
|
333
343
|
TRouteContext, // TRouteContext
|
|
334
344
|
Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
335
|
-
TRouterContext, // TRouterContext
|
|
336
345
|
TLoaderDeps, TLoaderDataReturn, TLoaderData, any> {
|
|
337
346
|
/**
|
|
338
347
|
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
@@ -396,7 +405,7 @@ export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
|
|
396
405
|
export type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>;
|
|
397
406
|
export type ErrorRouteComponent = RouteComponent<ErrorComponentProps>;
|
|
398
407
|
export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>;
|
|
399
|
-
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = {}, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContextReturn = AnyContext, TRouteContext = RouteContext, TAllContext = ResolveAllContext<TParentRoute, TRouteContext>,
|
|
400
|
-
constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext,
|
|
408
|
+
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchemaInput = Record<string, unknown>, TSearchSchema = {}, TSearchSchemaUsed = {}, TFullSearchSchemaInput = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContextReturn = AnyContext, TRouteContext = RouteContext, TAllContext = ResolveAllContext<TParentRoute, TRouteContext>, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn = {}, TLoaderData = ResolveLoaderData<TLoaderDataReturn>, TChildren = unknown> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren> {
|
|
409
|
+
constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, InferAllContext<TParentRoute>, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'>);
|
|
401
410
|
}
|
|
402
411
|
export {};
|
package/dist/cjs/router.cjs
CHANGED
|
@@ -432,13 +432,6 @@ class Router {
|
|
|
432
432
|
nextParams = { ...nextParams, ...fn(nextParams) };
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
Object.keys(nextParams).forEach((key) => {
|
|
436
|
-
if (["*", "_splat"].includes(key)) {
|
|
437
|
-
nextParams[key] = encodeURI(nextParams[key]);
|
|
438
|
-
} else {
|
|
439
|
-
nextParams[key] = encodeURIComponent(nextParams[key]);
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
435
|
pathname = path.interpolatePath({
|
|
443
436
|
path: pathname,
|
|
444
437
|
params: nextParams ?? {},
|