Skip to content

Commit daf5659

Browse files
authored
Use Range type instead Item type (#948)
Item type is not semantically correct here. An Item is a [row, col] pair, but this callback argument should be a [startIndex, endIndex] pair.
1 parent 0e42c33 commit daf5659

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/source/src/use-async-data-source.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import range from "lodash/range.js";
1313
import chunk from "lodash/chunk.js";
1414
import React from "react";
1515

16-
export type RowCallback<T> = (range: Item) => Promise<readonly T[]>;
16+
type Range = readonly [startIndex: number, endIndex: number];
17+
export type RowCallback<T> = (range: Range) => Promise<readonly T[]>;
1718
export type RowToCell<T> = (row: T, col: number) => GridCell;
1819
export type RowEditedCallback<T> = (cell: Item, newVal: EditableGridCell, rowData: T) => T | undefined;
1920
export function useAsyncDataSource<TRowType>(

0 commit comments

Comments
 (0)