NuroDev / lemonsqueezy.ts

🍋 JavaScript / TypeScript SDK for the Lemon Squeezy API
https://paka.dev/npm/lemonsqueezy.ts
MIT License
158 stars 17 forks source link

Allow optional `checkout_data`, `checkout_options`, & `product_options` field keys. #8

Closed kaleabmelkie closed 1 year ago

kaleabmelkie commented 1 year ago

Currently, all the fields of LemonsqueezyCheckoutData, LemonsqueezyCheckoutOptions, & LemonsqueezyProductOptions are required in TypeScript.

When calling createCheckout, we get a type error unless all the fields are provided for these objects:

Screenshot 2023-03-20 at 1 04 36 PM

I believe the fix should be as simple as making the fields of the three type above optional, right?

I made them optional in my local node_modules folder and it seemed to work (locally). I'm just not sure if any of these fields need to be required (not optional):

Screenshot 2023-03-20 at 1 11 09 PM
NuroDev commented 1 year ago

Changes for this had already been made recently to improve this but weren't perfect.

I have just pushed a new change that should fix this.

I will publish a new version with correctly functioning create checkout logic soon.

kaleabmelkie commented 1 year ago

Alright, thanks!