Skip to content
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

Parsing of the path on the type-level #15

Open
Tracked by #31
sergeysova opened this issue May 14, 2022 · 1 comment
Open
Tracked by #31

Parsing of the path on the type-level #15

sergeysova opened this issue May 14, 2022 · 1 comment
Labels
enhancement Improvement of existing functionality
Milestone

Comments

@sergeysova
Copy link
Member

sergeysova commented May 14, 2022

Allow to type check path params with Route<T>:

const routes = [{
  path: '/foo/:fooId/bar/:barId',
  route: createRoute<{ fooId: string; barId: string }>(),
}]
// There should be a type error if some parameters are not provided inside `createRoute`.

https://tsplay.dev/m3ykbw

@sergeysova sergeysova added the documentation Improvements or additions to documentation label May 14, 2022
@sergeysova sergeysova changed the title Sample how to parse paths Parsing of the path on the type-level Aug 15, 2022
@sergeysova sergeysova added enhancement Improvement of existing functionality and removed documentation Improvements or additions to documentation labels Aug 15, 2022
@sergeysova sergeysova added this to the v1 milestone Aug 15, 2022
@Kelin2025
Copy link
Collaborator

Kelin2025 commented Aug 15, 2022

We need to support:

  • /foo/:id - /foo/1
  • /foo/:id+ - /foo/1, /foo/1/2
  • /foo/:id* - /foo, /foo/1, /foo/1/2
  • /foo/:id{2,3} - /foo/1/2, /foo/1/2/3
  • /foo/:id(\\d+) - /foo/1, but not /foo/test

as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants