diff --git a/components/table/__tests__/type.test.tsx b/components/table/__tests__/type.test.tsx
index d19368c6ce..0e33298a06 100644
--- a/components/table/__tests__/type.test.tsx
+++ b/components/table/__tests__/type.test.tsx
@@ -24,6 +24,12 @@ describe('Table.typescript', () => {
);
expect(table).toBeTruthy();
});
+ it('selections', () => {
+ const table = (
+
+ );
+ expect(table).toBeTruthy();
+ });
});
describe('Table.typescript types', () => {
diff --git a/components/table/hooks/useSelection.tsx b/components/table/hooks/useSelection.tsx
index 1aa05f024e..7c2f9076e2 100644
--- a/components/table/hooks/useSelection.tsx
+++ b/components/table/hooks/useSelection.tsx
@@ -21,8 +21,8 @@ import {
const EMPTY_LIST: any[] = [];
// TODO: warning if use ajax!!!
-export const SELECTION_ALL = 'SELECT_ALL';
-export const SELECTION_INVERT = 'SELECT_INVERT';
+export const SELECTION_ALL = 'SELECT_ALL' as const;
+export const SELECTION_INVERT = 'SELECT_INVERT' as const;
function getFixedType(column: ColumnsType[number]): FixedType | undefined {
return column && column.fixed;
@@ -41,7 +41,10 @@ interface UseSelectionConfig {
getPopupContainer?: GetPopupContainer;
}
-type INTERNAL_SELECTION_ITEM = SelectionItem | typeof SELECTION_ALL | typeof SELECTION_INVERT;
+export type INTERNAL_SELECTION_ITEM =
+ | SelectionItem
+ | typeof SELECTION_ALL
+ | typeof SELECTION_INVERT;
function flattenData(
data: RecordType[] | undefined,
diff --git a/components/table/interface.tsx b/components/table/interface.tsx
index 0fbadf5387..d51c58c8ad 100644
--- a/components/table/interface.tsx
+++ b/components/table/interface.tsx
@@ -6,6 +6,7 @@ import {
} from 'rc-table/lib/interface';
import { CheckboxProps } from '../checkbox';
import { PaginationConfig } from '../pagination';
+import { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
export { GetRowKey, ExpandableConfig };
@@ -130,7 +131,7 @@ export interface TableRowSelection {
onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
/** @deprecated This function is meaningless and should use `onChange` instead */
onSelectInvert?: (selectedRowKeys: Key[]) => void;
- selections?: SelectionItem[] | boolean;
+ selections?: INTERNAL_SELECTION_ITEM[] | boolean;
hideDefaultSelections?: boolean;
fixed?: boolean;
columnWidth?: string | number;