Skip to content

Commit ae9521c

Browse files
committed
fix types
1 parent 9a5ac88 commit ae9521c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/utils/src/rowCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AsyncRow, DataFrame, asyncRows } from './dataframe.js'
77
*/
88
export function rowCache(df: DataFrame): DataFrame {
99
// Row cache is stored as a sorted array of RowGroups, per sort order
10-
const caches: {[key: string]: AsyncRow[]} = {}
10+
const caches: Record<string, AsyncRow[] | undefined> = {}
1111

1212
let hits = 0
1313
let misses = 0
@@ -16,7 +16,7 @@ export function rowCache(df: DataFrame): DataFrame {
1616
...df,
1717
rows(start: number, end: number, orderBy?: string): AsyncRow[] {
1818
// Cache per sort order
19-
const cache = caches[orderBy || ''] ||= new Array(df.numRows)
19+
const cache = caches[orderBy ?? ''] ??= new Array<AsyncRow>(df.numRows)
2020
const n = hits + misses
2121
if (n && !(n % 10)) {
2222
console.log(`Cache hits: ${hits} / ${hits + misses} (${(100 * hits / (hits + misses)).toFixed(1)}%)`)

0 commit comments

Comments
 (0)