Skip to content

fix(AnalyticalTable - TypeScript): correct typing for onRowClick and accessor function #6520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 25, 2024
6 changes: 3 additions & 3 deletions packages/main/src/components/AnalyticalTable/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
* __Note__: You can also specify deeply nested values with accessors like `info.hobby` or even `address[0].street`
* __Note__: If no `accessor` is set, or the `accessor` is a function, the `id` property has to be set.
*/
accessor?: string | ((row: RowType, rowIndex: number) => any);
accessor?: string | ((originalRow: Record<string, any>, rowIndex: number, row: RowType, parentRows: RowType[], data: Record<string, any>[]) => any);

Check failure on line 332 in packages/main/src/components/AnalyticalTable/types/index.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `·string·|·((originalRow:·Record<string,·any>,·rowIndex:·number,·row:·RowType,·parentRows:·RowType[],·data:·Record<string,·any>[]` with `⏎····|·string⏎····|·((⏎········originalRow:·Record<string,·any>,⏎········rowIndex:·number,⏎········row:·RowType,⏎········parentRows:·RowType[],⏎········data:·Record<string,·any>[]⏎······`
/**
* Defines the unique ID for the column. It is used by reference in things like sorting, grouping, filtering etc.
*
Expand Down Expand Up @@ -541,8 +541,8 @@
detail: { columnId: string; width: number; nativeDetail: 2 };
}

interface OnRowClickEvent extends Omit<MouseEvent, 'detail'> {
detail: { detail: { row: unknown; nativeDetail: number } };
interface OnRowClickEvent extends Omit<UIEvent, 'detail'> {
detail: { row: RowType; nativeDetail: number };
}

export interface AnalyticalTablePropTypes extends Omit<CommonProps, 'title'> {
Expand Down
Loading