diff --git a/typings/index.d.ts b/typings/index.d.ts index 648712d4..4215cddb 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -40,7 +40,7 @@ export interface clientOptions { cacheTime?: number; cacheSize?: number; cacheFilter?: string | string[] | { 'whitelist': string | string[], 'blacklist': string | string[] }; - cacheHandler?: Record; + cacheHandler?: CacheHandler & unknown; rateLimit?: 'HARD' | 'AUTO' | 'NONE'; keyLimit?: number; syncWithHeaders?: boolean; @@ -48,6 +48,16 @@ export interface clientOptions { headers?: Record; checkForUpdates?: boolean; } +type PromiseLike = T | Promise; +type CacheHandler = { + set: (key: string, value: unknown) => PromiseLike, + get: (key: string) => PromiseLike, + has: (key: string) => PromiseLike, + delete: (key: string) => PromiseLike, + keys: () => PromiseLike, + size: () => PromiseLike, + clear: () => PromiseLike, +}; export interface methodOptions { noCacheCheck?: boolean; noCaching?: boolean;