CoolFace
Apppublic

Pinsave/counterstrike

sourceHugging Faceupdated 3mo agoView on Hugging Face
1likes
lib.esnext.float16.d.ts444 linesDownload Raw Back to lib
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/// <reference lib="es2015.iterable" />21 22/**23 * A typed array of 16-bit float values. The contents are initialized to 0. If the requested number24 * of bytes could not be allocated an exception is raised.25 */26interface Float16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {27    /**28     * The size in bytes of each element in the array.29     */30    readonly BYTES_PER_ELEMENT: number;31 32    /**33     * The ArrayBuffer instance referenced by the array.34     */35    readonly buffer: TArrayBuffer;36 37    /**38     * The length in bytes of the array.39     */40    readonly byteLength: number;41 42    /**43     * The offset in bytes of the array.44     */45    readonly byteOffset: number;46 47    /**48     * Returns the item located at the specified index.49     * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.50     */51    at(index: number): number | undefined;52 53    /**54     * Returns the this object after copying a section of the array identified by start and end55     * to the same array starting at position target56     * @param target If target is negative, it is treated as length+target where length is the57     * length of the array.58     * @param start If start is negative, it is treated as length+start. If end is negative, it59     * is treated as length+end.60     * @param end If not specified, length of the this object is used as its default value.61     */62    copyWithin(target: number, start: number, end?: number): this;63 64    /**65     * Determines whether all the members of an array satisfy the specified test.66     * @param predicate A function that accepts up to three arguments. The every method calls67     * the predicate function for each element in the array until the predicate returns a value68     * which is coercible to the Boolean value false, or until the end of the array.69     * @param thisArg An object to which the this keyword can refer in the predicate function.70     * If thisArg is omitted, undefined is used as the this value.71     */72    every(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): boolean;73 74    /**75     * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array76     * @param value value to fill array section with77     * @param start index to start filling the array at. If start is negative, it is treated as78     * length+start where length is the length of the array.79     * @param end index to stop filling the array at. If end is negative, it is treated as80     * length+end.81     */82    fill(value: number, start?: number, end?: number): this;83 84    /**85     * Returns the elements of an array that meet the condition specified in a callback function.86     * @param predicate A function that accepts up to three arguments. The filter method calls87     * the predicate function one time for each element in the array.88     * @param thisArg An object to which the this keyword can refer in the predicate function.89     * If thisArg is omitted, undefined is used as the this value.90     */91    filter(predicate: (value: number, index: number, array: this) => any, thisArg?: any): Float16Array<ArrayBuffer>;92 93    /**94     * Returns the value of the first element in the array where predicate is true, and undefined95     * otherwise.96     * @param predicate find calls predicate once for each element of the array, in ascending97     * order, until it finds one where predicate returns true. If such an element is found, find98     * immediately returns that element value. Otherwise, find returns undefined.99     * @param thisArg If provided, it will be used as the this value for each invocation of100     * predicate. If it is not provided, undefined is used instead.101     */102    find(predicate: (value: number, index: number, obj: this) => boolean, thisArg?: any): number | undefined;103 104    /**105     * Returns the index of the first element in the array where predicate is true, and -1106     * otherwise.107     * @param predicate find calls predicate once for each element of the array, in ascending108     * order, until it finds one where predicate returns true. If such an element is found,109     * findIndex immediately returns that element index. Otherwise, findIndex returns -1.110     * @param thisArg If provided, it will be used as the this value for each invocation of111     * predicate. If it is not provided, undefined is used instead.112     */113    findIndex(predicate: (value: number, index: number, obj: this) => boolean, thisArg?: any): number;114 115    /**116     * Returns the value of the last element in the array where predicate is true, and undefined117     * otherwise.118     * @param predicate findLast calls predicate once for each element of the array, in descending119     * order, until it finds one where predicate returns true. If such an element is found, findLast120     * immediately returns that element value. Otherwise, findLast returns undefined.121     * @param thisArg If provided, it will be used as the this value for each invocation of122     * predicate. If it is not provided, undefined is used instead.123     */124    findLast<S extends number>(125        predicate: (126            value: number,127            index: number,128            array: this,129        ) => value is S,130        thisArg?: any,131    ): S | undefined;132    findLast(133        predicate: (134            value: number,135            index: number,136            array: this,137        ) => unknown,138        thisArg?: any,139    ): number | undefined;140 141    /**142     * Returns the index of the last element in the array where predicate is true, and -1143     * otherwise.144     * @param predicate findLastIndex calls predicate once for each element of the array, in descending145     * order, until it finds one where predicate returns true. If such an element is found,146     * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.147     * @param thisArg If provided, it will be used as the this value for each invocation of148     * predicate. If it is not provided, undefined is used instead.149     */150    findLastIndex(151        predicate: (152            value: number,153            index: number,154            array: this,155        ) => unknown,156        thisArg?: any,157    ): number;158 159    /**160     * Performs the specified action for each element in an array.161     * @param callbackfn A function that accepts up to three arguments. forEach calls the162     * callbackfn function one time for each element in the array.163     * @param thisArg An object to which the this keyword can refer in the callbackfn function.164     * If thisArg is omitted, undefined is used as the this value.165     */166    forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;167 168    /**169     * Determines whether an array includes a certain element, returning true or false as appropriate.170     * @param searchElement The element to search for.171     * @param fromIndex The position in this array at which to begin searching for searchElement.172     */173    includes(searchElement: number, fromIndex?: number): boolean;174 175    /**176     * Returns the index of the first occurrence of a value in an array.177     * @param searchElement The value to locate in the array.178     * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the179     * search starts at index 0.180     */181    indexOf(searchElement: number, fromIndex?: number): number;182 183    /**184     * Adds all the elements of an array separated by the specified separator string.185     * @param separator A string used to separate one element of an array from the next in the186     * resulting String. If omitted, the array elements are separated with a comma.187     */188    join(separator?: string): string;189 190    /**191     * Returns the index of the last occurrence of a value in an array.192     * @param searchElement The value to locate in the array.193     * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the194     * search starts at index 0.195     */196    lastIndexOf(searchElement: number, fromIndex?: number): number;197 198    /**199     * The length of the array.200     */201    readonly length: number;202 203    /**204     * Calls a defined callback function on each element of an array, and returns an array that205     * contains the results.206     * @param callbackfn A function that accepts up to three arguments. The map method calls the207     * callbackfn function one time for each element in the array.208     * @param thisArg An object to which the this keyword can refer in the callbackfn function.209     * If thisArg is omitted, undefined is used as the this value.210     */211    map(callbackfn: (value: number, index: number, array: this) => number, thisArg?: any): Float16Array<ArrayBuffer>;212 213    /**214     * Calls the specified callback function for all the elements in an array. The return value of215     * the callback function is the accumulated result, and is provided as an argument in the next216     * call to the callback function.217     * @param callbackfn A function that accepts up to four arguments. The reduce method calls the218     * callbackfn function one time for each element in the array.219     * @param initialValue If initialValue is specified, it is used as the initial value to start220     * the accumulation. The first call to the callbackfn function provides this value as an argument221     * instead of an array value.222     */223    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number): number;224    reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number, initialValue: number): number;225 226    /**227     * Calls the specified callback function for all the elements in an array. The return value of228     * the callback function is the accumulated result, and is provided as an argument in the next229     * call to the callback function.230     * @param callbackfn A function that accepts up to four arguments. The reduce method calls the231     * callbackfn function one time for each element in the array.232     * @param initialValue If initialValue is specified, it is used as the initial value to start233     * the accumulation. The first call to the callbackfn function provides this value as an argument234     * instead of an array value.235     */236    reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U, initialValue: U): U;237 238    /**239     * Calls the specified callback function for all the elements in an array, in descending order.240     * The return value of the callback function is the accumulated result, and is provided as an241     * argument in the next call to the callback function.242     * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls243     * the callbackfn function one time for each element in the array.244     * @param initialValue If initialValue is specified, it is used as the initial value to start245     * the accumulation. The first call to the callbackfn function provides this value as an246     * argument instead of an array value.247     */248    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number): number;249    reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number, initialValue: number): number;250 251    /**252     * Calls the specified callback function for all the elements in an array, in descending order.253     * The return value of the callback function is the accumulated result, and is provided as an254     * argument in the next call to the callback function.255     * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls256     * the callbackfn function one time for each element in the array.257     * @param initialValue If initialValue is specified, it is used as the initial value to start258     * the accumulation. The first call to the callbackfn function provides this value as an argument259     * instead of an array value.260     */261    reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U, initialValue: U): U;262 263    /**264     * Reverses the elements in an Array.265     */266    reverse(): this;267 268    /**269     * Sets a value or an array of values.270     * @param array A typed or untyped array of values to set.271     * @param offset The index in the current array at which the values are to be written.272     */273    set(array: ArrayLike<number>, offset?: number): void;274 275    /**276     * Returns a section of an array.277     * @param start The beginning of the specified portion of the array.278     * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.279     */280    slice(start?: number, end?: number): Float16Array<ArrayBuffer>;281 282    /**283     * Determines whether the specified callback function returns true for any element of an array.284     * @param predicate A function that accepts up to three arguments. The some method calls285     * the predicate function for each element in the array until the predicate returns a value286     * which is coercible to the Boolean value true, or until the end of the array.287     * @param thisArg An object to which the this keyword can refer in the predicate function.288     * If thisArg is omitted, undefined is used as the this value.289     */290    some(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): boolean;291 292    /**293     * Sorts an array.294     * @param compareFn Function used to determine the order of the elements. It is expected to return295     * a negative value if first argument is less than second argument, zero if they're equal and a positive296     * value otherwise. If omitted, the elements are sorted in ascending order.297     * ```ts298     * [11,2,22,1].sort((a, b) => a - b)299     * ```300     */301    sort(compareFn?: (a: number, b: number) => number): this;302 303    /**304     * Gets a new Float16Array view of the ArrayBuffer store for this array, referencing the elements305     * at begin, inclusive, up to end, exclusive.306     * @param begin The index of the beginning of the array.307     * @param end The index of the end of the array.308     */309    subarray(begin?: number, end?: number): Float16Array<TArrayBuffer>;310 311    /**312     * Converts a number to a string by using the current locale.313     */314    toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;315 316    /**317     * Copies the array and returns the copy with the elements in reverse order.318     */319    toReversed(): Float16Array<ArrayBuffer>;320 321    /**322     * Copies and sorts the array.323     * @param compareFn Function used to determine the order of the elements. It is expected to return324     * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive325     * value otherwise. If omitted, the elements are sorted in ascending order.326     * ```ts327     * const myNums = Float16Array.from([11.25, 2, -22.5, 1]);328     * myNums.toSorted((a, b) => a - b) // Float16Array(4) [-22.5, 1, 2, 11.5]329     * ```330     */331    toSorted(compareFn?: (a: number, b: number) => number): Float16Array<ArrayBuffer>;332 333    /**334     * Returns a string representation of an array.335     */336    toString(): string;337 338    /** Returns the primitive value of the specified object. */339    valueOf(): this;340 341    /**342     * Copies the array and inserts the given number at the provided index.343     * @param index The index of the value to overwrite. If the index is344     * negative, then it replaces from the end of the array.345     * @param value The value to insert into the copied array.346     * @returns A copy of the original array with the inserted value.347     */348    with(index: number, value: number): Float16Array<ArrayBuffer>;349 350    [index: number]: number;351 352    [Symbol.iterator](): ArrayIterator<number>;353 354    /**355     * Returns an array of key, value pairs for every entry in the array356     */357    entries(): ArrayIterator<[number, number]>;358 359    /**360     * Returns an list of keys in the array361     */362    keys(): ArrayIterator<number>;363 364    /**365     * Returns an list of values in the array366     */367    values(): ArrayIterator<number>;368 369    readonly [Symbol.toStringTag]: "Float16Array";370}371 372interface Float16ArrayConstructor {373    readonly prototype: Float16Array<ArrayBufferLike>;374    new (length?: number): Float16Array<ArrayBuffer>;375    new (array: ArrayLike<number> | Iterable<number>): Float16Array<ArrayBuffer>;376    new <TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(buffer: TArrayBuffer, byteOffset?: number, length?: number): Float16Array<TArrayBuffer>;377 378    /**379     * The size in bytes of each element in the array.380     */381    readonly BYTES_PER_ELEMENT: number;382 383    /**384     * Returns a new array from a set of elements.385     * @param items A set of elements to include in the new array object.386     */387    of(...items: number[]): Float16Array<ArrayBuffer>;388 389    /**390     * Creates an array from an array-like or iterable object.391     * @param arrayLike An array-like object to convert to an array.392     */393    from(arrayLike: ArrayLike<number>): Float16Array<ArrayBuffer>;394 395    /**396     * Creates an array from an array-like or iterable object.397     * @param arrayLike An array-like object to convert to an array.398     * @param mapfn A mapping function to call on every element of the array.399     * @param thisArg Value of 'this' used to invoke the mapfn.400     */401    from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Float16Array<ArrayBuffer>;402 403    /**404     * Creates an array from an array-like or iterable object.405     * @param elements An iterable object to convert to an array.406     */407    from(elements: Iterable<number>): Float16Array<ArrayBuffer>;408 409    /**410     * Creates an array from an array-like or iterable object.411     * @param elements An iterable object to convert to an array.412     * @param mapfn A mapping function to call on every element of the array.413     * @param thisArg Value of 'this' used to invoke the mapfn.414     */415    from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Float16Array<ArrayBuffer>;416}417declare var Float16Array: Float16ArrayConstructor;418 419interface Math {420    /**421     * Returns the nearest half precision float representation of a number.422     * @param x A numeric expression.423     */424    f16round(x: number): number;425}426 427interface DataView<TArrayBuffer extends ArrayBufferLike> {428    /**429     * Gets the Float16 value at the specified byte offset from the start of the view. There is430     * no alignment constraint; multi-byte values may be fetched from any offset.431     * @param byteOffset The place in the buffer at which the value should be retrieved.432     * @param littleEndian If false or undefined, a big-endian value should be read.433     */434    getFloat16(byteOffset: number, littleEndian?: boolean): number;435 436    /**437     * Stores an Float16 value at the specified byte offset from the start of the view.438     * @param byteOffset The place in the buffer at which the value should be set.439     * @param value The value to set.440     * @param littleEndian If false or undefined, a big-endian value should be written.441     */442    setFloat16(byteOffset: number, value: number, littleEndian?: boolean): void;443}444