skip to Main Content

enter image description here

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


  1. 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":
    enter image description here

    also, you can use IDE like Visual Studio code and hover to get more details on what’s wrong.
    Hope it helps 🙂

    Login or Signup to reply.
  2. I think the comment in the code example is wrong.
    In the documentation, not the code example, it says
    enter image description here

    You see fieldName and order are string, not Array<String>.
    Also, fieldName‘s supported values include _createdDate but not createdDate.

    Try changing the parameter to

    { fieldName: '_createdDate', order: 'ASC' }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search