Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Type the sender lookup's secondary emails instead of narrowing them at runtime

Jeromea63ca28d1d8b
diff --git a/supabase/functions/postmark/index.ts b/supabase/functions/postmark/index.ts
index dbf02b2d..cb7312e2 100644
--- a/supabase/functions/postmark/index.ts
+++ b/supabase/functions/postmark/index.ts
@@ -63,11 +63,10 @@ Deno.serve(async (req) => {
const salesEmails =
allSales.data
- ?.flatMap((s: { email: string; secondary_emails: unknown }) => [
+ ?.flatMap((s: { email: string; secondary_emails: string[] }) => [
s.email,
- ...(Array.isArray(s.secondary_emails) ? s.secondary_emails : []),
+ ...s.secondary_emails,
])
- .filter((email: unknown): email is string => typeof email === "string")
.map((email: string) => email.toLowerCase()) ?? [];
const firstToEmail = (ToFull[0]?.Email || "").toLowerCase();