Similar to what GraphQL request did, it would be amazing to be able to make fully typed calls with
the ComposeDB client. This can be achieved by leveraging graphql code generator.
Graphql-request implementation: GitHub - prisma-labs/graphql-request: Minimal GraphQL client supporting Node and browsers for scripts or simple apps
Ideally, the following would work.
import { graphql } from './gql/gql'
const getMovieQueryDocument = graphql(/* GraphQL */ `
query getMovie($title: String!) {
Movie(title: $title) {
releaseDate
actors {
name
}
}
}
`)
const data = await composeClient.executeQuery(
getMovieQueryDocument,
// variables are type-checked!
{ title: 'Inception' }
)
// `data.Movie` is typed!