From c8017bfe9d69524002112f0c57264884415b46be Mon Sep 17 00:00:00 2001 From: althoff0 Date: Wed, 21 Aug 2024 16:20:25 +1000 Subject: [PATCH 1/2] change string type --- index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 7583d65..f5d3b88 100644 --- a/index.ts +++ b/index.ts @@ -298,10 +298,7 @@ export function create(options: RedisCacheOptions): RedisCache { * key.getString(prefix) === "foo:user:5:session:a42799b8"; * key.getMetaString(prefix) === "foo:user:{0}:session:{1}"; */ -export function cacheKey( - strings: TemplateStringsArray, - ...values: string[] -): CacheKey { +export function cacheKey(strings: string[], ...values: string[]): CacheKey { return { getString: (prefix: string) => prefix + strings.reduce((out, str, i) => out + values[i - 1] + str), From e763d69bbc2713335e6b189cbc7defa94fe57cfb Mon Sep 17 00:00:00 2001 From: althoff0 Date: Wed, 21 Aug 2024 16:34:08 +1000 Subject: [PATCH 2/2] readonly --- index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index f5d3b88..36b533b 100644 --- a/index.ts +++ b/index.ts @@ -298,7 +298,10 @@ export function create(options: RedisCacheOptions): RedisCache { * key.getString(prefix) === "foo:user:5:session:a42799b8"; * key.getMetaString(prefix) === "foo:user:{0}:session:{1}"; */ -export function cacheKey(strings: string[], ...values: string[]): CacheKey { +export function cacheKey( + strings: readonly string[], + ...values: string[] +): CacheKey { return { getString: (prefix: string) => prefix + strings.reduce((out, str, i) => out + values[i - 1] + str),