UNPKG

2.9 kBTypeScriptView Raw
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation. All rights reserved.
3Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4this file except in compliance with the License. You may obtain a copy of the
5License at http://www.apache.org/licenses/LICENSE-2.0
6
7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10MERCHANTABLITY OR NON-INFRINGEMENT.
11
12See the Apache Version 2.0 License for specific language governing permissions
13and limitations under the License.
14***************************************************************************** */
15
16
17
18/// <reference no-default-lib="true"/>
19
20
21interface Map<K, V> {
22 clear(): void;
23 delete(key: K): boolean;
24 forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
25 get(key: K): V | undefined;
26 has(key: K): boolean;
27 set(key: K, value: V): this;
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 delete(key: K): boolean;
47 get(key: K): V | undefined;
48 has(key: K): boolean;
49 set(key: K, value: V): this;
50}
51
52interface WeakMapConstructor {
53 new <K extends object = object, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
54 readonly prototype: WeakMap<object, any>;
55}
56declare var WeakMap: WeakMapConstructor;
57
58interface Set<T> {
59 add(value: T): this;
60 clear(): void;
61 delete(value: T): boolean;
62 forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
63 has(value: T): boolean;
64 readonly size: number;
65}
66
67interface SetConstructor {
68 new <T = any>(values?: readonly T[] | null): Set<T>;
69 readonly prototype: Set<any>;
70}
71declare var Set: SetConstructor;
72
73interface ReadonlySet<T> {
74 forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;
75 has(value: T): boolean;
76 readonly size: number;
77}
78
79interface WeakSet<T extends object> {
80 add(value: T): this;
81 delete(value: T): boolean;
82 has(value: T): boolean;
83}
84
85interface WeakSetConstructor {
86 new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>;
87 readonly prototype: WeakSet<object>;
88}
89declare var WeakSet: WeakSetConstructor;