index.d.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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: whichTypedArray.TypedArray): whichTypedArray.TypedArrayName;
  19. declare function whichTypedArray(value: unknown): false | null;
  20. declare namespace whichTypedArray {
  21. export type TypedArrayName =
  22. | 'Int8Array'
  23. | 'Uint8Array'
  24. | 'Uint8ClampedArray'
  25. | 'Int16Array'
  26. | 'Uint16Array'
  27. | 'Int32Array'
  28. | 'Uint32Array'
  29. | 'Float32Array'
  30. | 'Float64Array'
  31. | 'BigInt64Array'
  32. | 'BigUint64Array';
  33. export type TypedArray =
  34. | Int8Array
  35. | Uint8Array
  36. | Uint8ClampedArray
  37. | Int16Array
  38. | Uint16Array
  39. | Int32Array
  40. | Uint32Array
  41. | Float32Array
  42. | Float64Array
  43. | BigInt64Array
  44. | BigUint64Array;
  45. export type TypedArrayConstructor =
  46. | Int8ArrayConstructor
  47. | Uint8ArrayConstructor
  48. | Uint8ClampedArrayConstructor
  49. | Int16ArrayConstructor
  50. | Uint16ArrayConstructor
  51. | Int32ArrayConstructor
  52. | Uint32ArrayConstructor
  53. | Float32ArrayConstructor
  54. | Float64ArrayConstructor
  55. | BigInt64ArrayConstructor
  56. | BigUint64ArrayConstructor;
  57. }
  58. export = whichTypedArray;