From fd377cbfa22466d8b5d5a639e2afbf28da31a71a Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Sat, 2 Aug 2025 23:00:42 -0600 Subject: [PATCH] create mapped union type --- .../ui/list/BusterList/interfaces.ts | 22 ++++++++++--------- .../ReportItemsContainer.tsx | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/web/src/components/ui/list/BusterList/interfaces.ts b/apps/web/src/components/ui/list/BusterList/interfaces.ts index 3e195e740..55e4af6cc 100644 --- a/apps/web/src/components/ui/list/BusterList/interfaces.ts +++ b/apps/web/src/components/ui/list/BusterList/interfaces.ts @@ -14,16 +14,18 @@ export interface BusterListProps { rowClassName?: string; } -export interface BusterListColumn { - dataIndex: keyof T; - title: string; - width?: number; - minWidth?: number; - align?: 'left' | 'center' | 'right'; //TODO - render?: (value: T[keyof T], record: T) => React.JSX.Element | string | React.ReactNode; - headerRender?: (title: string) => React.ReactNode; - ellipsis?: boolean; -} +export type BusterListColumn = { + [K in keyof T]: { + dataIndex: K; + title: string; + width?: number; + minWidth?: number; + align?: 'left' | 'center' | 'right'; + render?: (value: T[K], record: T) => React.JSX.Element | string | React.ReactNode; + headerRender?: (title: string) => React.ReactNode; + ellipsis?: boolean; + }; +}[keyof T]; export type BusterListRow = BusterListRowItem; export interface BusterListRowItem { diff --git a/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx b/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx index f7b3a125f..c4fd31bc8 100644 --- a/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx +++ b/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx @@ -60,7 +60,7 @@ export const ReportItemsContainer: React.FC<{ { dataIndex: 'name', title: 'Name', - render: (name, record) => + render: (name, record) => }, { dataIndex: 'last_edited',