fix(seed): add explicit String casting for ingredient and symptom loop items to satisfy TypeScript compiler

This commit is contained in:
parsa aghaei committed 2026-07-29 15:40:44 +03:30
1 parent 3ede3c31f9
commit ae636c8b03
1 file changed
+8 -6
+8 -6
View File
@@ -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<string>(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<string>(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 },