From 9545fdd3604601fce74860faa1ca58f77374f4c4 Mon Sep 17 00:00:00 2001 From: Khalid Abdi Date: Fri, 12 Jun 2026 19:22:07 +0300 Subject: [PATCH] backend: fix seed-inventory strict-null type error Guard the per-org count lookup so the build (tsc -p) doesn't fail on the possibly-undefined first row. Co-Authored-By: Claude Opus 4.8 --- backend/src/seed-inventory.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/seed-inventory.ts b/backend/src/seed-inventory.ts index 6e673bd..b4d20f1 100644 --- a/backend/src/seed-inventory.ts +++ b/backend/src/seed-inventory.ts @@ -43,11 +43,11 @@ async function main() { const orgs = await db.select({ id: organization.id }).from(organization); let seeded = 0; for (const org of orgs) { - const [{ count }] = await db + const [row] = await db .select({ count: sql`count(*)::int` }) .from(inventory) .where(eq(inventory.organizationId, org.id)); - if (count > 0) continue; + if ((row?.count ?? 0) > 0) continue; await db .insert(inventory) .values(DEMO_STOCK.map((s) => ({ ...s, organizationId: org.id })));