Skip to content
Merged
Prev Previous commit
Next Next commit
🤖 Merge PR DefinitelyTyped#75414 [react-virtualized] Make columnIndex…
… optional in CellMeasurerCache.getHeight/getWidth by @Viktor-Kolyshkin
  • Loading branch information
Viktor-Kolyshkin authored Sep 28, 2026
commit 158fc26d61d862a7d9a14b5c9c267d5b80dcd144
4 changes: 2 additions & 2 deletions types/react-virtualized/dist/es/CellMeasurer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class CellMeasurerCache implements CellMeasurerCacheInterface {
readonly defaultWidth: number;
hasFixedHeight(): boolean;
hasFixedWidth(): boolean;
getHeight(rowIndex: number, columnIndex: number): number;
getWidth(rowIndex: number, columnIndex: number): number;
getHeight(rowIndex: number, columnIndex?: number): number;
getWidth(rowIndex: number, columnIndex?: number): number;
has(rowIndex: number, columnIndex: number): boolean;
rowHeight: (params: { index: number }) => number;
set(rowIndex: number, columnIndex: number, width: number, height: number): void;
Expand Down
4 changes: 4 additions & 0 deletions types/react-virtualized/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
{
"name": "Adam Zmenak",
"githubUsername": "azmenak"
},
{
"name": "Viktor Kolyshkin",
"githubUsername": "Viktor-Kolyshkin"
}
]
}
8 changes: 8 additions & 0 deletions types/react-virtualized/react-virtualized-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1810,3 +1810,11 @@ export class GridCellRangeRendererExample extends PureComponent<{}, any> {
return renderedCells;
}
}

// CellMeasurerCache.getHeight / getWidth: columnIndex is optional (the library
// defaults it to 0), matching CellMeasurerCacheInterface. Common for single-column List/Table.
const singleColumnMeasurerCache = new CellMeasurerCache({ fixedWidth: true });
const measuredRowHeight: number = singleColumnMeasurerCache.getHeight(0);
const measuredRowWidth: number = singleColumnMeasurerCache.getWidth(0);
const measuredCellHeight: number = singleColumnMeasurerCache.getHeight(0, 1);
const measuredCellWidth: number = singleColumnMeasurerCache.getWidth(0, 1);