diff --git a/index.ts b/index.ts index cf7be71..5316347 100644 --- a/index.ts +++ b/index.ts @@ -1,3 +1,10 @@ +type MapLike = { + set(key: K, value: V): void + get(key: K): V | undefined + has(key: K): boolean + delete(key: K): void +} + export interface MemoizeOptions { /** * Provides a single value to use as the Key for the memoization. @@ -9,7 +16,7 @@ export interface MemoizeOptions { * The Cache implementation to provide. Must be a Map or Map-alike. * Defaults to a Map. Useful for replacing the cache with an LRU cache or similar. */ - cache?: Map + cache?: MapLike } export type MemoizableFunction = (this: T, ...args: A) => R