Matteo Scandolo | 5461a7c | 2017-08-08 13:05:24 -0700 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * Copyright 2017-present Open Networking Foundation |
| 4 | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | |
Matteo Scandolo | fc4b37b | 2017-02-02 12:18:47 -0800 | [diff] [blame] | 19 | // Generated by typings |
| 20 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts |
| 21 | declare type PropertyKey = string | number | symbol; |
| 22 | |
| 23 | interface IteratorResult<T> { |
| 24 | done: boolean; |
| 25 | value?: T; |
| 26 | } |
| 27 | |
| 28 | interface IterableShim<T> { |
| 29 | /** |
| 30 | * Shim for an ES6 iterable. Not intended for direct use by user code. |
| 31 | */ |
| 32 | "_es6-shim iterator_"(): Iterator<T>; |
| 33 | } |
| 34 | |
| 35 | interface Iterator<T> { |
| 36 | next(value?: any): IteratorResult<T>; |
| 37 | return?(value?: any): IteratorResult<T>; |
| 38 | throw?(e?: any): IteratorResult<T>; |
| 39 | } |
| 40 | |
| 41 | interface IterableIteratorShim<T> extends IterableShim<T>, Iterator<T> { |
| 42 | /** |
| 43 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code. |
| 44 | */ |
| 45 | "_es6-shim iterator_"(): IterableIteratorShim<T>; |
| 46 | } |
| 47 | |
| 48 | interface StringConstructor { |
| 49 | /** |
| 50 | * Return the String value whose elements are, in order, the elements in the List elements. |
| 51 | * If length is 0, the empty string is returned. |
| 52 | */ |
| 53 | fromCodePoint(...codePoints: number[]): string; |
| 54 | |
| 55 | /** |
| 56 | * String.raw is intended for use as a tag function of a Tagged Template String. When called |
| 57 | * as such the first argument will be a well formed template call site object and the rest |
| 58 | * parameter will contain the substitution values. |
| 59 | * @param template A well-formed template string call site representation. |
| 60 | * @param substitutions A set of substitution values. |
| 61 | */ |
| 62 | raw(template: TemplateStringsArray, ...substitutions: any[]): string; |
| 63 | } |
| 64 | |
| 65 | interface String { |
| 66 | /** |
| 67 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point |
| 68 | * value of the UTF-16 encoded code point starting at the string element at position pos in |
| 69 | * the String resulting from converting this object to a String. |
| 70 | * If there is no element at that position, the result is undefined. |
| 71 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. |
| 72 | */ |
| 73 | codePointAt(pos: number): number; |
| 74 | |
| 75 | /** |
| 76 | * Returns true if searchString appears as a substring of the result of converting this |
| 77 | * object to a String, at one or more positions that are |
| 78 | * greater than or equal to position; otherwise, returns false. |
| 79 | * @param searchString search string |
| 80 | * @param position If position is undefined, 0 is assumed, so as to search all of the String. |
| 81 | */ |
| 82 | includes(searchString: string, position?: number): boolean; |
| 83 | |
| 84 | /** |
| 85 | * Returns true if the sequence of elements of searchString converted to a String is the |
| 86 | * same as the corresponding elements of this object (converted to a String) starting at |
| 87 | * endPosition – length(this). Otherwise returns false. |
| 88 | */ |
| 89 | endsWith(searchString: string, endPosition?: number): boolean; |
| 90 | |
| 91 | /** |
| 92 | * Returns a String value that is made from count copies appended together. If count is 0, |
| 93 | * T is the empty String is returned. |
| 94 | * @param count number of copies to append |
| 95 | */ |
| 96 | repeat(count: number): string; |
| 97 | |
| 98 | /** |
| 99 | * Returns true if the sequence of elements of searchString converted to a String is the |
| 100 | * same as the corresponding elements of this object (converted to a String) starting at |
| 101 | * position. Otherwise returns false. |
| 102 | */ |
| 103 | startsWith(searchString: string, position?: number): boolean; |
| 104 | |
| 105 | /** |
| 106 | * Returns an <a> HTML anchor element and sets the name attribute to the text value |
| 107 | * @param name |
| 108 | */ |
| 109 | anchor(name: string): string; |
| 110 | |
| 111 | /** Returns a <big> HTML element */ |
| 112 | big(): string; |
| 113 | |
| 114 | /** Returns a <blink> HTML element */ |
| 115 | blink(): string; |
| 116 | |
| 117 | /** Returns a <b> HTML element */ |
| 118 | bold(): string; |
| 119 | |
| 120 | /** Returns a <tt> HTML element */ |
| 121 | fixed(): string |
| 122 | |
| 123 | /** Returns a <font> HTML element and sets the color attribute value */ |
| 124 | fontcolor(color: string): string |
| 125 | |
| 126 | /** Returns a <font> HTML element and sets the size attribute value */ |
| 127 | fontsize(size: number): string; |
| 128 | |
| 129 | /** Returns a <font> HTML element and sets the size attribute value */ |
| 130 | fontsize(size: string): string; |
| 131 | |
| 132 | /** Returns an <i> HTML element */ |
| 133 | italics(): string; |
| 134 | |
| 135 | /** Returns an <a> HTML element and sets the href attribute value */ |
| 136 | link(url: string): string; |
| 137 | |
| 138 | /** Returns a <small> HTML element */ |
| 139 | small(): string; |
| 140 | |
| 141 | /** Returns a <strike> HTML element */ |
| 142 | strike(): string; |
| 143 | |
| 144 | /** Returns a <sub> HTML element */ |
| 145 | sub(): string; |
| 146 | |
| 147 | /** Returns a <sup> HTML element */ |
| 148 | sup(): string; |
| 149 | |
| 150 | /** |
| 151 | * Shim for an ES6 iterable. Not intended for direct use by user code. |
| 152 | */ |
| 153 | "_es6-shim iterator_"(): IterableIteratorShim<string>; |
| 154 | } |
| 155 | |
| 156 | interface ArrayConstructor { |
| 157 | /** |
| 158 | * Creates an array from an array-like object. |
| 159 | * @param arrayLike An array-like object to convert to an array. |
| 160 | * @param mapfn A mapping function to call on every element of the array. |
| 161 | * @param thisArg Value of 'this' used to invoke the mapfn. |
| 162 | */ |
| 163 | from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>; |
| 164 | |
| 165 | /** |
| 166 | * Creates an array from an iterable object. |
| 167 | * @param iterable An iterable object to convert to an array. |
| 168 | * @param mapfn A mapping function to call on every element of the array. |
| 169 | * @param thisArg Value of 'this' used to invoke the mapfn. |
| 170 | */ |
| 171 | from<T, U>(iterable: IterableShim<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>; |
| 172 | |
| 173 | /** |
| 174 | * Creates an array from an array-like object. |
| 175 | * @param arrayLike An array-like object to convert to an array. |
| 176 | */ |
| 177 | from<T>(arrayLike: ArrayLike<T>): Array<T>; |
| 178 | |
| 179 | /** |
| 180 | * Creates an array from an iterable object. |
| 181 | * @param iterable An iterable object to convert to an array. |
| 182 | */ |
| 183 | from<T>(iterable: IterableShim<T>): Array<T>; |
| 184 | |
| 185 | /** |
| 186 | * Returns a new array from a set of elements. |
| 187 | * @param items A set of elements to include in the new array object. |
| 188 | */ |
| 189 | of<T>(...items: T[]): Array<T>; |
| 190 | } |
| 191 | |
| 192 | interface Array<T> { |
| 193 | /** |
| 194 | * Returns the value of the first element in the array where predicate is true, and undefined |
| 195 | * otherwise. |
| 196 | * @param predicate find calls predicate once for each element of the array, in ascending |
| 197 | * order, until it finds one where predicate returns true. If such an element is found, find |
| 198 | * immediately returns that element value. Otherwise, find returns undefined. |
| 199 | * @param thisArg If provided, it will be used as the this value for each invocation of |
| 200 | * predicate. If it is not provided, undefined is used instead. |
| 201 | */ |
| 202 | find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T; |
| 203 | |
| 204 | /** |
| 205 | * Returns the index of the first element in the array where predicate is true, and undefined |
| 206 | * otherwise. |
| 207 | * @param predicate find calls predicate once for each element of the array, in ascending |
| 208 | * order, until it finds one where predicate returns true. If such an element is found, find |
| 209 | * immediately returns that element value. Otherwise, find returns undefined. |
| 210 | * @param thisArg If provided, it will be used as the this value for each invocation of |
| 211 | * predicate. If it is not provided, undefined is used instead. |
| 212 | */ |
| 213 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number; |
| 214 | |
| 215 | /** |
| 216 | * Returns the this object after filling the section identified by start and end with value |
| 217 | * @param value value to fill array section with |
| 218 | * @param start index to start filling the array at. If start is negative, it is treated as |
| 219 | * length+start where length is the length of the array. |
| 220 | * @param end index to stop filling the array at. If end is negative, it is treated as |
| 221 | * length+end. |
| 222 | */ |
| 223 | fill(value: T, start?: number, end?: number): T[]; |
| 224 | |
| 225 | /** |
| 226 | * Returns the this object after copying a section of the array identified by start and end |
| 227 | * to the same array starting at position target |
| 228 | * @param target If target is negative, it is treated as length+target where length is the |
| 229 | * length of the array. |
| 230 | * @param start If start is negative, it is treated as length+start. If end is negative, it |
| 231 | * is treated as length+end. |
| 232 | * @param end If not specified, length of the this object is used as its default value. |
| 233 | */ |
| 234 | copyWithin(target: number, start: number, end?: number): T[]; |
| 235 | |
| 236 | /** |
| 237 | * Returns an array of key, value pairs for every entry in the array |
| 238 | */ |
| 239 | entries(): IterableIteratorShim<[number, T]>; |
| 240 | |
| 241 | /** |
| 242 | * Returns an list of keys in the array |
| 243 | */ |
| 244 | keys(): IterableIteratorShim<number>; |
| 245 | |
| 246 | /** |
| 247 | * Returns an list of values in the array |
| 248 | */ |
| 249 | values(): IterableIteratorShim<T>; |
| 250 | |
| 251 | /** |
| 252 | * Shim for an ES6 iterable. Not intended for direct use by user code. |
| 253 | */ |
| 254 | "_es6-shim iterator_"(): IterableIteratorShim<T>; |
| 255 | } |
| 256 | |
| 257 | interface NumberConstructor { |
| 258 | /** |
| 259 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 |
| 260 | * that is representable as a Number value, which is approximately: |
| 261 | * 2.2204460492503130808472633361816 x 10−16. |
| 262 | */ |
| 263 | EPSILON: number; |
| 264 | |
| 265 | /** |
| 266 | * Returns true if passed value is finite. |
| 267 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a |
| 268 | * number. Only finite values of the type number, result in true. |
| 269 | * @param number A numeric value. |
| 270 | */ |
| 271 | isFinite(number: number): boolean; |
| 272 | |
| 273 | /** |
| 274 | * Returns true if the value passed is an integer, false otherwise. |
| 275 | * @param number A numeric value. |
| 276 | */ |
| 277 | isInteger(number: number): boolean; |
| 278 | |
| 279 | /** |
| 280 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a |
| 281 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter |
| 282 | * to a number. Only values of the type number, that are also NaN, result in true. |
| 283 | * @param number A numeric value. |
| 284 | */ |
| 285 | isNaN(number: number): boolean; |
| 286 | |
| 287 | /** |
| 288 | * Returns true if the value passed is a safe integer. |
| 289 | * @param number A numeric value. |
| 290 | */ |
| 291 | isSafeInteger(number: number): boolean; |
| 292 | |
| 293 | /** |
| 294 | * The value of the largest integer n such that n and n + 1 are both exactly representable as |
| 295 | * a Number value. |
| 296 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. |
| 297 | */ |
| 298 | MAX_SAFE_INTEGER: number; |
| 299 | |
| 300 | /** |
| 301 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as |
| 302 | * a Number value. |
| 303 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). |
| 304 | */ |
| 305 | MIN_SAFE_INTEGER: number; |
| 306 | |
| 307 | /** |
| 308 | * Converts a string to a floating-point number. |
| 309 | * @param string A string that contains a floating-point number. |
| 310 | */ |
| 311 | parseFloat(string: string): number; |
| 312 | |
| 313 | /** |
| 314 | * Converts A string to an integer. |
| 315 | * @param s A string to convert into a number. |
| 316 | * @param radix A value between 2 and 36 that specifies the base of the number in numString. |
| 317 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. |
| 318 | * All other strings are considered decimal. |
| 319 | */ |
| 320 | parseInt(string: string, radix?: number): number; |
| 321 | } |
| 322 | |
| 323 | interface ObjectConstructor { |
| 324 | /** |
| 325 | * Copy the values of all of the enumerable own properties from one or more source objects to a |
| 326 | * target object. Returns the target object. |
| 327 | * @param target The target object to copy to. |
| 328 | * @param sources One or more source objects to copy properties from. |
| 329 | */ |
| 330 | assign(target: any, ...sources: any[]): any; |
| 331 | |
| 332 | /** |
| 333 | * Returns true if the values are the same value, false otherwise. |
| 334 | * @param value1 The first value. |
| 335 | * @param value2 The second value. |
| 336 | */ |
| 337 | is(value1: any, value2: any): boolean; |
| 338 | |
| 339 | /** |
| 340 | * Sets the prototype of a specified object o to object proto or null. Returns the object o. |
| 341 | * @param o The object to change its prototype. |
| 342 | * @param proto The value of the new prototype or null. |
| 343 | * @remarks Requires `__proto__` support. |
| 344 | */ |
| 345 | setPrototypeOf(o: any, proto: any): any; |
| 346 | } |
| 347 | |
| 348 | interface RegExp { |
| 349 | /** |
| 350 | * Returns a string indicating the flags of the regular expression in question. This field is read-only. |
| 351 | * The characters in this string are sequenced and concatenated in the following order: |
| 352 | * |
| 353 | * - "g" for global |
| 354 | * - "i" for ignoreCase |
| 355 | * - "m" for multiline |
| 356 | * - "u" for unicode |
| 357 | * - "y" for sticky |
| 358 | * |
| 359 | * If no flags are set, the value is the empty string. |
| 360 | */ |
| 361 | flags: string; |
| 362 | } |
| 363 | |
| 364 | interface Math { |
| 365 | /** |
| 366 | * Returns the number of leading zero bits in the 32-bit binary representation of a number. |
| 367 | * @param x A numeric expression. |
| 368 | */ |
| 369 | clz32(x: number): number; |
| 370 | |
| 371 | /** |
| 372 | * Returns the result of 32-bit multiplication of two numbers. |
| 373 | * @param x First number |
| 374 | * @param y Second number |
| 375 | */ |
| 376 | imul(x: number, y: number): number; |
| 377 | |
| 378 | /** |
| 379 | * Returns the sign of the x, indicating whether x is positive, negative or zero. |
| 380 | * @param x The numeric expression to test |
| 381 | */ |
| 382 | sign(x: number): number; |
| 383 | |
| 384 | /** |
| 385 | * Returns the base 10 logarithm of a number. |
| 386 | * @param x A numeric expression. |
| 387 | */ |
| 388 | log10(x: number): number; |
| 389 | |
| 390 | /** |
| 391 | * Returns the base 2 logarithm of a number. |
| 392 | * @param x A numeric expression. |
| 393 | */ |
| 394 | log2(x: number): number; |
| 395 | |
| 396 | /** |
| 397 | * Returns the natural logarithm of 1 + x. |
| 398 | * @param x A numeric expression. |
| 399 | */ |
| 400 | log1p(x: number): number; |
| 401 | |
| 402 | /** |
| 403 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of |
| 404 | * the natural logarithms). |
| 405 | * @param x A numeric expression. |
| 406 | */ |
| 407 | expm1(x: number): number; |
| 408 | |
| 409 | /** |
| 410 | * Returns the hyperbolic cosine of a number. |
| 411 | * @param x A numeric expression that contains an angle measured in radians. |
| 412 | */ |
| 413 | cosh(x: number): number; |
| 414 | |
| 415 | /** |
| 416 | * Returns the hyperbolic sine of a number. |
| 417 | * @param x A numeric expression that contains an angle measured in radians. |
| 418 | */ |
| 419 | sinh(x: number): number; |
| 420 | |
| 421 | /** |
| 422 | * Returns the hyperbolic tangent of a number. |
| 423 | * @param x A numeric expression that contains an angle measured in radians. |
| 424 | */ |
| 425 | tanh(x: number): number; |
| 426 | |
| 427 | /** |
| 428 | * Returns the inverse hyperbolic cosine of a number. |
| 429 | * @param x A numeric expression that contains an angle measured in radians. |
| 430 | */ |
| 431 | acosh(x: number): number; |
| 432 | |
| 433 | /** |
| 434 | * Returns the inverse hyperbolic sine of a number. |
| 435 | * @param x A numeric expression that contains an angle measured in radians. |
| 436 | */ |
| 437 | asinh(x: number): number; |
| 438 | |
| 439 | /** |
| 440 | * Returns the inverse hyperbolic tangent of a number. |
| 441 | * @param x A numeric expression that contains an angle measured in radians. |
| 442 | */ |
| 443 | atanh(x: number): number; |
| 444 | |
| 445 | /** |
| 446 | * Returns the square root of the sum of squares of its arguments. |
| 447 | * @param values Values to compute the square root for. |
| 448 | * If no arguments are passed, the result is +0. |
| 449 | * If there is only one argument, the result is the absolute value. |
| 450 | * If any argument is +Infinity or -Infinity, the result is +Infinity. |
| 451 | * If any argument is NaN, the result is NaN. |
| 452 | * If all arguments are either +0 or −0, the result is +0. |
| 453 | */ |
| 454 | hypot(...values: number[]): number; |
| 455 | |
| 456 | /** |
| 457 | * Returns the integral part of the a numeric expression, x, removing any fractional digits. |
| 458 | * If x is already an integer, the result is x. |
| 459 | * @param x A numeric expression. |
| 460 | */ |
| 461 | trunc(x: number): number; |
| 462 | |
| 463 | /** |
| 464 | * Returns the nearest single precision float representation of a number. |
| 465 | * @param x A numeric expression. |
| 466 | */ |
| 467 | fround(x: number): number; |
| 468 | |
| 469 | /** |
| 470 | * Returns an implementation-dependent approximation to the cube root of number. |
| 471 | * @param x A numeric expression. |
| 472 | */ |
| 473 | cbrt(x: number): number; |
| 474 | } |
| 475 | |
| 476 | interface PromiseLike<T> { |
| 477 | /** |
| 478 | * Attaches callbacks for the resolution and/or rejection of the Promise. |
| 479 | * @param onfulfilled The callback to execute when the Promise is resolved. |
| 480 | * @param onrejected The callback to execute when the Promise is rejected. |
| 481 | * @returns A Promise for the completion of which ever callback is executed. |
| 482 | */ |
| 483 | then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>; |
| 484 | then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>; |
| 485 | } |
| 486 | |
| 487 | /** |
| 488 | * Represents the completion of an asynchronous operation |
| 489 | */ |
| 490 | interface Promise<T> { |
| 491 | /** |
| 492 | * Attaches callbacks for the resolution and/or rejection of the Promise. |
| 493 | * @param onfulfilled The callback to execute when the Promise is resolved. |
| 494 | * @param onrejected The callback to execute when the Promise is rejected. |
| 495 | * @returns A Promise for the completion of which ever callback is executed. |
| 496 | */ |
| 497 | then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; |
| 498 | then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; |
| 499 | |
| 500 | /** |
| 501 | * Attaches a callback for only the rejection of the Promise. |
| 502 | * @param onrejected The callback to execute when the Promise is rejected. |
| 503 | * @returns A Promise for the completion of the callback. |
| 504 | */ |
| 505 | catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>; |
| 506 | catch(onrejected?: (reason: any) => void): Promise<T>; |
| 507 | } |
| 508 | |
| 509 | interface PromiseConstructor { |
| 510 | /** |
| 511 | * A reference to the prototype. |
| 512 | */ |
| 513 | prototype: Promise<any>; |
| 514 | |
| 515 | /** |
| 516 | * Creates a new Promise. |
| 517 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: |
| 518 | * a resolve callback used resolve the promise with a value or the result of another promise, |
| 519 | * and a reject callback used to reject the promise with a provided reason or error. |
| 520 | */ |
| 521 | new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>; |
| 522 | |
| 523 | /** |
| 524 | * Creates a Promise that is resolved with an array of results when all of the provided Promises |
| 525 | * resolve, or rejected when any Promise is rejected. |
| 526 | * @param values An array of Promises. |
| 527 | * @returns A new Promise. |
| 528 | */ |
| 529 | all<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T[]>; |
| 530 | |
| 531 | /** |
| 532 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved |
| 533 | * or rejected. |
| 534 | * @param values An array of Promises. |
| 535 | * @returns A new Promise. |
| 536 | */ |
| 537 | race<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T>; |
| 538 | |
| 539 | /** |
| 540 | * Creates a new rejected promise for the provided reason. |
| 541 | * @param reason The reason the promise was rejected. |
| 542 | * @returns A new rejected Promise. |
| 543 | */ |
| 544 | reject(reason: any): Promise<void>; |
| 545 | |
| 546 | /** |
| 547 | * Creates a new rejected promise for the provided reason. |
| 548 | * @param reason The reason the promise was rejected. |
| 549 | * @returns A new rejected Promise. |
| 550 | */ |
| 551 | reject<T>(reason: any): Promise<T>; |
| 552 | |
| 553 | /** |
| 554 | * Creates a new resolved promise for the provided value. |
| 555 | * @param value A promise. |
| 556 | * @returns A promise whose internal state matches the provided promise. |
| 557 | */ |
| 558 | resolve<T>(value: T | PromiseLike<T>): Promise<T>; |
| 559 | |
| 560 | /** |
| 561 | * Creates a new resolved promise . |
| 562 | * @returns A resolved promise. |
| 563 | */ |
| 564 | resolve(): Promise<void>; |
| 565 | } |
| 566 | |
| 567 | declare var Promise: PromiseConstructor; |
| 568 | |
| 569 | interface Map<K, V> { |
| 570 | clear(): void; |
| 571 | delete(key: K): boolean; |
| 572 | forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void; |
| 573 | get(key: K): V; |
| 574 | has(key: K): boolean; |
| 575 | set(key: K, value?: V): Map<K, V>; |
| 576 | size: number; |
| 577 | entries(): IterableIteratorShim<[K, V]>; |
| 578 | keys(): IterableIteratorShim<K>; |
| 579 | values(): IterableIteratorShim<V>; |
| 580 | } |
| 581 | |
| 582 | interface MapConstructor { |
| 583 | new <K, V>(): Map<K, V>; |
| 584 | new <K, V>(iterable: IterableShim<[K, V]>): Map<K, V>; |
| 585 | prototype: Map<any, any>; |
| 586 | } |
| 587 | |
| 588 | declare var Map: MapConstructor; |
| 589 | |
| 590 | interface Set<T> { |
| 591 | add(value: T): Set<T>; |
| 592 | clear(): void; |
| 593 | delete(value: T): boolean; |
| 594 | forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void; |
| 595 | has(value: T): boolean; |
| 596 | size: number; |
| 597 | entries(): IterableIteratorShim<[T, T]>; |
| 598 | keys(): IterableIteratorShim<T>; |
| 599 | values(): IterableIteratorShim<T>; |
| 600 | '_es6-shim iterator_'(): IterableIteratorShim<T>; |
| 601 | } |
| 602 | |
| 603 | interface SetConstructor { |
| 604 | new <T>(): Set<T>; |
| 605 | new <T>(iterable: IterableShim<T>): Set<T>; |
| 606 | prototype: Set<any>; |
| 607 | } |
| 608 | |
| 609 | declare var Set: SetConstructor; |
| 610 | |
| 611 | interface WeakMap<K, V> { |
| 612 | delete(key: K): boolean; |
| 613 | get(key: K): V; |
| 614 | has(key: K): boolean; |
| 615 | set(key: K, value?: V): WeakMap<K, V>; |
| 616 | } |
| 617 | |
| 618 | interface WeakMapConstructor { |
| 619 | new <K, V>(): WeakMap<K, V>; |
| 620 | new <K, V>(iterable: IterableShim<[K, V]>): WeakMap<K, V>; |
| 621 | prototype: WeakMap<any, any>; |
| 622 | } |
| 623 | |
| 624 | declare var WeakMap: WeakMapConstructor; |
| 625 | |
| 626 | interface WeakSet<T> { |
| 627 | add(value: T): WeakSet<T>; |
| 628 | delete(value: T): boolean; |
| 629 | has(value: T): boolean; |
| 630 | } |
| 631 | |
| 632 | interface WeakSetConstructor { |
| 633 | new <T>(): WeakSet<T>; |
| 634 | new <T>(iterable: IterableShim<T>): WeakSet<T>; |
| 635 | prototype: WeakSet<any>; |
| 636 | } |
| 637 | |
| 638 | declare var WeakSet: WeakSetConstructor; |
| 639 | |
| 640 | declare namespace Reflect { |
| 641 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any; |
| 642 | function construct(target: Function, argumentsList: ArrayLike<any>): any; |
| 643 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; |
| 644 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; |
| 645 | function enumerate(target: any): IterableIteratorShim<any>; |
| 646 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; |
| 647 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; |
| 648 | function getPrototypeOf(target: any): any; |
| 649 | function has(target: any, propertyKey: PropertyKey): boolean; |
| 650 | function isExtensible(target: any): boolean; |
| 651 | function ownKeys(target: any): Array<PropertyKey>; |
| 652 | function preventExtensions(target: any): boolean; |
| 653 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; |
| 654 | function setPrototypeOf(target: any, proto: any): boolean; |
| 655 | } |
| 656 | |
| 657 | declare module "es6-shim" { |
| 658 | var String: StringConstructor; |
| 659 | var Array: ArrayConstructor; |
| 660 | var Number: NumberConstructor; |
| 661 | var Math: Math; |
| 662 | var Object: ObjectConstructor; |
| 663 | var Map: MapConstructor; |
| 664 | var Set: SetConstructor; |
| 665 | var WeakMap: WeakMapConstructor; |
| 666 | var WeakSet: WeakSetConstructor; |
| 667 | var Promise: PromiseConstructor; |
| 668 | namespace Reflect { |
| 669 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any; |
| 670 | function construct(target: Function, argumentsList: ArrayLike<any>): any; |
| 671 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; |
| 672 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; |
| 673 | function enumerate(target: any): Iterator<any>; |
| 674 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; |
| 675 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; |
| 676 | function getPrototypeOf(target: any): any; |
| 677 | function has(target: any, propertyKey: PropertyKey): boolean; |
| 678 | function isExtensible(target: any): boolean; |
| 679 | function ownKeys(target: any): Array<PropertyKey>; |
| 680 | function preventExtensions(target: any): boolean; |
| 681 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; |
| 682 | function setPrototypeOf(target: any, proto: any): boolean; |
| 683 | } |
| 684 | } |