-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Repair catch-all route params couldn't be mixed with other params #25
Conversation
@@ -22,9 +22,9 @@ type Suffix = `?${string}`; | |||
type SafePath<Path extends string> = string extends Route ? Path : Route<Path>; | |||
|
|||
type ExtractPathParams<T extends string> = | |||
T extends `${string}[[...${infer Param}]]${infer Rest}` ? | |||
T extends `${infer Rest}[[...${infer Param}]]` ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catch-all params are supposed to be the last one, so we 'parse' them from right to left.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @Katona
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @Katona!
Can you generate a changeset using bun changeset
with a patch version for it?
@@ -22,9 +22,9 @@ type Suffix = `?${string}`; | |||
type SafePath<Path extends string> = string extends Route ? Path : Route<Path>; | |||
|
|||
type ExtractPathParams<T extends string> = | |||
T extends `${string}[[...${infer Param}]]${infer Rest}` ? | |||
T extends `${infer Rest}[[...${infer Param}]]` ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @Katona
@lukemorales I have added the changeset. I have never used it before, let me know if I have missed something. |
That looks good! Also, it looks like CI is failing on the linting step, could you fix that? Then we're good to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great contribution! Thanks for the PR @Katona
This PR fixes the issue of
catch_all
route params can't be mixed with others, like: