Skip to content

GraphQL Typescript types

Backend

Brush comes with an easy way to generate GraphQL Typescript types for both Shopify’s Admin and Storefront API objets.

In order to generate them:

  1. Run yarn add -D @shopify/api-codegen-preset

  2. Add this to the scripts entries of your package.json file:

"graphql-codegen": "graphql-codegen --project admin && graphql-codegen --project storefront && rm -rf ./_brush/shopify-types/*schema.json"
  1. Run npm run graphql-codegen. All types are now available in /_brush/shopify-types.