UNPKG

mock-violentmonkey

Version:

Mock violentmonkey's globals for testing userscripts

22 lines (21 loc) 737 B
declare class BetterMap<K, V> extends Map<K, V> { /** * @param getDefaultValue Return the value associated with the key. * If that value does not exist it sets the result of `getDefaultValue()` and returns that. */ get: { (key: K): V | undefined; (key: K, getDefaultValue: () => V): V; }; } declare class BetterWeakMap<K extends object | symbol, V> extends WeakMap<K, V> { /** * @param getDefaultValue Return the value associated with the key. * If that value does not exist it sets the result of `getDefaultValue()` and returns that. */ get: { (key: K): V | undefined; (key: K, getDefaultValue: () => V): V; }; } export { BetterMap, BetterWeakMap };