medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.93k stars 2.6k forks source link

Incorrect Types #6705

Closed ybirader closed 4 months ago

ybirader commented 8 months ago

I've been using the medusas/types library to add type info.

However, it seems that the exported types are distinct from those used in the core library. For example, Product is similar but not exactly the same as ProductDTO.

Alongside that, there is also the Medusa client-types package, which is also missing the required types.

Where should one find the required types?

Frioo commented 7 months ago

Found myself in the same situation. Currently using the types package (DTO types). ProductVariantDTO doesn't have prices, apparently? I think it should, since that field is returned from the API.

Update: Cart types are even more confusing. The DTO and non-dto types have many different fields. After updating the types and medusa sdk, it got better but typescript is now screaming that DTO type has more fields than what is returned from the sdk. I wonder if this is just misaligned because of the re-work going on, or if there's something else we should be using all along.

drloloto commented 7 months ago

Same for me

sradevski commented 4 months ago

Hey all, the DTO types are used for the v2 modules, and as such, differ from what was being exported from @medusajs/medusa in v1. Please use those types if you are using medusa v1, or use the @medusajs/types package for v2. Thanks!