Apologies if this is already on your minds in some other issue, I looked a bit around but it's not easy to find things inside 225 issues even with a search feature ๐
Perceived Problem
When creating a test context via createTextContext, you can then use context.app.query to execute GraphQL queries against your app. However, the result of these queries is not typed, forcing you to manually write the types or going into no-type-safe land.
Nexus has all the information it needs via Nexus schema to be able to infer return types of queries. This is something Apollo does based on the SDL schema, but we might be able to do better as we have accurate TypeScript types as well. In most of my projects I use ts-graphql-plugin and its typegen command (source). It works pretty well although it requires you to manually assign the type to the returned value (I would expect from a framework to the mapping for me under the hood).
Apologies if this is already on your minds in some other issue, I looked a bit around but it's not easy to find things inside 225 issues even with a search feature ๐
Perceived Problem
When creating a test context via
createTextContext
, you can then usecontext.app.query
to execute GraphQL queries against your app. However, the result of these queries is not typed, forcing you to manually write the types or going into no-type-safe land.Ideas / Proposed Solution(s)
Nexus has all the information it needs via Nexus schema to be able to infer return types of queries. This is something Apollo does based on the SDL schema, but we might be able to do better as we have accurate TypeScript types as well. In most of my projects I use ts-graphql-plugin and its
typegen
command (source). It works pretty well although it requires you to manually assign the type to the returned value (I would expect from a framework to the mapping for me under the hood).