From 3d251bc0e80365085972819dfa245cf00a53f8f5 Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Tue, 18 Apr 2023 11:27:57 +0800 Subject: [PATCH 1/2] chore: ts fix --- src/Table.tsx | 4 ++-- src/hooks/useExpand.ts | 2 +- src/interface.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Table.tsx b/src/Table.tsx index 9681ee305..c8422bdf6 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -92,7 +92,7 @@ export interface TableProps children?: React.ReactNode; data?: readonly RecordType[]; columns?: ColumnsType; - rowKey?: (string & {}) | keyof RecordType | GetRowKey; + rowKey?: string | keyof RecordType | GetRowKey; tableLayout?: TableLayout; // Fixed Columns @@ -233,7 +233,7 @@ function Table(tableProps: TableProps( - props: TableProps, + props: TableProps, mergedData: readonly RecordType[], getRowKey: GetRowKey, ): [ diff --git a/src/interface.ts b/src/interface.ts index d3c2c99a6..5f05ce178 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -103,7 +103,7 @@ export type ColumnsType = readonly ( | ColumnType )[]; -export type GetRowKey = (record: RecordType, index?: number) => Key; +export type GetRowKey = (record: RecordType, index?: number) => string; // ================= Fix Column ================= export interface StickyOffsets { From a0a4a313a969199311bee294d67db5613bdfd596 Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Tue, 18 Apr 2023 11:41:03 +0800 Subject: [PATCH 2/2] revert --- src/Table.tsx | 2 +- src/interface.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Table.tsx b/src/Table.tsx index c8422bdf6..0df0794e3 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -233,7 +233,7 @@ function Table(tableProps: TableProps = readonly ( | ColumnType )[]; -export type GetRowKey = (record: RecordType, index?: number) => string; +export type GetRowKey = (record: RecordType, index?: number) => Key; // ================= Fix Column ================= export interface StickyOffsets {