Closed trevoro closed 2 years ago
Hey @trevoro thanks for opening this. I held off from implementing this, hoping to get https://github.com/vercel/next.js/issues/35791 addressed in Next.js. That seems unlikely to happen, so I'm happy to widen the query types.
Roughly, making the query type something like this for your example:
interface Query {
id: string;
[key: string]: string
}
will enforce the required key (id
), but allow arbitrary extra keys for query params.
Hi,
We're using this library and it's great for mapping the slug parts of a path to their required values or query parameters. However we also using actual query string values for certain items and it appears as though that isn't possible here without the types throwing an error.
Any recommended way to do something like this?
To me it would be nice to change the
query
value toparams
and then just let people merge in their own query parameters in an un-type-safe kind of way. Otherwise people are prevented from making use of some pretty important browser functionality.