@@ -164,11 +164,13 @@ export interface DataRouteObject extends RouteObject {
164
164
// Recursive helper for finding path parameters in the absence of wildcards
165
165
type _PathParam < Path extends string > =
166
166
// split path into individual path segments
167
- Path extends `${infer L } /${infer R } ` ? _PathParam < L > | _PathParam < R > :
168
- // find params after `:`
169
- Path extends `${string } :${infer Param } ` ? Param :
170
- // otherwise, there aren't any params present
171
- never
167
+ Path extends `${infer L } /${infer R } `
168
+ ? _PathParam < L > | _PathParam < R >
169
+ : // find params after `:`
170
+ Path extends `${string } :${infer Param } `
171
+ ? Param
172
+ : // otherwise, there aren't any params present
173
+ never ;
172
174
173
175
/**
174
176
* Examples:
@@ -181,19 +183,20 @@ type _PathParam<Path extends string> =
181
183
*/
182
184
type PathParam < Path extends string > =
183
185
// check if path is just a wildcard
184
- Path extends "*" ? "*" :
185
- // look for wildcard at the end of the path
186
- Path extends `${infer Rest } /*` ? "*" | _PathParam < Rest > :
187
- // look for params in the absence of wildcards
188
- _PathParam < Path >
186
+ Path extends "*"
187
+ ? "*"
188
+ : // look for wildcard at the end of the path
189
+ Path extends `${infer Rest } /*`
190
+ ? "*" | _PathParam < Rest >
191
+ : // look for params in the absence of wildcards
192
+ _PathParam < Path > ;
189
193
190
194
// Attempt to parse the given string segment. If it fails, then just return the
191
195
// plain string type as a default fallback. Otherwise return the union of the
192
196
// parsed string literals that were referenced as dynamic segments in the route.
193
197
export type ParamParseKey < Segment extends string > =
194
198
// if could not find path params, fallback to `string`
195
- [ PathParam < Segment > ] extends [ never ] ? string :
196
- PathParam < Segment >
199
+ [ PathParam < Segment > ] extends [ never ] ? string : PathParam < Segment > ;
197
200
198
201
/**
199
202
* The parameters that were parsed from the URL path.
0 commit comments