VariablesOf

shopify-graphql · /index·type

Typed variables shape required to execute a given graphql() document.

Use it to type the variables object passed to Apollo's useQuery or client.query so argument mismatches are caught at compile time.

Definition

@nordcom/commerce-shopify-graphql
type VariablesOf = GqlVariablesOf<TDoc>;

GqlVariablesOf<TDoc>

Example

import { graphql, VariablesOf } from '@nordcom/commerce-shopify-graphql';

const PRODUCT_QUERY = graphql(`
  query product($handle: String!) {
    product(handle: $handle) { id title }
  }
`);

type ProductVars = VariablesOf<typeof PRODUCT_QUERY>;
// { handle: string }

FragmentOf ResultOf TadaDocumentNode

Sourcegraphql.ts:100Edit the JSDoc directly
Metadata@nordcom/commerce-shopify-graphql@0.0.0Open in GitHub ↗

On this page