Pinsave/counterstrike
1
1/*! *****************************************************************************2Copyright (c) Microsoft Corporation. All rights reserved.3Licensed under the Apache License, Version 2.0 (the "License"); you may not use4this file except in compliance with the License. You may obtain a copy of the5License at http://www.apache.org/licenses/LICENSE-2.06 7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED9WARRANTIES 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 permissions13and limitations under the License.14***************************************************************************** */15 16 17/// <reference no-default-lib="true"/>18 19/// <reference lib="es2015.symbol" />20 21interface SymbolConstructor {22 /**23 * A method that returns the default iterator for an object. Called by the semantics of the24 * for-of statement.25 */26 readonly iterator: unique symbol;27}28 29interface IteratorYieldResult<TYield> {30 done?: false;31 value: TYield;32}33 34interface IteratorReturnResult<TReturn> {35 done: true;36 value: TReturn;37}38 39type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;40 41interface Iterator<T, TReturn = any, TNext = any> {42 // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.43 next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;44 return?(value?: TReturn): IteratorResult<T, TReturn>;45 throw?(e?: any): IteratorResult<T, TReturn>;46}47 48interface Iterable<T, TReturn = any, TNext = any> {49 [Symbol.iterator](): Iterator<T, TReturn, TNext>;50}51 52/**53 * Describes a user-defined {@link Iterator} that is also iterable.54 */55interface IterableIterator<T, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> {56 [Symbol.iterator](): IterableIterator<T, TReturn, TNext>;57}58 59/**60 * Describes an {@link Iterator} produced by the runtime that inherits from the intrinsic `Iterator.prototype`.61 */62interface IteratorObject<T, TReturn = unknown, TNext = unknown> extends Iterator<T, TReturn, TNext> {63 [Symbol.iterator](): IteratorObject<T, TReturn, TNext>;64}65 66/**67 * Defines the `TReturn` type used for built-in iterators produced by `Array`, `Map`, `Set`, and others.68 * This is `undefined` when `strictBuiltInIteratorReturn` is `true`; otherwise, this is `any`.69 */70type BuiltinIteratorReturn = intrinsic;71 72interface ArrayIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {73 [Symbol.iterator](): ArrayIterator<T>;74}75 76interface Array<T> {77 /** Iterator */78 [Symbol.iterator](): ArrayIterator<T>;79 80 /**81 * Returns an iterable of key, value pairs for every entry in the array82 */83 entries(): ArrayIterator<[number, T]>;84 85 /**86 * Returns an iterable of keys in the array87 */88 keys(): ArrayIterator<number>;89 90 /**91 * Returns an iterable of values in the array92 */93 values(): ArrayIterator<T>;94}95 96interface ArrayConstructor {97 /**98 * Creates an array from an iterable object.99 * @param iterable An iterable object to convert to an array.100 */101 from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];102 103 /**104 * Creates an array from an iterable object.105 * @param iterable An iterable object to convert to an array.106 * @param mapfn A mapping function to call on every element of the array.107 * @param thisArg Value of 'this' used to invoke the mapfn.108 */109 from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];110}111 112interface ReadonlyArray<T> {113 /** Iterator of values in the array. */114 [Symbol.iterator](): ArrayIterator<T>;115 116 /**117 * Returns an iterable of key, value pairs for every entry in the array118 */119 entries(): ArrayIterator<[number, T]>;120 121 /**122 * Returns an iterable of keys in the array123 */124 keys(): ArrayIterator<number>;125 126 /**127 * Returns an iterable of values in the array128 */129 values(): ArrayIterator<T>;130}131 132interface IArguments {133 /** Iterator */134 [Symbol.iterator](): ArrayIterator<any>;135}136 137interface MapIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {138 [Symbol.iterator](): MapIterator<T>;139}140 141interface Map<K, V> {142 /** Returns an iterable of entries in the map. */143 [Symbol.iterator](): MapIterator<[K, V]>;144 145 /**146 * Returns an iterable of key, value pairs for every entry in the map.147 */148 entries(): MapIterator<[K, V]>;149 150 /**151 * Returns an iterable of keys in the map152 */153 keys(): MapIterator<K>;154 155 /**156 * Returns an iterable of values in the map157 */158 values(): MapIterator<V>;159}160 161interface ReadonlyMap<K, V> {162 /** Returns an iterable of entries in the map. */163 [Symbol.iterator](): MapIterator<[K, V]>;164 165 /**166 * Returns an iterable of key, value pairs for every entry in the map.167 */168 entries(): MapIterator<[K, V]>;169 170 /**171 * Returns an iterable of keys in the map172 */173 keys(): MapIterator<K>;174 175 /**176 * Returns an iterable of values in the map177 */178 values(): MapIterator<V>;179}180 181interface MapConstructor {182 new (): Map<any, any>;183 new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;184}185 186interface WeakMap<K extends WeakKey, V> {}187 188interface WeakMapConstructor {189 new <K extends WeakKey, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;190}191 192interface SetIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {193 [Symbol.iterator](): SetIterator<T>;194}195 196interface Set<T> {197 /** Iterates over values in the set. */198 [Symbol.iterator](): SetIterator<T>;199 200 /**201 * Returns an iterable of [v,v] pairs for every value `v` in the set.202 */203 entries(): SetIterator<[T, T]>;204 205 /**206 * Despite its name, returns an iterable of the values in the set.207 */208 keys(): SetIterator<T>;209 210 /**211 * Returns an iterable of values in the set.212 */213 values(): SetIterator<T>;214}215 216interface ReadonlySet<T> {217 /** Iterates over values in the set. */218 [Symbol.iterator](): SetIterator<T>;219 220 /**221 * Returns an iterable of [v,v] pairs for every value `v` in the set.222 */223 entries(): SetIterator<[T, T]>;224 225 /**226 * Despite its name, returns an iterable of the values in the set.227 */228 keys(): SetIterator<T>;229 230 /**231 * Returns an iterable of values in the set.232 */233 values(): SetIterator<T>;234}235 236interface SetConstructor {237 new <T>(iterable?: Iterable<T> | null): Set<T>;238}239 240interface WeakSet<T extends WeakKey> {}241 242interface WeakSetConstructor {243 new <T extends WeakKey = WeakKey>(iterable: Iterable<T>): WeakSet<T>;244}245 246interface Promise<T> {}247 248interface PromiseConstructor {249 /**250 * Creates a Promise that is resolved with an array of results when all of the provided Promises251 * resolve, or rejected when any Promise is rejected.252 * @param values An iterable of Promises.253 * @returns A new Promise.254 */255 all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;256 257 /**258 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved259 * or rejected.260 * @param values An iterable of Promises.261 * @returns A new Promise.262 */263 race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;264}265 266interface StringIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {267 [Symbol.iterator](): StringIterator<T>;268}269 270interface String {271 /** Iterator */272 [Symbol.iterator](): StringIterator<string>;273}274 275interface Int8Array<TArrayBuffer extends ArrayBufferLike> {276 [Symbol.iterator](): ArrayIterator<number>;277 278 /**279 * Returns an array of key, value pairs for every entry in the array280 */281 entries(): ArrayIterator<[number, number]>;282 283 /**284 * Returns an list of keys in the array285 */286 keys(): ArrayIterator<number>;287 288 /**289 * Returns an list of values in the array290 */291 values(): ArrayIterator<number>;292}293 294interface Int8ArrayConstructor {295 new (elements: Iterable<number>): Int8Array<ArrayBuffer>;296 297 /**298 * Creates an array from an array-like or iterable object.299 * @param elements An iterable object to convert to an array.300 */301 from(elements: Iterable<number>): Int8Array<ArrayBuffer>;302 303 /**304 * Creates an array from an array-like or iterable object.305 * @param elements An iterable object to convert to an array.306 * @param mapfn A mapping function to call on every element of the array.307 * @param thisArg Value of 'this' used to invoke the mapfn.308 */309 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int8Array<ArrayBuffer>;310}311 312interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {313 [Symbol.iterator](): ArrayIterator<number>;314 315 /**316 * Returns an array of key, value pairs for every entry in the array317 */318 entries(): ArrayIterator<[number, number]>;319 320 /**321 * Returns an list of keys in the array322 */323 keys(): ArrayIterator<number>;324 325 /**326 * Returns an list of values in the array327 */328 values(): ArrayIterator<number>;329}330 331interface Uint8ArrayConstructor {332 new (elements: Iterable<number>): Uint8Array<ArrayBuffer>;333 334 /**335 * Creates an array from an array-like or iterable object.336 * @param elements An iterable object to convert to an array.337 */338 from(elements: Iterable<number>): Uint8Array<ArrayBuffer>;339 340 /**341 * Creates an array from an array-like or iterable object.342 * @param elements An iterable object to convert to an array.343 * @param mapfn A mapping function to call on every element of the array.344 * @param thisArg Value of 'this' used to invoke the mapfn.345 */346 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;347}348 349interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {350 [Symbol.iterator](): ArrayIterator<number>;351 352 /**353 * Returns an array of key, value pairs for every entry in the array354 */355 entries(): ArrayIterator<[number, number]>;356 357 /**358 * Returns an list of keys in the array359 */360 keys(): ArrayIterator<number>;361 362 /**363 * Returns an list of values in the array364 */365 values(): ArrayIterator<number>;366}367 368interface Uint8ClampedArrayConstructor {369 new (elements: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;370 371 /**372 * Creates an array from an array-like or iterable object.373 * @param elements An iterable object to convert to an array.374 */375 from(elements: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;376 377 /**378 * Creates an array from an array-like or iterable object.379 * @param elements An iterable object to convert to an array.380 * @param mapfn A mapping function to call on every element of the array.381 * @param thisArg Value of 'this' used to invoke the mapfn.382 */383 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray<ArrayBuffer>;384}385 386interface Int16Array<TArrayBuffer extends ArrayBufferLike> {387 [Symbol.iterator](): ArrayIterator<number>;388 /**389 * Returns an array of key, value pairs for every entry in the array390 */391 entries(): ArrayIterator<[number, number]>;392 393 /**394 * Returns an list of keys in the array395 */396 keys(): ArrayIterator<number>;397 398 /**399 * Returns an list of values in the array400 */401 values(): ArrayIterator<number>;402}403 404interface Int16ArrayConstructor {405 new (elements: Iterable<number>): Int16Array<ArrayBuffer>;406 407 /**408 * Creates an array from an array-like or iterable object.409 * @param elements An iterable object to convert to an array.410 */411 from(elements: Iterable<number>): Int16Array<ArrayBuffer>;412 413 /**414 * Creates an array from an array-like or iterable object.415 * @param elements An iterable object to convert to an array.416 * @param mapfn A mapping function to call on every element of the array.417 * @param thisArg Value of 'this' used to invoke the mapfn.418 */419 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int16Array<ArrayBuffer>;420}421 422interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {423 [Symbol.iterator](): ArrayIterator<number>;424 425 /**426 * Returns an array of key, value pairs for every entry in the array427 */428 entries(): ArrayIterator<[number, number]>;429 430 /**431 * Returns an list of keys in the array432 */433 keys(): ArrayIterator<number>;434 435 /**436 * Returns an list of values in the array437 */438 values(): ArrayIterator<number>;439}440 441interface Uint16ArrayConstructor {442 new (elements: Iterable<number>): Uint16Array<ArrayBuffer>;443 444 /**445 * Creates an array from an array-like or iterable object.446 * @param elements An iterable object to convert to an array.447 */448 from(elements: Iterable<number>): Uint16Array<ArrayBuffer>;449 450 /**451 * Creates an array from an array-like or iterable object.452 * @param elements An iterable object to convert to an array.453 * @param mapfn A mapping function to call on every element of the array.454 * @param thisArg Value of 'this' used to invoke the mapfn.455 */456 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint16Array<ArrayBuffer>;457}458 459interface Int32Array<TArrayBuffer extends ArrayBufferLike> {460 [Symbol.iterator](): ArrayIterator<number>;461 462 /**463 * Returns an array of key, value pairs for every entry in the array464 */465 entries(): ArrayIterator<[number, number]>;466 467 /**468 * Returns an list of keys in the array469 */470 keys(): ArrayIterator<number>;471 472 /**473 * Returns an list of values in the array474 */475 values(): ArrayIterator<number>;476}477 478interface Int32ArrayConstructor {479 new (elements: Iterable<number>): Int32Array<ArrayBuffer>;480 481 /**482 * Creates an array from an array-like or iterable object.483 * @param elements An iterable object to convert to an array.484 */485 from(elements: Iterable<number>): Int32Array<ArrayBuffer>;486 487 /**488 * Creates an array from an array-like or iterable object.489 * @param elements An iterable object to convert to an array.490 * @param mapfn A mapping function to call on every element of the array.491 * @param thisArg Value of 'this' used to invoke the mapfn.492 */493 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int32Array<ArrayBuffer>;494}495 496interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {497 [Symbol.iterator](): ArrayIterator<number>;498 499 /**500 * Returns an array of key, value pairs for every entry in the array501 */502 entries(): ArrayIterator<[number, number]>;503 504 /**505 * Returns an list of keys in the array506 */507 keys(): ArrayIterator<number>;508 509 /**510 * Returns an list of values in the array511 */512 values(): ArrayIterator<number>;513}514 515interface Uint32ArrayConstructor {516 new (elements: Iterable<number>): Uint32Array<ArrayBuffer>;517 518 /**519 * Creates an array from an array-like or iterable object.520 * @param elements An iterable object to convert to an array.521 */522 from(elements: Iterable<number>): Uint32Array<ArrayBuffer>;523 524 /**525 * Creates an array from an array-like or iterable object.526 * @param elements An iterable object to convert to an array.527 * @param mapfn A mapping function to call on every element of the array.528 * @param thisArg Value of 'this' used to invoke the mapfn.529 */530 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint32Array<ArrayBuffer>;531}532 533interface Float32Array<TArrayBuffer extends ArrayBufferLike> {534 [Symbol.iterator](): ArrayIterator<number>;535 536 /**537 * Returns an array of key, value pairs for every entry in the array538 */539 entries(): ArrayIterator<[number, number]>;540 541 /**542 * Returns an list of keys in the array543 */544 keys(): ArrayIterator<number>;545 546 /**547 * Returns an list of values in the array548 */549 values(): ArrayIterator<number>;550}551 552interface Float32ArrayConstructor {553 new (elements: Iterable<number>): Float32Array<ArrayBuffer>;554 555 /**556 * Creates an array from an array-like or iterable object.557 * @param elements An iterable object to convert to an array.558 */559 from(elements: Iterable<number>): Float32Array<ArrayBuffer>;560 561 /**562 * Creates an array from an array-like or iterable object.563 * @param elements An iterable object to convert to an array.564 * @param mapfn A mapping function to call on every element of the array.565 * @param thisArg Value of 'this' used to invoke the mapfn.566 */567 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float32Array<ArrayBuffer>;568}569 570interface Float64Array<TArrayBuffer extends ArrayBufferLike> {571 [Symbol.iterator](): ArrayIterator<number>;572 573 /**574 * Returns an array of key, value pairs for every entry in the array575 */576 entries(): ArrayIterator<[number, number]>;577 578 /**579 * Returns an list of keys in the array580 */581 keys(): ArrayIterator<number>;582 583 /**584 * Returns an list of values in the array585 */586 values(): ArrayIterator<number>;587}588 589interface Float64ArrayConstructor {590 new (elements: Iterable<number>): Float64Array<ArrayBuffer>;591 592 /**593 * Creates an array from an array-like or iterable object.594 * @param elements An iterable object to convert to an array.595 */596 from(elements: Iterable<number>): Float64Array<ArrayBuffer>;597 598 /**599 * Creates an array from an array-like or iterable object.600 * @param elements An iterable object to convert to an array.601 * @param mapfn A mapping function to call on every element of the array.602 * @param thisArg Value of 'this' used to invoke the mapfn.603 */604 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float64Array<ArrayBuffer>;605}606 