Skip to content

Latest commit

 

History

History
100 lines (92 loc) · 3.07 KB

es2015.collection.d.ts.md

File metadata and controls

100 lines (92 loc) · 3.07 KB

es2015.collection.d.ts Diffs

Index: es2015.collection.d.ts
===================================================================
--- es2015.collection.d.ts
+++ es2015.collection.d.ts
@@ -6,11 +6,11 @@
   delete(key: K): boolean;
   /**
    * Executes a provided function once per each key/value pair in the Map, in insertion order.
    */
-  forEach(
-    callbackfn: (value: V, key: K, map: Map<K, V>) => void,
-    thisArg?: any,
+  forEach<This = undefined>(
+    callbackfn: (this: This, value: V, key: K, map: this) => void,
+    thisArg?: This,
   ): void;
   /**
    * 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.
    * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
@@ -30,18 +30,17 @@
   readonly size: number;
 }
 
 interface MapConstructor {
-  new (): Map<any, any>;
   new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
-  readonly prototype: Map<any, any>;
+  readonly prototype: Map<unknown, unknown>;
 }
 declare var Map: MapConstructor;
 
 interface ReadonlyMap<K, V> {
-  forEach(
-    callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void,
-    thisArg?: any,
+  forEach<This = undefined>(
+    callbackfn: (this: This, value: V, key: K, map: this) => void,
+    thisArg?: This,
   ): void;
   get(key: K): V | undefined;
   has(key: K): boolean;
   readonly size: number;
@@ -68,12 +67,12 @@
   set(key: K, value: V): this;
 }
 
 interface WeakMapConstructor {
-  new <K extends WeakKey = WeakKey, V = any>(
+  new <K extends WeakKey, V>(
     entries?: readonly (readonly [K, V])[] | null,
   ): WeakMap<K, V>;
-  readonly prototype: WeakMap<WeakKey, any>;
+  readonly prototype: WeakMap<WeakKey, unknown>;
 }
 declare var WeakMap: WeakMapConstructor;
 
 interface Set<T> {
@@ -90,11 +89,11 @@
   delete(value: T): boolean;
   /**
    * Executes a provided function once per each value in the Set object, in insertion order.
    */
-  forEach(
-    callbackfn: (value: T, value2: T, set: Set<T>) => void,
-    thisArg?: any,
+  forEach<This = undefined>(
+    callbackfn: (this: This, value: T, value2: T, set: this) => void,
+    thisArg?: This,
   ): void;
   /**
    * @returns a boolean indicating whether an element with the specified value exists in the Set or not.
    */
@@ -105,17 +104,17 @@
   readonly size: number;
 }
 
 interface SetConstructor {
-  new <T = any>(values?: readonly T[] | null): Set<T>;
-  readonly prototype: Set<any>;
+  new <T>(values?: readonly T[] | null): Set<T>;
+  readonly prototype: Set<unknown>;
 }
 declare var Set: SetConstructor;
 
 interface ReadonlySet<T> {
-  forEach(
-    callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void,
-    thisArg?: any,
+  forEach<This = undefined>(
+    callbackfn: (this: This, value: T, value2: T, set: this) => void,
+    thisArg?: This,
   ): void;
   has(value: T): boolean;
   readonly size: number;
 }