diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 864450b1bd..554fe76668 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -127,21 +127,21 @@ declare module "../index" { * @param key The key of the value to remove. * @return Returns `true` if the entry was removed successfully, else `false`. */ - delete(key: string): boolean; + delete(key: any): boolean; /** * Gets the cached value for `key`. * @param key The key of the value to get. * @return Returns the cached value. */ - get(key: string): any; + get(key: any): any; /** * Checks if a cached value for `key` exists. * @param key The key of the entry to check. * @return Returns `true` if an entry for `key` exists, else `false`. */ - has(key: string): boolean; + has(key: any): boolean; /** * Sets `value` to `key` of the cache. @@ -154,7 +154,7 @@ declare module "../index" { /** * Removes all key-value entries from the map. */ - clear(): void; + clear?: () => void; } interface MapCacheConstructor { new (): MapCache; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 0515136714..3ce044165a 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -3484,6 +3484,11 @@ fp.now(); // $ExpectType number // $ExpectType MapCache new _.memoize.Cache(); + _.memoize.Cache = WeakMap; + _.memoize.Cache = Map; + const memoizedFn = _.memoize(memoizeFn); + memoizedFn.cache = new WeakMap(); + memoizedFn.cache = new Map(); } // _.overArgs