AK-21/Graphite-Industrial-Intelligence
0
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,10MERCHANTABILITY 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 lib="es2015.symbol" />18 19interface SymbolConstructor {20 /**21 * A method that returns the default iterator for an object. Called by the semantics of the22 * for-of statement.23 */24 readonly iterator: unique symbol;25}26 27interface IteratorYieldResult<TYield> {28 done?: false;29 value: TYield;30}31 32interface IteratorReturnResult<TReturn> {33 done: true;34 value: TReturn;35}36 37type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;38 39interface Iterator<T, TReturn = any, TNext = any> {40 // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.41 next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;42 return?(value?: TReturn): IteratorResult<T, TReturn>;43 throw?(e?: any): IteratorResult<T, TReturn>;44}45 46interface Iterable<T, TReturn = any, TNext = any> {47 [Symbol.iterator](): Iterator<T, TReturn, TNext>;48}49 50/**51 * Describes a user-defined {@link Iterator} that is also iterable.52 */53interface IterableIterator<T, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> {54 [Symbol.iterator](): IterableIterator<T, TReturn, TNext>;55}56 57/**58 * Describes an {@link Iterator} produced by the runtime that inherits from the intrinsic `Iterator.prototype`.59 */60interface IteratorObject<T, TReturn = unknown, TNext = unknown> extends Iterator<T, TReturn, TNext> {61 [Symbol.iterator](): IteratorObject<T, TReturn, TNext>;62}63 64/**65 * Defines the `TReturn` type used for built-in iterators produced by `Array`, `Map`, `Set`, and others.66 * This is `undefined` when `strictBuiltInIteratorReturn` is `true`; otherwise, this is `any`.67 */68type BuiltinIteratorReturn = intrinsic;69 70interface ArrayIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {71 [Symbol.iterator](): ArrayIterator<T>;72}73 74interface Array<T> {75 /** Iterator */76 [Symbol.iterator](): ArrayIterator<T>;77 78 /**79 * Returns an iterable of key, value pairs for every entry in the array80 */81 entries(): ArrayIterator<[number, T]>;82 83 /**84 * Returns an iterable of keys in the array85 */86 keys(): ArrayIterator<number>;87 88 /**89 * Returns an iterable of values in the array90 */91 values(): ArrayIterator<T>;92}93 94interface ArrayConstructor {95 /**96 * Creates an array from an iterable object.97 * @param iterable An iterable object to convert to an array.98 */99 from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];100 101 /**102 * Creates an array from an iterable object.103 * @param iterable An iterable object to convert to an array.104 * @param mapfn A mapping function to call on every element of the array.105 * @param thisArg Value of 'this' used to invoke the mapfn.106 */107 from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];108}109 110interface ReadonlyArray<T> {111 /** Iterator of values in the array. */112 [Symbol.iterator](): ArrayIterator<T>;113 114 /**115 * Returns an iterable of key, value pairs for every entry in the array116 */117 entries(): ArrayIterator<[number, T]>;118 119 /**120 * Returns an iterable of keys in the array121 */122 keys(): ArrayIterator<number>;123 124 /**125 * Returns an iterable of values in the array126 */127 values(): ArrayIterator<T>;128}129 130interface IArguments {131 /** Iterator */132 [Symbol.iterator](): ArrayIterator<any>;133}134 135interface MapIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {136 [Symbol.iterator](): MapIterator<T>;137}138 139interface Map<K, V> {140 /** Returns an iterable of entries in the map. */141 [Symbol.iterator](): MapIterator<[K, V]>;142 143 /**144 * Returns an iterable of key, value pairs for every entry in the map.145 */146 entries(): MapIterator<[K, V]>;147 148 /**149 * Returns an iterable of keys in the map150 */151 keys(): MapIterator<K>;152 153 /**154 * Returns an iterable of values in the map155 */156 values(): MapIterator<V>;157}158 159interface ReadonlyMap<K, V> {160 /** Returns an iterable of entries in the map. */161 [Symbol.iterator](): MapIterator<[K, V]>;162 163 /**164 * Returns an iterable of key, value pairs for every entry in the map.165 */166 entries(): MapIterator<[K, V]>;167 168 /**169 * Returns an iterable of keys in the map170 */171 keys(): MapIterator<K>;172 173 /**174 * Returns an iterable of values in the map175 */176 values(): MapIterator<V>;177}178 179interface MapConstructor {180 new (): Map<any, any>;181 new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;182}183 184interface WeakMap<K extends WeakKey, V> {}185 186interface WeakMapConstructor {187 new <K extends WeakKey = WeakKey, V = any>(iterable?: Iterable<readonly [K, V]> | null): WeakMap<K, V>;188}189 190interface SetIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {191 [Symbol.iterator](): SetIterator<T>;192}193 194interface Set<T> {195 /** Iterates over values in the set. */196 [Symbol.iterator](): SetIterator<T>;197 198 /**199 * Returns an iterable of [v,v] pairs for every value `v` in the set.200 */201 entries(): SetIterator<[T, T]>;202 203 /**204 * Despite its name, returns an iterable of the values in the set.205 */206 keys(): SetIterator<T>;207 208 /**209 * Returns an iterable of values in the set.210 */211 values(): SetIterator<T>;212}213 214interface ReadonlySet<T> {215 /** Iterates over values in the set. */216 [Symbol.iterator](): SetIterator<T>;217 218 /**219 * Returns an iterable of [v,v] pairs for every value `v` in the set.220 */221 entries(): SetIterator<[T, T]>;222 223 /**224 * Despite its name, returns an iterable of the values in the set.225 */226 keys(): SetIterator<T>;227 228 /**229 * Returns an iterable of values in the set.230 */231 values(): SetIterator<T>;232}233 234interface SetConstructor {235 new <T>(iterable?: Iterable<T> | null): Set<T>;236}237 238interface WeakSet<T extends WeakKey> {}239 240interface WeakSetConstructor {241 new <T extends WeakKey = WeakKey>(iterable: Iterable<T>): WeakSet<T>;242}243 244interface Promise<T> {}245 246interface PromiseConstructor {247 /**248 * Creates a Promise that is resolved with an array of results when all of the provided Promises249 * resolve, or rejected when any Promise is rejected.250 * @param values An iterable of Promises.251 * @returns A new Promise.252 */253 all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;254 255 /**256 * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved257 * or rejected.258 * @param values An iterable of Promises.259 * @returns A new Promise.260 */261 race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;262}263 264interface StringIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {265 [Symbol.iterator](): StringIterator<T>;266}267 268interface String {269 /** Iterator */270 [Symbol.iterator](): StringIterator<string>;271}272 273interface Int8Array<TArrayBuffer extends ArrayBufferLike> {274 [Symbol.iterator](): ArrayIterator<number>;275 276 /**277 * Returns an array of key, value pairs for every entry in the array278 */279 entries(): ArrayIterator<[number, number]>;280 281 /**282 * Returns an list of keys in the array283 */284 keys(): ArrayIterator<number>;285 286 /**287 * Returns an list of values in the array288 */289 values(): ArrayIterator<number>;290}291 292interface Int8ArrayConstructor {293 new (elements: Iterable<number>): Int8Array<ArrayBuffer>;294 295 /**296 * Creates an array from an array-like or iterable object.297 * @param elements An iterable object to convert to an array.298 */299 from(elements: Iterable<number>): Int8Array<ArrayBuffer>;300 301 /**302 * Creates an array from an array-like or iterable object.303 * @param elements An iterable object to convert to an array.304 * @param mapfn A mapping function to call on every element of the array.305 * @param thisArg Value of 'this' used to invoke the mapfn.306 */307 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int8Array<ArrayBuffer>;308}309 310interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {311 [Symbol.iterator](): ArrayIterator<number>;312 313 /**314 * Returns an array of key, value pairs for every entry in the array315 */316 entries(): ArrayIterator<[number, number]>;317 318 /**319 * Returns an list of keys in the array320 */321 keys(): ArrayIterator<number>;322 323 /**324 * Returns an list of values in the array325 */326 values(): ArrayIterator<number>;327}328 329interface Uint8ArrayConstructor {330 new (elements: Iterable<number>): Uint8Array<ArrayBuffer>;331 332 /**333 * Creates an array from an array-like or iterable object.334 * @param elements An iterable object to convert to an array.335 */336 from(elements: Iterable<number>): Uint8Array<ArrayBuffer>;337 338 /**339 * Creates an array from an array-like or iterable object.340 * @param elements An iterable object to convert to an array.341 * @param mapfn A mapping function to call on every element of the array.342 * @param thisArg Value of 'this' used to invoke the mapfn.343 */344 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;345}346 347interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike> {348 [Symbol.iterator](): ArrayIterator<number>;349 350 /**351 * Returns an array of key, value pairs for every entry in the array352 */353 entries(): ArrayIterator<[number, number]>;354 355 /**356 * Returns an list of keys in the array357 */358 keys(): ArrayIterator<number>;359 360 /**361 * Returns an list of values in the array362 */363 values(): ArrayIterator<number>;364}365 366interface Uint8ClampedArrayConstructor {367 new (elements: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;368 369 /**370 * Creates an array from an array-like or iterable object.371 * @param elements An iterable object to convert to an array.372 */373 from(elements: Iterable<number>): Uint8ClampedArray<ArrayBuffer>;374 375 /**376 * Creates an array from an array-like or iterable object.377 * @param elements An iterable object to convert to an array.378 * @param mapfn A mapping function to call on every element of the array.379 * @param thisArg Value of 'this' used to invoke the mapfn.380 */381 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray<ArrayBuffer>;382}383 384interface Int16Array<TArrayBuffer extends ArrayBufferLike> {385 [Symbol.iterator](): ArrayIterator<number>;386 /**387 * Returns an array of key, value pairs for every entry in the array388 */389 entries(): ArrayIterator<[number, number]>;390 391 /**392 * Returns an list of keys in the array393 */394 keys(): ArrayIterator<number>;395 396 /**397 * Returns an list of values in the array398 */399 values(): ArrayIterator<number>;400}401 402interface Int16ArrayConstructor {403 new (elements: Iterable<number>): Int16Array<ArrayBuffer>;404 405 /**406 * Creates an array from an array-like or iterable object.407 * @param elements An iterable object to convert to an array.408 */409 from(elements: Iterable<number>): Int16Array<ArrayBuffer>;410 411 /**412 * Creates an array from an array-like or iterable object.413 * @param elements An iterable object to convert to an array.414 * @param mapfn A mapping function to call on every element of the array.415 * @param thisArg Value of 'this' used to invoke the mapfn.416 */417 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int16Array<ArrayBuffer>;418}419 420interface Uint16Array<TArrayBuffer extends ArrayBufferLike> {421 [Symbol.iterator](): ArrayIterator<number>;422 423 /**424 * Returns an array of key, value pairs for every entry in the array425 */426 entries(): ArrayIterator<[number, number]>;427 428 /**429 * Returns an list of keys in the array430 */431 keys(): ArrayIterator<number>;432 433 /**434 * Returns an list of values in the array435 */436 values(): ArrayIterator<number>;437}438 439interface Uint16ArrayConstructor {440 new (elements: Iterable<number>): Uint16Array<ArrayBuffer>;441 442 /**443 * Creates an array from an array-like or iterable object.444 * @param elements An iterable object to convert to an array.445 */446 from(elements: Iterable<number>): Uint16Array<ArrayBuffer>;447 448 /**449 * Creates an array from an array-like or iterable object.450 * @param elements An iterable object to convert to an array.451 * @param mapfn A mapping function to call on every element of the array.452 * @param thisArg Value of 'this' used to invoke the mapfn.453 */454 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint16Array<ArrayBuffer>;455}456 457interface Int32Array<TArrayBuffer extends ArrayBufferLike> {458 [Symbol.iterator](): ArrayIterator<number>;459 460 /**461 * Returns an array of key, value pairs for every entry in the array462 */463 entries(): ArrayIterator<[number, number]>;464 465 /**466 * Returns an list of keys in the array467 */468 keys(): ArrayIterator<number>;469 470 /**471 * Returns an list of values in the array472 */473 values(): ArrayIterator<number>;474}475 476interface Int32ArrayConstructor {477 new (elements: Iterable<number>): Int32Array<ArrayBuffer>;478 479 /**480 * Creates an array from an array-like or iterable object.481 * @param elements An iterable object to convert to an array.482 */483 from(elements: Iterable<number>): Int32Array<ArrayBuffer>;484 485 /**486 * Creates an array from an array-like or iterable object.487 * @param elements An iterable object to convert to an array.488 * @param mapfn A mapping function to call on every element of the array.489 * @param thisArg Value of 'this' used to invoke the mapfn.490 */491 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Int32Array<ArrayBuffer>;492}493 494interface Uint32Array<TArrayBuffer extends ArrayBufferLike> {495 [Symbol.iterator](): ArrayIterator<number>;496 497 /**498 * Returns an array of key, value pairs for every entry in the array499 */500 entries(): ArrayIterator<[number, number]>;501 502 /**503 * Returns an list of keys in the array504 */505 keys(): ArrayIterator<number>;506 507 /**508 * Returns an list of values in the array509 */510 values(): ArrayIterator<number>;511}512 513interface Uint32ArrayConstructor {514 new (elements: Iterable<number>): Uint32Array<ArrayBuffer>;515 516 /**517 * Creates an array from an array-like or iterable object.518 * @param elements An iterable object to convert to an array.519 */520 from(elements: Iterable<number>): Uint32Array<ArrayBuffer>;521 522 /**523 * Creates an array from an array-like or iterable object.524 * @param elements An iterable object to convert to an array.525 * @param mapfn A mapping function to call on every element of the array.526 * @param thisArg Value of 'this' used to invoke the mapfn.527 */528 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint32Array<ArrayBuffer>;529}530 531interface Float32Array<TArrayBuffer extends ArrayBufferLike> {532 [Symbol.iterator](): ArrayIterator<number>;533 534 /**535 * Returns an array of key, value pairs for every entry in the array536 */537 entries(): ArrayIterator<[number, number]>;538 539 /**540 * Returns an list of keys in the array541 */542 keys(): ArrayIterator<number>;543 544 /**545 * Returns an list of values in the array546 */547 values(): ArrayIterator<number>;548}549 550interface Float32ArrayConstructor {551 new (elements: Iterable<number>): Float32Array<ArrayBuffer>;552 553 /**554 * Creates an array from an array-like or iterable object.555 * @param elements An iterable object to convert to an array.556 */557 from(elements: Iterable<number>): Float32Array<ArrayBuffer>;558 559 /**560 * Creates an array from an array-like or iterable object.561 * @param elements An iterable object to convert to an array.562 * @param mapfn A mapping function to call on every element of the array.563 * @param thisArg Value of 'this' used to invoke the mapfn.564 */565 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float32Array<ArrayBuffer>;566}567 568interface Float64Array<TArrayBuffer extends ArrayBufferLike> {569 [Symbol.iterator](): ArrayIterator<number>;570 571 /**572 * Returns an array of key, value pairs for every entry in the array573 */574 entries(): ArrayIterator<[number, number]>;575 576 /**577 * Returns an list of keys in the array578 */579 keys(): ArrayIterator<number>;580 581 /**582 * Returns an list of values in the array583 */584 values(): ArrayIterator<number>;585}586 587interface Float64ArrayConstructor {588 new (elements: Iterable<number>): Float64Array<ArrayBuffer>;589 590 /**591 * Creates an array from an array-like or iterable object.592 * @param elements An iterable object to convert to an array.593 */594 from(elements: Iterable<number>): Float64Array<ArrayBuffer>;595 596 /**597 * Creates an array from an array-like or iterable object.598 * @param elements An iterable object to convert to an array.599 * @param mapfn A mapping function to call on every element of the array.600 * @param thisArg Value of 'this' used to invoke the mapfn.601 */602 from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float64Array<ArrayBuffer>;603}604 