diff options
Diffstat (limited to 'vanilla/node_modules/@exodus/bytes/array.d.ts')
| -rw-r--r-- | vanilla/node_modules/@exodus/bytes/array.d.ts | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/vanilla/node_modules/@exodus/bytes/array.d.ts b/vanilla/node_modules/@exodus/bytes/array.d.ts deleted file mode 100644 index c81d16f..0000000 --- a/vanilla/node_modules/@exodus/bytes/array.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * TypedArray utils and conversions. - * - * ```js - * import { typedView } from '@exodus/bytes/array.js' - * ``` - * - * @module @exodus/bytes/array.js - */ - -/// <reference types="node" /> - -// >= TypeScript 5.9 made Uint8Array templated with <> and defaulted to ArrayBufferLike -// which would incorrectly accept SharedArrayBuffer instances. -// < TypeScript 5.7 doesn't support templates for Uint8Array. -// So this type is defined as a workaround to evaluate to Uint8Array<ArrayBuffer> on all versions of TypeScript. - -/** - * This is `Uint8Array<ArrayBuffer>` - * (as opposed to `Uint8Array<SharedArrayBuffer>` and `Uint8Array<ArrayBufferLike>`) - * on TypeScript versions that support that distinction. - * - * On TypeScript < 5.7, this is just `Uint8Array`, as it's not a template there. - */ -export type Uint8ArrayBuffer = ReturnType<typeof Uint8Array.from>; - -/** - * This is `Uint16Array<ArrayBuffer>` - * (as opposed to `Uint16Array<SharedArrayBuffer>` and `Uint16Array<ArrayBufferLike>`) - * on TypeScript versions that support that distinction. - * - * On TypeScript < 5.7, this is just `Uint16Array`, as it's not a template there. - */ -export type Uint16ArrayBuffer = ReturnType<typeof Uint16Array.from>; - -/** - * This is `Uint32Array<ArrayBuffer>` - * (as opposed to `Uint32Array<SharedArrayBuffer>` and `Uint32Array<ArrayBufferLike>`) - * on TypeScript versions that support that distinction. - * - * On TypeScript < 5.7, this is just `Uint32Array`, as it's not a template there. - */ -export type Uint32ArrayBuffer = ReturnType<typeof Uint32Array.from>; - -/** - * Output format for typed array conversions - */ -export type OutputFormat = 'uint8' | 'buffer'; - -/** - * Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`) - * - * > [!IMPORTANT] - * > Does not copy data, returns a view on the same underlying buffer - * - * @param arr - The input TypedArray - * @param format - The desired output format (`'uint8'` or `'buffer'`) - * @returns A view on the same underlying buffer - */ -export function typedView(arr: ArrayBufferView, format: 'uint8'): Uint8Array; -export function typedView(arr: ArrayBufferView, format: 'buffer'): Buffer; -export function typedView(arr: ArrayBufferView, format: OutputFormat): Uint8Array | Buffer; |
