简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM