PaddleHQ / paddle-js-wrapper

Wrapper to load Paddle.js as a module and use TypeScript definitions when working with methods.
Apache License 2.0
44 stars 6 forks source link

[Bug]: Typescript types casing does not match the API #79

Closed nacho-barbano-vs closed 5 days ago

nacho-barbano-vs commented 5 days ago

What happened?

I'm trying to use the data coming from prices preview and price-list endpoints. Both seem to have a full casing mismatch, on postman, using the official paddle API, I get 100% snake cased properties on all objects. Types coming both form @paddle-js and node-sdk are showing camelCase.

Paddle 1.3.2 price-preview.d.ts

Screenshot 2024-11-26 at 11 29 08 AM

Latest fork on the postman API

Screenshot 2024-11-26 at 11 32 45 AM

Steps to reproduce

  1. Install paddle JS on a TypeScript project, try using the types
  2. Compare with the structure and namings on the endpoint responses

What did you expect to happen?

Types to match the response.

How are you integrating?

Next.js + TypeScript + Paddle-js 1.3.2

Logs

No response

danbillson commented 5 days ago

Hi @nacho-barbano-vs, this is done by choice as it is a common pattern to use camel cased variable names in javascript projects whereas apis will commonly use snake case

As there aren't any actions to be taken I'm going to close this issue, be please feel free to reach out if you need any more assistance

nacho-barbano-vs commented 5 days ago

My proposed solution here would be for the library just to to export both casing options for cases when using Paddle.previewPrices is not an option (like calling from the server).