chargebee-typescript icon indicating copy to clipboard operation
chargebee-typescript copied to clipboard

Stronger types for requests + parsing for webhook event handlers

Open jalexw opened this issue 2 years ago • 0 comments

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

jalexw avatar Aug 02 '23 16:08 jalexw