A simple helper function to generate GraphQL queries using plain JavaScript Objects.
But the cool part is it's have types 🎉
npm install gql-typed-query-builder --save
or yarn add gql-typed-query-builder
import graphql from 'gql-typed-query-builder'
const [query] = graphql<Todo>({
name: 'todos',
fields: [
'id',
'name',
'complete'
]
})
console.log(query)
"query { todos { id name complete } }"
More examples: Tests
Ohh it's based on https://github.com/atulmy/gql-query-builder