-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.d.ts
More file actions
44 lines (40 loc) · 1.91 KB
/
index.d.ts
File metadata and controls
44 lines (40 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Determines the type of the given collection, or returns false.
*
* @param {unknown} value The potential collection
* @returns {TypedArrayName | false | null} 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | false | null
*/
declare function whichTypedArray(value: Int8Array): 'Int8Array';
declare function whichTypedArray(value: Uint8Array): 'Uint8Array';
declare function whichTypedArray(value: Uint8ClampedArray): 'Uint8ClampedArray';
declare function whichTypedArray(value: Int16Array): 'Int16Array';
declare function whichTypedArray(value: Uint16Array): 'Uint16Array';
declare function whichTypedArray(value: Int32Array): 'Int32Array';
declare function whichTypedArray(value: Uint32Array): 'Uint32Array';
declare function whichTypedArray(value: Float16Array): 'Float16Array';
declare function whichTypedArray(value: Float32Array): 'Float32Array';
declare function whichTypedArray(value: Float64Array): 'Float64Array';
declare function whichTypedArray(value: Float16Array): 'Float16Array';
declare function whichTypedArray(value: BigInt64Array): 'BigInt64Array';
declare function whichTypedArray(value: BigUint64Array): 'BigUint64Array';
declare function whichTypedArray(value: whichTypedArray.TypedArray): whichTypedArray.TypedArrayName;
declare function whichTypedArray(value: unknown): false | null;
declare namespace whichTypedArray {
export type TypedArrayName = ReturnType<typeof import('available-typed-arrays')>[number];
export type TypedArray =
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float16Array
| Float32Array
| Float64Array
| Float16Array
| BigInt64Array
| BigUint64Array;
export type TypedArrayConstructor = typeof globalThis[TypedArrayName];
}
export = whichTypedArray;