Skip to content

Commit 362b31c

Browse files
Copilothotlong
andcommitted
Improve type safety in ReportViewer with proper types
- Replace 'any' types with ReportField and Record<string, any> - Import ReportField type from @object-ui/types - Better type safety without breaking the build Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 0848d0e commit 362b31c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/plugin-report/src/ReportViewer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import React from 'react';
1010
import { Card, CardContent, CardHeader, CardTitle, CardDescription, Button } from '@object-ui/components';
1111
import { SchemaRenderer } from '@object-ui/react';
1212
import { ComponentRegistry } from '@object-ui/core';
13-
import type { ReportViewerSchema, ReportSection, ReportExportFormat } from '@object-ui/types';
13+
import type { ReportViewerSchema, ReportSection, ReportExportFormat, ReportField } from '@object-ui/types';
1414
import { Download, Printer, RefreshCw } from 'lucide-react';
1515
import { exportReport } from './ReportExportEngine';
1616

@@ -277,17 +277,17 @@ export const ReportViewer: React.FC<ReportViewerProps> = ({ schema, onRefresh })
277277
<table className="w-full text-sm">
278278
<thead className="bg-muted">
279279
<tr>
280-
{report.fields?.map((field: any, idx: number) => (
280+
{report.fields?.map((field: ReportField, idx: number) => (
281281
<th key={idx} className="px-4 py-2 text-left font-medium">
282282
{field.label || field.name}
283283
</th>
284284
))}
285285
</tr>
286286
</thead>
287287
<tbody>
288-
{data.map((row: any, rowIdx: number) => (
288+
{data.map((row: Record<string, any>, rowIdx: number) => (
289289
<tr key={rowIdx} className="border-t">
290-
{report.fields?.map((field: any, colIdx: number) => (
290+
{report.fields?.map((field: ReportField, colIdx: number) => (
291291
<td key={colIdx} className="px-4 py-2">
292292
{row[field.name]}
293293
</td>

0 commit comments

Comments
 (0)