ckastbjerg / next-type-safe-routes

Never should your users experience broken links again!
MIT License
70 stars 5 forks source link

configuration should allow custom destination for generated types. #32

Open airtonix opened 2 years ago

airtonix commented 2 years ago

https://github.com/ckastbjerg/next-type-safe-routes/blob/e181640ec23c4eefad0b94e776c983a630281ab8/src/plugin/index.ts#L37

in our nextjs projects we write out other generated typescript .d.ts files for our gql schema under

apps/
  appname/
    __generated__/
     ts-gql/
       .*
    src/
      pages/
      components/
      services/
      etc/
      etc/
      etc/

we'd like to put our route types:

apps/
  appname/
    __generated__/
     next-type-safe-routes/
       .*
     ts-gql/
       .*
    src/
      pages/
      components/
      services/
      etc/
      etc/
      etc/
osdiab commented 2 years ago

I have another reason this is a good idea - I would love to be able to reference valid paths from another project that has redirects/API access to my NextJS project, and I use a monorepo structure - so it would be super cool if the definitions could even be sent outside the project to such a subpackage, so that I can use the getRoute() helper fully outside of NextJS (rather than needing to have all of the NextJS project as a dependency).