Type safe routes and params #387
chrisdrackett
started this conversation in
General
Replies: 1 comment 1 reply
-
hey! so i currently achieve this with pathpida. i make the routes in next.js pages folder, export a maybe i can put together some snippets at some point |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm excited to find this library as we've been doing this internally for a couple years and now with a couple small code changes I won't have to maintain it by myself anymore 😓 😉
One question I have is around making the use of routes and params type safe and if this project has any suggestions about ways to do this.
At the moment we handle this by defining the types for our routes and params by hand and then using this with custom components/hooks that can then validate if a route exists and if it has the correct number and type of param. Obviously this isn't very dry as it requires an update to both the types and the file structure if a route changes. This generally works out, especially as a project ships as we don't generally ever want to touch an existing href that is live, but I still thought it was worth asking if there is a recommended pattern for this in Solito.
Beta Was this translation helpful? Give feedback.
All reactions