Yuri-Lima / woocommerce-rest-api-ts-lib

This is some improvements for the oficial WooCommerce repo. https://github.com/woocommerce/woocommerce-rest-api-js-lib I hope they merge or accept it as new repo. soon. Please few free to contact me.
MIT License
29 stars 8 forks source link

typescript error: get() params is not optional, per_page param is not available in other endpoints #25

Closed coycoylaniba closed 1 year ago

coycoylaniba commented 1 year ago

get parameters should be optional api.get("endpoint") Expected 2 arguments, but got 1. index.d.ts(15, 52): An argument for 'params' was not provided.

per_page is not available in other endpoints aside from webhook (which is webhook is not in the endpoints either) Argument of type '{ status: string; per_page: number; }' is not assignable to parameter of type 'WooRestApiParams'. Object literal may only specify known properties, and 'per_page' does not exist in type 'WooRestApiParams'.

package.json "woocommerce-rest-ts-api": "^2.0.0",

Yuri-Lima commented 1 year ago

Hi, @coycoylaniba.

Can y give an example what endpoits those param is not available, please? Because in my test it was. Let me check it please.

Thanks

coycoylaniba commented 1 year ago

this end points

node_modules/woocommerce-rest-ts-api/dist/src/typesANDinterfaces.d.ts: export declare type WooRestApiEndpoint = "coupons" | "customers" | "orders" | "products" | "system_status";

Yuri-Lima commented 1 year ago

Check the latest version and let me know @coycoylaniba

Thank you.

coycoylaniba commented 1 year ago

hello sir, the params type error is fixed. but i have another problem, if i do "products/:productId" this error shows up Argument of type 'string' is not assignable to parameter of type 'WooRestApiEndpoint'.

Yuri-Lima commented 1 year ago

For while, if you want to use it like that is not possible, you would have to use it as a Parameter, in my opinion, it becomes a bit clear than direct if not leave your thoughts about that.

Thanks @coycoylaniba

coycoylaniba commented 1 year ago

oh okay thanks, will try it

Yuri-Lima commented 1 year ago

@coycoylaniba just to know. Was everything ok?