Hi! Has anyone been successful in extending the type definitions for a Medusa React hook or the JS client? I’ve tried to get my custom field added to useAdminCreateProduct hook, but unsuccessfully so far. I do have the registerOverriddenValidators function in place with AdminPostProductsProductReq (and I'm extending it with the custom field). The API request for updating the product is working with that custom field, so that must mean that the validator itself is working. But the typings aren’t still being picked up... 🤔 Any advice?
#Extending the type definitions for hook or client
2 messages · Page 1 of 1 (latest)
hi, if it's just a matter of type you can override the hook in a declaration file, I do this a lot on the backend but didn't try on the storefront but basically and for informations only, it can looks like this :
export declare module '@medusajs/medusa/dist/models/product' {
declare interface Product {
// Add new properties here
}
}
So that means in your case you will update the module path, to your useAdminCreateProduct hook and try to tweak the return value or the input