diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 6dae765..ab2f556 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -757,7 +757,9 @@ function ImportPage() { errors.push(`Batch ${i / chunkSize + 1} (lookup): ${lookupError.message}`); } else { const existingByExternalId = new Map( - (existing ?? []).map((entry: { id: string; external_id: string | null }) => [entry.external_id, entry.id]), + ((existing ?? []) as Array<{ id: string; external_id: string | null }>).map( + (entry) => [entry.external_id, entry.id] as [string | null, string], + ), ); const toUpdate: Array = withConflict .filter((r) => existingByExternalId.has(String(r.external_id))) @@ -768,7 +770,7 @@ function ImportPage() { const updateResults = await Promise.all( toUpdate.map(async (entry) => { const { id, ...payload } = entry; - return supabase.from("time_entries").update(payload as any).eq("id", id).select("*").single(); + return supabase.from(cfg.table as any).update(payload as any).eq("id", id).select("*").single(); }), ); for (const result of updateResults) { @@ -776,21 +778,21 @@ function ImportPage() { errors.push(`Batch ${i / chunkSize + 1} (update): ${result.error.message}`); } else if (result.data) { inserted += 1; - inserted_rows.push(result.data); + inserted_rows.push(result.data as Row); } } } if (toInsert.length > 0) { const { data, error } = await supabase - .from("time_entries") + .from(cfg.table as any) .insert(toInsert as any) .select("*"); if (error) { errors.push(`Batch ${i / chunkSize + 1} (insert): ${error.message}`); } else if (data) { inserted += data.length; - inserted_rows.push(...data); + inserted_rows.push(...(data as Row[])); } } }