Skip to content

Commit 86864b4

Browse files
committed
types: generic route record info
1 parent 04c6f1a commit 86864b4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

packages/router/__tests__/routeLocation.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type RouteNamedMap = {
2626
{ gid: ParamValue<true> },
2727
{ gid: ParamValue<false> },
2828
RouteMeta,
29-
'/groups/[gid]/users'
29+
'/groups/[gid]/users' | '/groups/[gid]/users/[uid]'
3030
>
3131
'/groups/[gid]/users': RouteRecordInfo<
3232
'/groups/[gid]/users',

packages/router/src/typed-routes/route-map.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface RouteRecordInfo<
1818
ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric,
1919
Params extends RouteParamsGeneric = RouteParamsGeneric,
2020
Meta extends RouteMeta = RouteMeta,
21-
ChildrenNames extends string | symbol | never = never | string | symbol,
21+
ChildrenNames extends string | symbol = never,
2222
> {
2323
name: Name
2424
path: Path
@@ -29,6 +29,15 @@ export interface RouteRecordInfo<
2929
childrenNames: ChildrenNames
3030
}
3131

32+
export type RouteRecordInfoGeneric = RouteRecordInfo<
33+
string | symbol,
34+
string,
35+
RouteParamsRawGeneric,
36+
RouteParamsGeneric,
37+
RouteMeta,
38+
string | symbol
39+
>
40+
3241
/**
3342
* Convenience type to get the typed RouteMap or a generic one if not provided. It is extracted from the {@link TypesConfig} if it exists, it becomes {@link RouteMapGeneric} otherwise.
3443
*/
@@ -40,4 +49,4 @@ export type RouteMap =
4049
/**
4150
* Generic version of the `RouteMap`.
4251
*/
43-
export type RouteMapGeneric = Record<string | symbol, RouteRecordInfo>
52+
export type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>

0 commit comments

Comments
 (0)