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
21/// <reference lib="es2015.symbol" />
22
23interface SymbolConstructor {
24    /**
25     * A method that determines if a constructor object recognizes an object as one of the
26     * constructor’s instances. Called by the semantics of the instanceof operator.
27     */
28    readonly hasInstance: symbol;
29
30    /**
31     * A Boolean value that if true indicates that an object should flatten to its array elements
32     * by Array.prototype.concat.
33     */
34    readonly isConcatSpreadable: symbol;
35
36    /**
37     * A regular expression method that matches the regular expression against a string. Called
38     * by the String.prototype.match method.
39     */
40    readonly match: symbol;
41
42    /**
43     * A regular expression method that replaces matched substrings of a string. Called by the
44     * String.prototype.replace method.
45     */
46    readonly replace: symbol;
47
48    /**
49     * A regular expression method that returns the index within a string that matches the
50     * regular expression. Called by the String.prototype.search method.
51     */
52    readonly search: symbol;
53
54    /**
55     * A function valued property that is the constructor function that is used to create
56     * derived objects.
57     */
58    readonly species: symbol;
59
60    /**
61     * A regular expression method that splits a string at the indices that match the regular
62     * expression. Called by the String.prototype.split method.
63     */
64    readonly split: symbol;
65
66    /**
67     * A method that converts an object to a corresponding primitive value.
68     * Called by the ToPrimitive abstract operation.
69     */
70    readonly toPrimitive: symbol;
71
72    /**
73     * A String value that is used in the creation of the default string description of an object.
74     * Called by the built-in method Object.prototype.toString.
75     */
76    readonly toStringTag: symbol;
77
78    /**
79     * An Object whose own property names are property names that are excluded from the 'with'
80     * environment bindings of the associated objects.
81     */
82    readonly unscopables: symbol;
83}
84
85interface Symbol {
86    readonly [Symbol.toStringTag]: string;
87}
88
89interface Array<T> {
90    /**
91     * Returns an object whose properties have the value 'true'
92     * when they will be absent when used in a 'with' statement.
93     */
94    [Symbol.unscopables](): {
95        copyWithin: boolean;
96        entries: boolean;
97        fill: boolean;
98        find: boolean;
99        findIndex: boolean;
100        keys: boolean;
101        values: boolean;
102    };
103}
104
105interface Date {
106    /**
107     * Converts a Date object to a string.
108     */
109    [Symbol.toPrimitive](hint: "default"): string;
110    /**
111     * Converts a Date object to a string.
112     */
113    [Symbol.toPrimitive](hint: "string"): string;
114    /**
115     * Converts a Date object to a number.
116     */
117    [Symbol.toPrimitive](hint: "number"): number;
118    /**
119     * Converts a Date object to a string or number.
120     *
121     * @param hint The strings "number", "string", or "default" to specify what primitive to return.
122     *
123     * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default".
124     * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default".
125     */
126    [Symbol.toPrimitive](hint: string): string | number;
127}
128
129interface Map<K, V> {
130    readonly [Symbol.toStringTag]: string;
131}
132
133interface WeakMap<K extends object, V> {
134    readonly [Symbol.toStringTag]: string;
135}
136
137interface Set<T> {
138    readonly [Symbol.toStringTag]: string;
139}
140
141interface WeakSet<T extends object> {
142    readonly [Symbol.toStringTag]: string;
143}
144
145interface JSON {
146    readonly [Symbol.toStringTag]: string;
147}
148
149interface Function {
150    /**
151     * Determines whether the given value inherits from this function if this function was used
152     * as a constructor function.
153     *
154     * A constructor function can control which objects are recognized as its instances by
155     * 'instanceof' by overriding this method.
156     */
157    [Symbol.hasInstance](value: any): boolean;
158}
159
160interface GeneratorFunction {
161    readonly [Symbol.toStringTag]: string;
162}
163
164interface Math {
165    readonly [Symbol.toStringTag]: string;
166}
167
168interface Promise<T> {
169    readonly [Symbol.toStringTag]: string;
170}
171
172interface PromiseConstructor {
173    readonly [Symbol.species]: PromiseConstructor;
174}
175
176interface RegExp {
177    /**
178     * Matches a string with this regular expression, and returns an array containing the results of
179     * that search.
180     * @param string A string to search within.
181     */
182    [Symbol.match](string: string): RegExpMatchArray | null;
183
184    /**
185     * Replaces text in a string, using this regular expression.
186     * @param string A String object or string literal whose contents matching against
187     *               this regular expression will be replaced
188     * @param replaceValue A String object or string literal containing the text to replace for every
189     *                     successful match of this regular expression.
190     */
191    [Symbol.replace](string: string, replaceValue: string): string;
192
193    /**
194     * Replaces text in a string, using this regular expression.
195     * @param string A String object or string literal whose contents matching against
196     *               this regular expression will be replaced
197     * @param replacer A function that returns the replacement text.
198     */
199    [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
200
201    /**
202     * Finds the position beginning first substring match in a regular expression search
203     * using this regular expression.
204     *
205     * @param string The string to search within.
206     */
207    [Symbol.search](string: string): number;
208
209    /**
210     * Returns an array of substrings that were delimited by strings in the original input that
211     * match against this regular expression.
212     *
213     * If the regular expression contains capturing parentheses, then each time this
214     * regular expression matches, the results (including any undefined results) of the
215     * capturing parentheses are spliced.
216     *
217     * @param string string value to split
218     * @param limit if not undefined, the output array is truncated so that it contains no more
219     * than 'limit' elements.
220     */
221    [Symbol.split](string: string, limit?: number): string[];
222}
223
224interface RegExpConstructor {
225    readonly [Symbol.species]: RegExpConstructor;
226}
227
228interface String {
229    /**
230     * Matches a string an object that supports being matched against, and returns an array containing the results of that search.
231     * @param matcher An object that supports being matched against.
232     */
233    match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;
234
235    /**
236     * Replaces text in a string, using an object that supports replacement within a string.
237     * @param searchValue A object can search for and replace matches within a string.
238     * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
239     */
240    replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;
241
242    /**
243     * Replaces text in a string, using an object that supports replacement within a string.
244     * @param searchValue A object can search for and replace matches within a string.
245     * @param replacer A function that returns the replacement text.
246     */
247    replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;
248
249    /**
250     * Finds the first substring match in a regular expression search.
251     * @param searcher An object which supports searching within a string.
252     */
253    search(searcher: { [Symbol.search](string: string): number; }): number;
254
255    /**
256     * Split a string into substrings using the specified separator and return them as an array.
257     * @param splitter An object that can split a string.
258     * @param limit A value used to limit the number of elements returned in the array.
259     */
260    split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];
261}
262
263interface ArrayBuffer {
264    readonly [Symbol.toStringTag]: string;
265}
266
267interface DataView {
268    readonly [Symbol.toStringTag]: string;
269}
270
271interface Int8Array {
272    readonly [Symbol.toStringTag]: "Int8Array";
273}
274
275interface Uint8Array {
276    readonly [Symbol.toStringTag]: "UInt8Array";
277}
278
279interface Uint8ClampedArray {
280    readonly [Symbol.toStringTag]: "Uint8ClampedArray";
281}
282
283interface Int16Array {
284    readonly [Symbol.toStringTag]: "Int16Array";
285}
286
287interface Uint16Array {
288    readonly [Symbol.toStringTag]: "Uint16Array";
289}
290
291interface Int32Array {
292    readonly [Symbol.toStringTag]: "Int32Array";
293}
294
295interface Uint32Array {
296    readonly [Symbol.toStringTag]: "Uint32Array";
297}
298
299interface Float32Array {
300    readonly [Symbol.toStringTag]: "Float32Array";
301}
302
303interface Float64Array {
304    readonly [Symbol.toStringTag]: "Float64Array";
305}
306
307interface ArrayConstructor {
308    readonly [Symbol.species]: ArrayConstructor;
309}
310interface MapConstructor {
311    readonly [Symbol.species]: MapConstructor;
312}
313interface SetConstructor {
314    readonly [Symbol.species]: SetConstructor;
315}
316interface ArrayBufferConstructor {
317    readonly [Symbol.species]: ArrayBufferConstructor;
318}