fix(buyer-tasks): type-safe expand traversal for customer/company

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
SJCoetz 2026-07-29 19:53:09 +02:00
parent 463917d755
commit 49acc04fd1

View file

@ -68,9 +68,9 @@ export async function listBuyerTasks(tab: BuyerTaskTab): Promise<BuyerTaskGroup[
if (!group) {
const order = item.expand?.order as { order_number?: string } | undefined;
const supplier = item.expand?.supplier as { suppliername?: string } | undefined;
const customer = (item.expand?.order as { customer?: unknown } | undefined)
?.expand?.customer as { customer?: string } | undefined;
const company = (customer?.expand?.company as { company?: string } | undefined)
const customer = (item.expand?.order as { expand?: { customer?: { customer?: string; expand?: { company?: { company?: string } } } } })
?.expand?.customer;
const company = customer?.expand?.company
?? (item.expand?.order as { expand?: { company?: { company?: string } } })?.expand?.company;
group = {