Skip to content

Commit b6920fa

Browse files
committed
fix: resolve type mismatch in buildCacheKey params
1 parent 6c56b7d commit b6920fa

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/utils/cache-key-params.utils.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515
* // => "limit:20:order:desc:sort:createdAt"
1616
*/
1717
export function buildCanonicalParamString(
18-
params: Record<string, string | number | boolean | undefined>
18+
params: Record<string, unknown>
1919
): string {
2020
return Object.entries(params)
21-
.filter(
22-
(entry): entry is [string, string | number | boolean] =>
23-
entry[1] !== undefined
24-
)
21+
.filter((entry): entry is [string, unknown] => entry[1] !== undefined)
2522
.sort(([a], [b]) => a.localeCompare(b))
26-
.map(([key, value]) => `${key}:${value}`)
23+
.map(([key, value]) => `${key}:${typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value)}`)
2724
.join(':');
2825
}
2926

0 commit comments

Comments
 (0)