diff --git a/lib/utils/cache/index.ts b/lib/utils/cache/index.ts index 5c1750c46..a9a70f0fc 100644 --- a/lib/utils/cache/index.ts +++ b/lib/utils/cache/index.ts @@ -71,7 +71,7 @@ export default { * @param refresh Whether to renew the cache expiration time when the cache is hit. `true` by default. * @returns */ - tryGet: async (key: string, getValueFunc: () => Promise>, maxAge = config.cache.contentExpire, refresh = true) => { + tryGet: async >(key: string, getValueFunc: () => Promise, maxAge = config.cache.contentExpire, refresh = true) => { if (typeof key !== 'string') { throw new TypeError('Cache key must be a string'); } @@ -87,7 +87,7 @@ export default { v = parsed; } - return v; + return v as T; } else { const value = await getValueFunc(); cacheModule.set(key, value, maxAge);