Skip to content

Commit c838d80

Browse files
authored
fix(AnalyticalTable - TypeScript): correct typing for onRowClick and accessor function (#6520)
Fix #6519
1 parent a5088ad commit c838d80

File tree

1 file changed

+11
-3
lines changed
  • packages/main/src/components/AnalyticalTable/types

1 file changed

+11
-3
lines changed

packages/main/src/components/AnalyticalTable/types/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,15 @@ export interface AnalyticalTableColumnDefinition {
329329
* __Note__: You can also specify deeply nested values with accessors like `info.hobby` or even `address[0].street`
330330
* __Note__: If no `accessor` is set, or the `accessor` is a function, the `id` property has to be set.
331331
*/
332-
accessor?: string | ((row: RowType, rowIndex: number) => any);
332+
accessor?:
333+
| string
334+
| ((
335+
originalRow: Record<string, any>,
336+
rowIndex: number,
337+
row: RowType,
338+
parentRows: RowType[],
339+
data: Record<string, any>[]
340+
) => any);
333341
/**
334342
* Defines the unique ID for the column. It is used by reference in things like sorting, grouping, filtering etc.
335343
*
@@ -541,8 +549,8 @@ interface OnAutoResizeMouseEvent extends Omit<MouseEvent, 'detail'> {
541549
detail: { columnId: string; width: number; nativeDetail: 2 };
542550
}
543551

544-
interface OnRowClickEvent extends Omit<MouseEvent, 'detail'> {
545-
detail: { detail: { row: unknown; nativeDetail: number } };
552+
interface OnRowClickEvent extends Omit<UIEvent, 'detail'> {
553+
detail: { row: RowType; nativeDetail: number };
546554
}
547555

548556
export interface AnalyticalTablePropTypes extends Omit<CommonProps, 'title'> {

0 commit comments

Comments
 (0)