#How to type entity metadata?

2 messages · Page 1 of 1 (latest)

winged bramble
#

Hi! I make extensive use of metadata on quite a bit of Medusa entities (LineItem, ProductOption, Product...), and remembering what metadata each entity has while coding is becoming quite difficult. Is there a way to extend the Medusa default typings to allow me to specify, for example, an interface for ProductOption's metadata?

It would be very helpful for my developer experience.

Thanks!

heady ibex
#

Hi
What about override with d.ts file ?
For example :

// src/types.d.ts
export declare module '@medusajs/medusa/dist/models/product' {
    declare interface Product {
        metadata : Record<"myKey", string>
    }
}