1interface Map<K, V> { 2 3 clear(): void; 4 /** 5 * @returns true if an element in the Map existed and has been removed, or false if the element does not exist. 6 */ 7 delete(key: K): boolean; 8 /** 9 * Executes a provided function once per each key/value pair in the Map, in insertion order. 10 */ 11 forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void; 12 /** 13 * Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map. 14 * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned. 15 */ 16 get(key: K): V | undefined; 17 /** 18 * @returns boolean indicating whether an element with the specified key exists or not. 19 */ 20 has(key: K): boolean; 21 /** 22 * Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated. 23 */ 24 set(key: K, value: V): this; 25 /** 26 * @returns the number of elements in the Map. 27 */ 28 readonly size: number; 29} 30 31interface MapConstructor { 32 new(): Map<any, any>; 33 new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>; 34 readonly prototype: Map<any, any>; 35} 36declare var Map: MapConstructor; 37 38interface ReadonlyMap<K, V> { 39 forEach(callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void; 40 get(key: K): V | undefined; 41 has(key: K): boolean; 42 readonly size: number; 43} 44 45interface WeakMap<K extends object, V> { 46 /** 47 * Removes the specified element from the WeakMap. 48 * @returns true if the element was successfully removed, or false if it was not present. 49 */ 50 delete(key: K): boolean; 51 /** 52 * @returns a specified element. 53 */ 54 get(key: K): V | undefined; 55 /** 56 * @returns a boolean indicating whether an element with the specified key exists or not. 57 */ 58 has(key: K): boolean; 59 /** 60 * Adds a new element with a specified key and value. 61 * @param key Must be an object. 62 */ 63 set(key: K, value: V): this; 64} 65 66interface WeakMapConstructor { 67 new <K extends object = object, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>; 68 readonly prototype: WeakMap<object, any>; 69} 70declare var WeakMap: WeakMapConstructor; 71 72interface Set<T> { 73 /** 74 * Appends a new element with a specified value to the end of the Set. 75 */ 76 add(value: T): this; 77 78 clear(): void; 79 /** 80 * Removes a specified value from the Set. 81 * @returns Returns true if an element in the Set existed and has been removed, or false if the element does not exist. 82 */ 83 delete(value: T): boolean; 84 /** 85 * Executes a provided function once per each value in the Set object, in insertion order. 86 */ 87 forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void; 88 /** 89 * @returns a boolean indicating whether an element with the specified value exists in the Set or not. 90 */ 91 has(value: T): boolean; 92 /** 93 * @returns the number of (unique) elements in Set. 94 */ 95 readonly size: number; 96} 97 98interface SetConstructor { 99 new <T = any>(values?: readonly T[] | null): Set<T>; 100 readonly prototype: Set<any>; 101} 102declare var Set: SetConstructor; 103 104interface ReadonlySet<T> { 105 forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void; 106 has(value: T): boolean; 107 readonly size: number; 108} 109 110interface WeakSet<T extends object> { 111 /** 112 * Appends a new object to the end of the WeakSet. 113 */ 114 add(value: T): this; 115 /** 116 * Removes the specified element from the WeakSet. 117 * @returns Returns true if the element existed and has been removed, or false if the element does not exist. 118 */ 119 delete(value: T): boolean; 120 /** 121 * @returns a boolean indicating whether an object exists in the WeakSet or not. 122 */ 123 has(value: T): boolean; 124} 125 126interface WeakSetConstructor { 127 new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>; 128 readonly prototype: WeakSet<object>; 129} 130declare var WeakSet: WeakSetConstructor; 131