Skip to content

Commit 3a134dc

Browse files
committed
fix: resolve tsc -b build errors for CI deployment
- Fix EnterpriseMemberRow cast to Record<string, unknown> (add intermediate unknown cast) - Remove Partial<TableRow> type annotation so emptyRow spread satisfies TableRow - Fix keyof TableRow accessor to string & keyof TableRow - Fix Uint8Array to BlobPart cast in zip.ts - Fix exhaustive-deps warnings in charts and ReportTable
1 parent bc379ab commit 3a134dc

5 files changed

Lines changed: 17 additions & 19 deletions

File tree

src/components/ReportTable.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ export function ReportTable({ onGroupClick }: ReportTableProps) {
205205
});
206206
}, []);
207207

208-
const emptyRow: Partial<TableRow> = {
209-
count: 0, grossAmount: 0, discountAmount: 0, netAmount: 0, quantity: 0,
210-
totalInputTokens: 0, totalOutputTokens: 0, totalCacheCreationTokens: 0, totalCacheReadTokens: 0,
211-
totalMinutes: 0, totalStorageGBH: 0,
212-
};
213-
214208
const tableData = useMemo(() => {
215209
if (!activeReport) return [];
216210

211+
const emptyRow = {
212+
count: 0, grossAmount: 0, discountAmount: 0, netAmount: 0, quantity: 0,
213+
totalInputTokens: 0, totalOutputTokens: 0, totalCacheCreationTokens: 0, totalCacheReadTokens: 0,
214+
totalMinutes: 0, totalStorageGBH: 0,
215+
};
216+
217217
// Helper to resolve a display value for group labels
218218
const resolveGroupLabel = (val: unknown): string => {
219219
if (typeof val === 'boolean') return val ? 'Yes' : 'No';
@@ -232,7 +232,7 @@ export function ReportTable({ onGroupClick }: ReportTableProps) {
232232
}
233233

234234
return [...groups.entries()].map(([key, rows]) => {
235-
const first = rows[0] as Record<string, unknown>;
235+
const first = rows[0] as unknown as Record<string, unknown>;
236236
const base: TableRow = {
237237
...emptyRow,
238238
id: key,
@@ -303,18 +303,16 @@ export function ReportTable({ onGroupClick }: ReportTableProps) {
303303
return populated;
304304
}, [activeReport, isFlatReport, visibleRows]);
305305

306-
const activeFilterValues = filters[groupByColumn] ?? [];
307-
308306
const handleGroupClick = useCallback(
309307
(value: string, e: React.MouseEvent) => {
310308
e.preventDefault();
311309
e.stopPropagation();
312-
// Toggle: if already filtered to this value, clear the filter
313-
const isActive = activeFilterValues.some((v) => v.toLowerCase() === value.toLowerCase());
310+
const currentFilterValues = filters[groupByColumn] ?? [];
311+
const isActive = currentFilterValues.some((v) => v.toLowerCase() === value.toLowerCase());
314312
setFilter(groupByColumn, isActive ? [] : [value]);
315313
if (!isActive) onGroupClick?.();
316314
},
317-
[groupByColumn, activeFilterValues, setFilter, onGroupClick],
315+
[groupByColumn, filters, setFilter, onGroupClick],
318316
);
319317

320318
const columns = useMemo<ColumnDef<TableRow, unknown>[]>(() => {
@@ -465,7 +463,7 @@ export function ReportTable({ onGroupClick }: ReportTableProps) {
465463
// Helper to build flat columns, skipping the one used as the group column
466464
const flatCol = (key: string, header: string, fmt?: 'datetime' | 'end') => {
467465
if (key === groupByColumn) return null;
468-
return columnHelper.accessor(key as keyof TableRow, {
466+
return columnHelper.accessor(key as string & keyof TableRow, {
469467
header,
470468
cell: (info) => {
471469
const v = info.getValue();

src/components/charts/CostBreakdownChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function CostBreakdownChart({ stackField = 'model', metricOptions }: Cost
8686
plotOptions: { column: { stacking: 'normal' } },
8787
series,
8888
};
89-
}, [activeReport, timeBucket, visibleRows, effectiveMetricKey, stackField, activeMetric]);
89+
}, [activeReport, timeBucket, visibleRows, stackField, activeMetric, dataField]);
9090

9191
if (!options) return null;
9292

src/components/charts/ModelBreakdownChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export function GroupBreakdownChart({ stackField = 'model', metricOptions }: Gro
151151
plotOptions: { bar: { stacking: 'normal' } },
152152
series,
153153
};
154-
}, [activeReport, groupByColumn, stackField, effectiveMetricKey, visibleRows, hiddenGroups, toggleGroup, activeMetric]);
154+
}, [activeReport, groupByColumn, stackField, visibleRows, hiddenGroups, toggleGroup, activeMetric, dataField]);
155155

156156
const tokenOptions = useMemo((): Highcharts.Options | null => {
157157
if (!activeReport || !isTokenReport) return null;

src/lib/aggregation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function groupBy<T extends AnyReportRow>(
2525
export function sumBy<T extends AnyReportRow>(rows: T[], column: string): number {
2626
if (column === '_count') return rows.length;
2727
return rows.reduce((sum, row) => {
28-
const val = (row as Record<string, unknown>)[column];
28+
const val = (row as unknown as Record<string, unknown>)[column];
2929
return sum + (typeof val === 'number' ? val : 0);
3030
}, 0);
3131
}
@@ -147,7 +147,7 @@ export function computeSummary(rows: AnyReportRow[]): ReportSummary {
147147
// Flat report types: extract users, orgs, repos from non-billing rows
148148
for (const row of rows) {
149149
if (isBillingRow(row)) continue;
150-
const r = row as Record<string, unknown>;
150+
const r = row as unknown as Record<string, unknown>;
151151
if (r.userLogin) users.add(String(r.userLogin));
152152
if (r.login) users.add(String(r.login));
153153
if (r.organization) organizations.add(String(r.organization));
@@ -158,7 +158,7 @@ export function computeSummary(rows: AnyReportRow[]): ReportSummary {
158158
const flatDates = rows
159159
.filter((r) => !isBillingRow(r))
160160
.map((r) => {
161-
const rec = r as Record<string, unknown>;
161+
const rec = r as unknown as Record<string, unknown>;
162162
return String(rec.lastPushedDate ?? rec.lastActivityAt ?? rec.createdAt ?? '').slice(0, 10);
163163
})
164164
.filter(Boolean)

src/lib/zip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function createZipArchive(files: Record<string, string>): Blob {
1010
zipData[name] = strToU8(content);
1111
}
1212
const zipped = zipSync(zipData);
13-
return new Blob([zipped], { type: 'application/zip' });
13+
return new Blob([zipped as unknown as BlobPart], { type: 'application/zip' });
1414
}
1515

1616
/**

0 commit comments

Comments
 (0)