lmsqueezy/lemonsqueezy.js

[Feature Request] Types export

Closed this issue · 3 comments

It would be great if we could use some types in our app like for example SubscriptionObject, if we want to store a user subscription in a class.

I would also love it, I'm creating webhooks and would love to reuse already defined types. I already did that with lemonsqueezy.ts

If you need help with implementing this, let me know

While the types are not exported from the package, I'm deriving them from the client methods.
Here are some examples:

const lemonClient = new LemonSqueezy(/** */);

type SubscriptionResponse = Awaited<ReturnType<typeof lemonClient.getSubscription>>;
type OrderResponse = Awaited<ReturnType<typeof lemonClient.getOrder>>;
type SubscriptionInvoicesResponse = Awaited<ReturnType<typeof lemonClient.getSubscriptionInvoice>>;

Types are now exported with v2.0.0.