woocommerce-rest-api-ts-lib
woocommerce-rest-api-ts-lib copied to clipboard
Paging does not work!
The way the current client is set up paging gets ignored due to the way the ProductsMainParams
is defined.
export type ProductsMainParams = (ProductsParams & ProductsVariationsParams & ProductsAttributesParams) | ProductsAttributesTermsParams | ProductsCategoriesParams | ProductsShippingClassesParams | ProductsTagsParams | ProductsReviewsParams;
The ProductsParams
contains the properties page
and per_page
, but the rest of the params do not.
Since paging works for product variations and product attributes, it is required to work for the rest of the endpoints.
Solution
Create a type intersection with either the ProductsParams
type, or create a new type Paging
.