chargebee / chargebee-typescript

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

Broken function TypeScript types in version `2.34.0` #55

Closed ihmpavel closed 3 months ago

ihmpavel commented 4 months ago

After upgrading from 2.33.0 to 2.34.0 return types are broken.

Working 2.33.0:

type CustomerRetrieveInput = Parameters<typeof Customer.retrieve>
type CustomerRetrieveOutput = Promise<{
  card: Card
  customer: Customer
}>
const customerRetrieve = (
  customerId: CustomerRetrieveInput[0],
  params?: CustomerRetrieveInput[1]
): CustomerRetrieveOutput => chargebee.customer.retrieve(customerId, params).request()

Not working 2.34.0 - same code. Issue:

image

One liner:

image

After looking into the changes made https://github.com/chargebee/chargebee-typescript/commit/8a4e9fa1a886565705650ac72120aa0842a73dc0#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R23-L27 it looks like the problem is changing @types/q from devDependencies to dependencies.

cb-alish commented 4 months ago

Hi @ihmpavel , thanks for reporting this and sorry for the trouble. We’ve reverted the change which caused this issue for now. Please try v2.35.0 and let us know if you still face any issue.

ihmpavel commented 4 months ago

Hi @cb-alish, with 2.35.0 everything works now!

Thanks