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 /** 87 * Converts a Symbol object to a symbol. 88 */ 89 [Symbol.toPrimitive](hint: string): symbol; 90 91 readonly [Symbol.toStringTag]: string; 92} 93 94interface Array<T> { 95 /** 96 * Returns an object whose properties have the value 'true' 97 * when they will be absent when used in a 'with' statement. 98 */ 99 [Symbol.unscopables](): { 100 copyWithin: boolean; 101 entries: boolean; 102 fill: boolean; 103 find: boolean; 104 findIndex: boolean; 105 keys: boolean; 106 values: boolean; 107 }; 108} 109 110interface Date { 111 /** 112 * Converts a Date object to a string. 113 */ 114 [Symbol.toPrimitive](hint: "default"): string; 115 /** 116 * Converts a Date object to a string. 117 */ 118 [Symbol.toPrimitive](hint: "string"): string; 119 /** 120 * Converts a Date object to a number. 121 */ 122 [Symbol.toPrimitive](hint: "number"): number; 123 /** 124 * Converts a Date object to a string or number. 125 * 126 * @param hint The strings "number", "string", or "default" to specify what primitive to return. 127 * 128 * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". 129 * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". 130 */ 131 [Symbol.toPrimitive](hint: string): string | number; 132} 133 134interface Map<K, V> { 135 readonly [Symbol.toStringTag]: string; 136} 137 138interface WeakMap<K extends object, V> { 139 readonly [Symbol.toStringTag]: string; 140} 141 142interface Set<T> { 143 readonly [Symbol.toStringTag]: string; 144} 145 146interface WeakSet<T extends object> { 147 readonly [Symbol.toStringTag]: string; 148} 149 150interface JSON { 151 readonly [Symbol.toStringTag]: string; 152} 153 154interface Function { 155 /** 156 * Determines whether the given value inherits from this function if this function was used 157 * as a constructor function. 158 * 159 * A constructor function can control which objects are recognized as its instances by 160 * 'instanceof' by overriding this method. 161 */ 162 [Symbol.hasInstance](value: any): boolean; 163} 164 165interface GeneratorFunction { 166 readonly [Symbol.toStringTag]: string; 167} 168 169interface Math { 170 readonly [Symbol.toStringTag]: string; 171} 172 173interface Promise<T> { 174 readonly [Symbol.toStringTag]: string; 175} 176 177interface PromiseConstructor { 178 readonly [Symbol.species]: PromiseConstructor; 179} 180 181interface RegExp { 182 /** 183 * Matches a string with this regular expression, and returns an array containing the results of 184 * that search. 185 * @param string A string to search within. 186 */ 187 [Symbol.match](string: string): RegExpMatchArray | null; 188 189 /** 190 * Replaces text in a string, using this regular expression. 191 * @param string A String object or string literal whose contents matching against 192 * this regular expression will be replaced 193 * @param replaceValue A String object or string literal containing the text to replace for every 194 * successful match of this regular expression. 195 */ 196 [Symbol.replace](string: string, replaceValue: string): string; 197 198 /** 199 * Replaces text in a string, using this regular expression. 200 * @param string A String object or string literal whose contents matching against 201 * this regular expression will be replaced 202 * @param replacer A function that returns the replacement text. 203 */ 204 [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; 205 206 /** 207 * Finds the position beginning first substring match in a regular expression search 208 * using this regular expression. 209 * 210 * @param string The string to search within. 211 */ 212 [Symbol.search](string: string): number; 213 214 /** 215 * Returns an array of substrings that were delimited by strings in the original input that 216 * match against this regular expression. 217 * 218 * If the regular expression contains capturing parentheses, then each time this 219 * regular expression matches, the results (including any undefined results) of the 220 * capturing parentheses are spliced. 221 * 222 * @param string string value to split 223 * @param limit if not undefined, the output array is truncated so that it contains no more 224 * than 'limit' elements. 225 */ 226 [Symbol.split](string: string, limit?: number): string[]; 227} 228 229interface RegExpConstructor { 230 readonly [Symbol.species]: RegExpConstructor; 231} 232 233interface String { 234 /** 235 * Matches a string or an object that supports being matched against, and returns an array 236 * containing the results of that search, or null if no matches are found. 237 * @param matcher An object that supports being matched against. 238 */ 239 match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; 240 241 /** 242 * Replaces text in a string, using an object that supports replacement within a string. 243 * @param searchValue A object can search for and replace matches within a string. 244 * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. 245 */ 246 replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; 247 248 /** 249 * Replaces text in a string, using an object that supports replacement within a string. 250 * @param searchValue A object can search for and replace matches within a string. 251 * @param replacer A function that returns the replacement text. 252 */ 253 replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; 254 255 /** 256 * Finds the first substring match in a regular expression search. 257 * @param searcher An object which supports searching within a string. 258 */ 259 search(searcher: { [Symbol.search](string: string): number; }): number; 260 261 /** 262 * Split a string into substrings using the specified separator and return them as an array. 263 * @param splitter An object that can split a string. 264 * @param limit A value used to limit the number of elements returned in the array. 265 */ 266 split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; 267} 268 269interface ArrayBuffer { 270 readonly [Symbol.toStringTag]: string; 271} 272 273interface DataView { 274 readonly [Symbol.toStringTag]: string; 275} 276 277interface Int8Array { 278 readonly [Symbol.toStringTag]: "Int8Array"; 279} 280 281interface Uint8Array { 282 readonly [Symbol.toStringTag]: "Uint8Array"; 283} 284 285interface Uint8ClampedArray { 286 readonly [Symbol.toStringTag]: "Uint8ClampedArray"; 287} 288 289interface Int16Array { 290 readonly [Symbol.toStringTag]: "Int16Array"; 291} 292 293interface Uint16Array { 294 readonly [Symbol.toStringTag]: "Uint16Array"; 295} 296 297interface Int32Array { 298 readonly [Symbol.toStringTag]: "Int32Array"; 299} 300 301interface Uint32Array { 302 readonly [Symbol.toStringTag]: "Uint32Array"; 303} 304 305interface Float32Array { 306 readonly [Symbol.toStringTag]: "Float32Array"; 307} 308 309interface Float64Array { 310 readonly [Symbol.toStringTag]: "Float64Array"; 311} 312 313interface ArrayConstructor { 314 readonly [Symbol.species]: ArrayConstructor; 315} 316interface MapConstructor { 317 readonly [Symbol.species]: MapConstructor; 318} 319interface SetConstructor { 320 readonly [Symbol.species]: SetConstructor; 321} 322interface ArrayBufferConstructor { 323 readonly [Symbol.species]: ArrayBufferConstructor; 324} 325