golevelup / nestjs

A collection of badass modules and utilities to help you level up your NestJS applications 🚀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Param error in stripe.checkout.sessions.listLineItems

eliseubrito7z opened this issue · comments

I needed to use the method "this.stripe.checkout.sessions.listLineItems" with the param "expand", but when i use this, i received the error:

 Argument of type '{ expand: string[]; }' is not assignable to parameter of type 'SessionListLineItemsParams'.
      Property 'status' is missing in type '{ expand: string[]; }' but required in type 'SessionListLineItemsParams'.
  Overload 2 of 2, '(id: string, options?: RequestOptions | undefined): ApiListPromise<LineItem>', gave the following error.
    Object literal may only specify known properties, and 'expand' does not exist in type 'RequestOptions'.

To solve this I went to the PaginationParams interface and set the status as optional. This worked, but I believe it may have an impact on another method

    interface PaginationParams {
      ending_before?: string;
      limit?: number;
      starting_after?: string;

      // status: 'complete' | 'expired' | 'open'
      status?: 'complete' | 'expired' | 'open'
    }

final code:

    const line_items = await this.stripe.checkout.sessions.listLineItems(session_id, {
      expand: ['data.price.product'],
      // status: 'open'
    })

hope this can help someone