Skip to content

Commit e6f0f64

Browse files
committed
feat: add comment
1 parent a786f8a commit e6f0f64

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/router/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,19 @@ type Star = "*"
170170
type PathParam<
171171
Path extends string
172172
> =
173+
// Check path string starts with slash and a param string.
173174
Path extends `:${infer Param}/${infer Rest}`
174175
? Param | PathParam<Rest>
176+
// Check path string is a param string.
175177
: Path extends `:${infer Param}`
176178
? Param
177-
: Path extends `${any}:${infer Param}`
179+
// Check path string ends with slash and a param string.
180+
: Path extends `${any}/:${infer Param}`
178181
? PathParam<`:${Param}`>
182+
// Check path string ends with slash and a star.
179183
: Path extends `${any}/${Star}`
180184
? Star
185+
// Check string is star.
181186
: Path extends Star
182187
? Star
183188
: never

0 commit comments

Comments
 (0)