Type improvements

Summary: some type simplifications, that makes it easier to reuse data sources and helps type inference

Reviewed By: passy

Differential Revision: D28413380

fbshipit-source-id: 261a8b981bf18a00edc3075926bd668322e1c37d
This commit is contained in:
Michel Weststrate
2021-06-07 08:08:53 -07:00
committed by Facebook GitHub Bot
parent 9a2677fc24
commit bc647972e1
12 changed files with 80 additions and 76 deletions

View File

@@ -64,7 +64,7 @@ type DataManagerActions<T> =
| Action<
'selectItemById',
{
id: string | number;
id: string;
addToSelection?: boolean;
}
>
@@ -213,7 +213,7 @@ export const dataTableManagerReducer = produce<
}
case 'setColumnFilterFromSelection': {
const items = getSelectedItems(
config.dataSource as DataSource,
config.dataSource as DataSource<any>,
draft.selection,
);
items.forEach((item, index) => {
@@ -258,7 +258,7 @@ export type DataTableManager<T> = {
end: number,
allowUnselect?: boolean,
): void;
selectItemById(id: string | number, addToSelection?: boolean): void;
selectItemById(id: string, addToSelection?: boolean): void;
clearSelection(): void;
getSelectedItem(): T | undefined;
getSelectedItems(): readonly T[];