Type definition improvements.
See original GitHub issueI’ve been working with the API and I have a few ideas for type definition improvements, I’ll submit a few pull requests when I can find some time as I’ve made a few of these already.
Fixes
- ~ICarrierService - Needs
id:numberas part of the interface~ - ICreateArticle - image is only assignable to type of IBase64Image, when IShopifyImage could also be accepted.
- ICheckoutDiscount - Missing optional code string.
Improvements to types
- ICollection - Interface for a standard collection model, since ISmartCollection and ICustomCollection have a fair bit of overlap, also the various collection webhooks e.g.
/collections/createreturn essentially eitherISmartCollection | ICustomCollection - Better use of params for various functions, e.g.
product.listcurrently acceptsparams?:any - Better use of similar object types. e.g. ILineItemProperty vs ICheckoutLineItemProperty, essentially doing the same thing.
Additions
- ~WebhookRequestMap - Interface for lookup of WebhookTopic to an interface of webhook request. e.g. WebhookTopic
products/createcan have request of IProduct. This will require additions to what can be given by a webhook, e.g.~- ~ICart - Interface for cart webhook callbacks~
- ~IDeleteItem - Interface for a webhook callback for deleted item, generally
{ id:number }~ - ICollection - Refer to improvements to types
- ~ICarrierRequest - Interface for carrier request callbacks, will also require ICarrierItem and ICarrierAddress~
- ~ICarrierResponse - Interface for carrier responses to Shopify~
- RequestError (or similar) - Enumerator of errors that Shopify may return.
- IOrderLineItem - Seems to be missing a bit of stuff, particularly
discount_applications - AccessScopes - Enumerator of possible access scopes, also useful for
accessScope.list- This could potentially lead to having some form of precheck for available access scopes and giving us type definitions depending on access scope availibility.
Improvements to structure
- At the moment all the types are defined in the master index.d.ts file, it can be a bit much to navigate, perhaps a better defined folder structure would help with additions and changes.
I guess there’s also a case to be made for converting the project from Javascript to Typescript, if this is something that is being considered.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Improvements Definition: 16k Samples - Law Insider
Improvements means the buildings, structures, improvements, and alterations now constructed or at any time in the future constructed or placed upon the Land, ......
Read more >Improvement Definition & Meaning - Dictionary.com
a person or thing that represents an advance on another in excellence or achievement : The new landlord is a great improvement over...
Read more >Improvement - Definition, Meaning & Synonyms
Any change for the better or step in the right direction is an improvement. Definitions of improvement. noun. the act of improving something....
Read more >What is Process Improvement? Definition, types, benefits and ...
Process improvement is the practice of optimizing existing business processes in order to meet best market standards and improve customer experience.
Read more >Improvement definition and meaning | Collins English Dictionary
Improvement definition: If there is an improvement in something, it becomes better . If you make improvements to... | Meaning, pronunciation, translations ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think it could be beneficial to have something similar to;
I assume the TS Compiler will struggle with this recursive type definition a bit, but something similar came to mind.
I had a similar issue with paginated results on products. Something as simple as a generic this
Then change the return types for all paginated responses (not all are currently implemented according to the docs as of today).
In addition there is currently no support in the types for bigInt. It appears as though you are handling sending and retrieving the data with json-bigint but the types sending data are defined as number which will be a problem in the near future. A native bigint type was added in Typscript 3.2 but targets the native esnext bigint type and would not be compatible with the bigInt library used currently.