skip to Main Content

Does anyone know if Shopify provides typescript definitions for their admin API?

Specifically, I’m looking for types for Orders, Products, Variants.

I thought this package would include them but I’m not seeing them in there. https://github.com/Shopify/shopify-node-api

2

Answers


  1. Both of these packages have TypeScript definitions.

    Also, the "TS" icon next to the title in npmjs.com is an indicator for TS definition.

    https://www.npmjs.com/package/@shopify/shopify-api

    https://www.npmjs.com/package/shopify-api-node

    Login or Signup to reply.
  2. The type definitions for Orders, Products and Variants can be found here:
    https://github.com/Shopify/shopify-api-node/tree/main/src/rest-resources/2021-07

    Alternatively, you can go to the docs at Shopify for the Order object for example https://shopify.dev/api/admin-rest/2022-07/resources/order#resource-object and paste the JSON into http://json2ts.com/ (or https://app.quicktype.io/, which only generates 1 interface per type) to get a pretty accurate Typescript Representation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search