mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
feat: support WeakMap’s in lodash memoize.Cache
This commit is contained in:
Vendored
+4
-4
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user