Repository navigation
Conversation
|
In hindsight, I feel like we should have shipped with typed routes from the start. I'm not actually sure I love this implementation of passing objects around – it's probably fine because AI writes it, but since Void manages the route map, I'm wondering if we could type these as "Route" which is a set of strings like |
Possibly, but never too late! FWIW Next.js took more than 5 years to add typed routes.
I understand. Personally I prefer the objects way. Actually we can support both objects and route union ways, we could add a flag to the Void plugin config to generate the route unions instead of strings. Next.js does this. I'll leave the decision to you as to which combination to allow:
My recommendation would be untyped + objects + opt-in route unions. |
4d53fb1 to
68bd297
Compare
Allow typed route destination objects in
router.visit(),router.prefetch(),router.flush(), andc.rewrite(). Known route patterns autocomplete and dynamic routes require matching path parameters, while existing string and supportedURLinputs continue to work.Export
RouteDestinationandRouteUrlInputfromvoid/routesand serialize destinations through the same builder asrouteUrl().c.redirect()retains Hono's string/URL signature; typed redirects usec.redirect(routeUrl(...)).Coverage includes generated and package declarations, redirect/rewrite behavior, and client navigation/cache behavior across the four adapters.
Validation with the dependent Link commit applied:
vp run check: 33/33 tasks passed.vp test run: 15,379 passed, 31 skipped.