index.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * Determines the type of the given collection, or returns false.
  3. *
  4. * @param {unknown} value The potential collection
  5. * @returns {TypedArrayName | false | null} 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | false | null
  6. */
  7. declare function whichTypedArray(value: Int8Array): 'Int8Array';
  8. declare function whichTypedArray(value: Uint8Array): 'Uint8Array';
  9. declare function whichTypedArray(value: Uint8ClampedArray): 'Uint8ClampedArray';
  10. declare function whichTypedArray(value: Int16Array): 'Int16Array';
  11. declare function whichTypedArray(value: Uint16Array): 'Uint16Array';
  12. declare function whichTypedArray(value: Int32Array): 'Int32Array';
  13. declare function whichTypedArray(value: Uint32Array): 'Uint32Array';
  14. declare function whichTypedArray(value: Float32Array): 'Float32Array';
  15. declare function whichTypedArray(value: Float64Array): 'Float64Array';
  16. declare function whichTypedArray(value: BigInt64Array): 'BigInt64Array';
  17. declare function whichTypedArray(value: BigUint64Array): 'BigUint64Array';
  18. declare function whichTypedArray(value: unknown): false | null;
  19. declare namespace whichTypedArray {
  20. type TypedArrayName =
  21. | 'Int8Array'
  22. | 'Uint8Array'
  23. | 'Uint8ClampedArray'
  24. | 'Int16Array'
  25. | 'Uint16Array'
  26. | 'Int32Array'
  27. | 'Uint32Array'
  28. | 'Float32Array'
  29. | 'Float64Array'
  30. | 'BigInt64Array'
  31. | 'BigUint64Array';
  32. type TypedArray =
  33. | Int8Array
  34. | Uint8Array
  35. | Uint8ClampedArray
  36. | Int16Array
  37. | Uint16Array
  38. | Int32Array
  39. | Uint32Array
  40. | Float32Array
  41. | Float64Array
  42. | BigInt64Array
  43. | BigUint64Array;
  44. type TypedArrayConstructor =
  45. | Int8ArrayConstructor
  46. | Uint8ArrayConstructor
  47. | Uint8ClampedArrayConstructor
  48. | Int16ArrayConstructor
  49. | Uint16ArrayConstructor
  50. | Int32ArrayConstructor
  51. | Uint32ArrayConstructor
  52. | Float32ArrayConstructor
  53. | Float64ArrayConstructor
  54. | BigInt64ArrayConstructor
  55. | BigUint64ArrayConstructor;
  56. }
  57. export = whichTypedArray;