helios1138 / graphql-typed-client

A tool that generates a strongly typed client library for any GraphQL endpoint. The client allows writing GraphQL queries as plain JS objects (with type safety, awesome code completion experience, custom scalar type mapping, type guards and more)
MIT License
212 stars 18 forks source link

add alternative chain-query syntax based on Proxy #9

Closed helios1138 closed 5 years ago

helios1138 commented 5 years ago

ability to write something like

await client.query
  .search({ query: 'graphql', type: SearchType.REPOSITORY, first: 5 })
  .nodes
  .on_Repository({
    name: 1,
  })
  .execute()

as alternative to

await client.query({
  search: [{ query: 'graphql', type: SearchType.REPOSITORY, first: 5 }, {
    nodes: {
      on_Repository: {
        name: 1,
      },
    },
  }],
})

exact synthax subject to change