Open osdiab opened 3 years ago
It's been awhile since I worked on the library, so forgive me if I'm not remembering correctly here...
But I believe I chose the path
as you can have both params
and path
. E.g.:
getRoute({
route: "/nested-catch-all/[dynamic]/slugs",
params: { dynamic: 1 },
path: "/a/b/c",
})
More details here: https://github.com/ckastbjerg/next-type-safe-routes/pull/13
Or are you arguing that they should be treated the same?
But yes, if the API surfaces was limited/the implementation changed, it might not matter I guess
Yes, just saying it would be more consistent if they were treated the same.
This is irrelevant if we go with #21 , but right now the
getRoute
function refers to the catch-all part of a route to bepath
, ignoring the name in the actual route. For instance,/foo/[...bar].ts
would be populated withgetRoute({route: '/foo/[...bar].ts', path: 'baz'})
instead ofgetRoute({route: '/foo/[...bar].ts', params: {bar: 'baz'}})
.I found it counterintuitive that while NextJS refers to those catch-all params as params, this library doesn't.