Very interesting topic, actually it's one of my favourite ones.
I've been working for the last year or so on the problem to improve type-safety for NextJS. My solution works like this:<p>Step 1: introspect your DataSources (Postgres, MySQL, GraphQL, REST, etc...)
Step 2: combine them into a virtual Graph (virtual GraphQL API)
Step 3: write GraphQL Operations and "compile" them into JSON RPC + generate a 100% type-safe client<p>Result? No more double declaration of types. No manual typing. More info on how this works with NextJS and Typescript here: [0]<p>Note, I'm the founder of WunderGraph and obsessed with creating the perfect developer experience for working with APIs. I appreciate any feedback.<p>[0]: <a href="https://wundergraph.com/docs/overview/features/generated_clients" rel="nofollow">https://wundergraph.com/docs/overview/features/generated_cli...</a>