PaddleHQ / paddle-js-wrapper

Wrapper to load Paddle.js as a module and use TypeScript definitions when working with methods.
Apache License 2.0
28 stars 4 forks source link

[Bug]: Incorrect type definition of discountId in updateCheckout #49

Open gorshkovaea opened 3 weeks ago

gorshkovaea commented 3 weeks ago

What happened?

I got an error "Type null is not assignable to type string | undefined" when I tried to call
paddle.Checkout.updateCheckout({ discountId: null, items: [{ priceId: 'newPriceId', quantity: 1 }], });.

I expect the type of discountId to be string | null, as docs state

Steps to reproduce

  1. Call paddle.Checkout.updateCheckout in .ts file with discountId: null
  2. Get a ts error "Type null is not assignable to type string | undefined"

What did you expect to happen?

paddle.Checkout.updateCheckout({ discountId: null, items: [{ priceId: 'newPriceId', quantity: 1 }], }); works well without any errors

How are you integrating?

React, TypeScript

Logs

No response

vijayasingam-paddle commented 3 weeks ago

Hi @gorshkovaea, Thank you for reporting this issue to us. I am sorry that you are running into this issue. We will check and update the types.

Thank you.