-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect inferred typing when using operation and endpoint #244
Comments
This is still an issue on |
I can fix this myself. Can @amz-tools please provide some guidance for how to fix this? |
@jakeleventhal How did you go about fixing this? Do we need to rewrite all the nested types ourselves? |
import { GetOrderPath, GetOrderResponse } from 'amazon-sp-api/lib/typings/operations/orders';
async getOrder(orderId: string): Promise<GetOrderResponse['payload']> {
try {
const order = await this.sellingPartner.callAPI({
operation: 'orders.getOrder',
path: { orderId } as GetOrderPath
});
return order;
} catch (err) {
const handledError = await this.handleAPIError(err);
throw handledError;
}
} annoying, but works |
@amz-tools any guidance here? Will gladly take this on. |
When making calls the API using inferred types (endpoint + operation), I am getting the wrong type for my
payload
variable.It seems to think that i should be destructuring
payload
when the value is already destructured. Below is what i see when i logpayload
The text was updated successfully, but these errors were encountered: