GraphQL Mesh v0 documentation (superseded by v1): Configure GraphQL Code Generator in GraphQL Mesh to generate fully typed resolvers and SDK. Use the default configuration or customize it to fit your needs.
Mesh relies on GraphQL Code Generator to generate the
Resolvers type that give you access to:
fully typed resolvers map
fully typed SDK (through the context) to fetch data from Sources
The generated typed Mesh SDK can also be accessed directly, as shown below:
test.ts
import { getMeshSDK } from './.mesh'async function test() { // Load mesh config and get the sdkClient from it const sdk = getMeshSDK() // Execute `myQuery` and get a type-safe result // Variables and result are typed: { getSomething: { fieldA: string, fieldB: number }, errors?: GraphQLError[] } const { getSomething } = await sdk.myQuery({ someVar: 'foo' })}
GraphQL Code Generator default configuration
Mesh provides a default GraphQL Code Generator configuration, shown below: