Skip to content

Commit eecc4dc

Browse files
committed
more types
1 parent ef8c5c7 commit eecc4dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ const ListComponent = forwardRef(function (
5656
) {
5757
// hooks
5858
const timeoutRef = useRef(0);
59-
const cacheRef = useRef<any>({});
6059
const listRef = useRef<any>(null);
6160
const prevWidthRef = useRef(width);
6261
const treeRef = useRef(new NumberTree());
6362
const tableRef = useRef<HTMLDivElement>(null);
63+
const cacheRef = useRef<{ [index: number]: number }>({});
6464
const { dispatch, uuid, columns, minColumnWidth, fixedWidth, remainingCols, pixelWidths } =
6565
useContext(TableContext);
6666
const [useRowWidth, setUseRowWidth] = useState(true);
@@ -73,7 +73,7 @@ const ListComponent = forwardRef(function (
7373

7474
// functions
7575
const generateKeyFromRow = useCallback(
76-
(row: any, defaultValue: number) => {
76+
function <T>(row: T, defaultValue: number) {
7777
const generatedKey = itemKey ? itemKey(row) : undefined;
7878
return generatedKey !== undefined ? generatedKey : defaultValue;
7979
},
@@ -174,7 +174,7 @@ const ListComponent = forwardRef(function (
174174
const dataIndex = parseInt(node.dataset.index || "0");
175175

176176
// if the row is incorrect, update the tops going forward
177-
const height = cache[dataIndex + 1].size;
177+
const height: number = cache[dataIndex + 1].size;
178178
const computed = calculateHeight(node, dataIndex);
179179

180180
// case 0: the first element, where the top is correct

0 commit comments

Comments
 (0)