From a91fca69acda98438fff95f8552a81d5bfa2fea7 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 12 Oct 2023 11:08:25 +0300 Subject: [PATCH] docs: added a note about typescript declaration file (#5361) --- www/apps/docs/content/development/entities/extend-entity.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/apps/docs/content/development/entities/extend-entity.md b/www/apps/docs/content/development/entities/extend-entity.md index 884ba79de1..8d41551ac7 100644 --- a/www/apps/docs/content/development/entities/extend-entity.md +++ b/www/apps/docs/content/development/entities/extend-entity.md @@ -65,6 +65,12 @@ export declare module "@medusajs/medusa/dist/models/product" { Notice that you must pass the attributes you added to the entity into the `interface`. The attributes will be merged with the attributes defined in the core `Product` entity. +:::note + +If TypeScript still doesn't pick up the custom attributes after adding `src/index.d.ts`, try moving the file to a nested directory in `src`. Please note that this only ensures TypeScript picks up the new attributes, but it doesn't actually reflect the new attributes in the database. That is handled by migrations. + +::: + --- ## Step 4: Create Migration