user9614031
user9614031

Reputation:

Shopify admin api typescript

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

Upvotes: 1

Views: 3830

Answers (2)

Roet
Roet

Reputation: 1193

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.

Upvotes: 0

typicallearner
typicallearner

Reputation: 256

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

Upvotes: 0

Related Questions