From ae636c8b03b01807baa2f3df14e1c36f3d921037 Mon Sep 17 00:00:00 2001 From: parsa aghaei Date: Wed, 29 Jul 2026 15:40:44 +0330 Subject: [PATCH] fix(seed): add explicit String casting for ingredient and symptom loop items to satisfy TypeScript compiler --- backend/prisma/seed-products.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/prisma/seed-products.ts b/backend/prisma/seed-products.ts index 7075b76a..c0f52a19 100644 --- a/backend/prisma/seed-products.ts +++ b/backend/prisma/seed-products.ts @@ -372,10 +372,11 @@ export async function main() { .split(/[،,]/) .map((s: string) => s.trim()) .filter(Boolean); - const uniqueIngredients = Array.from( - new Set(parts.map((ing: string) => ing.substring(0, 150))), + const uniqueIngredients: string[] = Array.from( + new Set(parts.map((ing: string) => ing.substring(0, 150))), ).slice(0, 20); - for (const truncated of uniqueIngredients) { + for (const item of uniqueIngredients) { + const truncated: string = String(item); if (truncated.length > 0) { try { await prisma.productIngredient.create({ @@ -392,10 +393,11 @@ export async function main() { await prisma.productSymptom.deleteMany({ where: { productId: product.id }, }); - const symptomsList = Array.from( - new Set(PRODUCT_SYMPTOMS_MAP[baseSlug] || []), + const symptomsList: string[] = Array.from( + new Set(PRODUCT_SYMPTOMS_MAP[baseSlug] || []), ); - for (const sym of symptomsList) { + for (const item of symptomsList) { + const sym: string = String(item); try { await prisma.productSymptom.create({ data: { productId: product.id, symptom: sym },