Next.js Discord

Discord Forum

How do you ensure e2e type safety

Unanswered
Greek Shepherd posted this in #help-forum
Open in Discord
Avatar
Greek ShepherdOP
I recently decided to convert my projects to typescript. Working on the express api's now and im wondering how i can get type safety between nextjs and express?
Im using a monorepo approach with turborepo so i was thinking about making a shared-types package and just importing the types in all endpoints but then i'd have to make a type for each route than doesnt return a default response.
I also know about trpc but learning it, configuring it and implementing it seems like a lot but i could be wrong, i havent done that much research into trpc, i just know it will take a good amount of refactoring my existing endpoints.
What do you guys use? Any suggestions would be appreciated!

0 Replies