Why do I get red lines on fieldName
and order
? I’m following the API reference here:
https://www.wix.com/velo/reference/wix-pricing-plans-backend/orders/listcurrentmemberorders
Here’s a sample from the example in the reference:
/* Sample filters object:
* {
* orderStatuses: ['PAUSED', 'CANCELED']
* }
*/
/* Sample sorting object:
* {
* fieldName: ['createdDate'],
* order: ['ASC']
* }
*/
/* Sample paging object:
* {
* limit: 3,
* skip: 1
* }
*/
The red line error says: Type 'string[]' is not assignable to type 'string'
I feel like I’m doing what the linked reference says, and have tried various setups from exploring the reference.
(EDIT: And the next thing to look into would be why orders
on listedOrders.orders
throws the error: Property 'orders' does not exist on type 'Order[]'.
)
Is the answer that the API reference is outdated?
2
Answers
The default value is what you are looking for. According to the documentation so you can simply send the sorting as null or write "_createdDate" instead of
"createdDate":
also, you can use IDE like Visual Studio code and hover to get more details on what’s wrong.
Hope it helps 🙂
I think the comment in the code example is wrong.
In the documentation, not the code example, it says
You see
fieldName
andorder
arestring
, notArray<String>
.Also,
fieldName
‘s supported values include_createdDate
but notcreatedDate
.Try changing the parameter to