chargebee / chargebee-typescript

Typescript library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=typescript
MIT License
22 stars 16 forks source link

Stronger types for requests + parsing for webhook event handlers #36

Open jalexw opened 1 year ago

jalexw commented 1 year ago

Hi there,

I'm trying to use this package for a work project to handle customer subscriptions using ChargeBee. I find there are way too many anys and loose typings that make this package neither easy to use nor inline with TypeScript best practices...

For example, callbacks should not have the type any, as the following is apparently valid according to your types:

const callback = "beans"
chargebee.subscription.list().request(callback)

I'd like to see strict: true enabled in the tsconfig.json configuration's compiler options to make this library more developer friendly...

Also, some methods/schemas to validate the incoming data within our webhook event handlers would be really helpful... May I recommend setting up some Zod schemas?

Kind Regards, -Alex