ethanniser / next-typesafe-url

Fully typesafe, JSON serializable, and zod validated URL search params, dynamic route params, and routing for NextJS.
https://next-typesafe-url.dev
MIT License
362 stars 16 forks source link

Support for higher order function wrapping Next's generateMetadata() #92

Open adamkangas opened 5 months ago

adamkangas commented 5 months ago

Hi there,

This library is great for wrapping my app dir components in withParamValidation – but there's no similar higher order function for getting type safety in Next's generateMetadata exports which can rely on route params.

https://nextjs.org/docs/app/api-reference/functions/generate-metadata

This seems relatively straightforward to implement by abstracting out some of the logic in withParamValidation to a common function.

Is this something that's been considered, and if it's a decent idea would you be open to implementing it or accepting a PR? Thanks!

ethanniser commented 5 months ago

check out the generateMetadata branch :) it needs a bit more work but im a bit busy rn hopefully ill get to it this weekend