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