Skip to content

Commit 626e41f

Browse files
committed
attempt to fix CacheKey type
1 parent 4a4db22 commit 626e41f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ export type PreAggTableToTempTable = [
100100
TempTable,
101101
];
102102

103-
export type CacheKey = Array<
104-
| string
105-
| string[]
106-
| QueryTuple
107-
>;
103+
export type CacheKeyItem = string | string[] | QueryTuple | QueryTuple[] | undefined;
104+
105+
export type CacheKey =
106+
[CacheKeyItem, CacheKeyItem] |
107+
[CacheKeyItem, CacheKeyItem, CacheKeyItem] |
108+
[CacheKeyItem, CacheKeyItem, CacheKeyItem, CacheKeyItem];
108109

109110
type CacheEntry = {
110111
time: number;
@@ -373,7 +374,7 @@ export class QueryCache {
373374
}
374375

375376
public static queryCacheKey(queryBody: QueryBody): CacheKey {
376-
const key = [
377+
const key: CacheKey = [
377378
queryBody.query,
378379
queryBody.values,
379380
(queryBody.preAggregations || []).map(p => p.loadSql)
@@ -383,7 +384,7 @@ export class QueryCache {
383384
}
384385
// @ts-ignore
385386
key.persistent = queryBody.persistent;
386-
return <CacheKey>key;
387+
return key;
387388
}
388389

389390
protected static replaceAll(replaceThis, withThis, inThis) {

0 commit comments

Comments
 (0)