diff --git a/src/data-types/array-buffer.ts b/src/data-types/array-buffer.ts index e55b263..1c0ebb2 100644 --- a/src/data-types/array-buffer.ts +++ b/src/data-types/array-buffer.ts @@ -21,7 +21,7 @@ export const assertArrayBuffer = (input: unknown) => * @group ArrayBuffer */ export function arrayBufferToBlob( - arrayBuffer: ArrayBufferLike, + arrayBuffer: ArrayBuffer, options?: BlobPropertyBag, ): Blob { assertArrayBuffer(arrayBuffer); @@ -69,7 +69,7 @@ export function arrayBufferToReadableStream( * @group ArrayBuffer */ export function arrayBufferToResponse( - arrayBuffer: ArrayBufferLike, + arrayBuffer: ArrayBuffer, init?: ResponseInit, ): Response { assertArrayBuffer(arrayBuffer); @@ -80,7 +80,7 @@ export function arrayBufferToResponse( * Convert from [ArrayBuffer][ArrayBuffer] to [String][String] * @group ArrayBuffer */ -export function arrayBufferToString(arrayBuffer: ArrayBufferLike): string { +export function arrayBufferToString(arrayBuffer: ArrayBuffer): string { assertArrayBuffer(arrayBuffer); return new TextDecoder().decode(arrayBuffer); } diff --git a/src/data-types/number-array.ts b/src/data-types/number-array.ts index 02bfaea..ff208e3 100644 --- a/src/data-types/number-array.ts +++ b/src/data-types/number-array.ts @@ -21,7 +21,9 @@ export const assertNumberArray = (input: unknown) => * Convert from [Number Array][Number Array] to [ArrayBuffer][ArrayBuffer] * @group NumberArray */ -export function numberArrayToArrayBuffer(numberArray: number[]): ArrayBuffer { +export function numberArrayToArrayBuffer( + numberArray: number[], +): ArrayBufferLike { return new Uint8Array(numberArray).buffer; } diff --git a/src/data-types/string.ts b/src/data-types/string.ts index 62b8316..b4ad481 100644 --- a/src/data-types/string.ts +++ b/src/data-types/string.ts @@ -20,7 +20,7 @@ export const assertString = (input: unknown) => * Convert from [string][string] to [ArrayBuffer][ArrayBuffer] * @group String */ -export function stringToArrayBuffer(string: string): ArrayBuffer { +export function stringToArrayBuffer(string: string): ArrayBufferLike { assertString(string); return new TextEncoder().encode(string).buffer; } diff --git a/src/data-types/uint8-array.ts b/src/data-types/uint8-array.ts index 0d1f946..7508b77 100644 --- a/src/data-types/uint8-array.ts +++ b/src/data-types/uint8-array.ts @@ -20,7 +20,9 @@ export const assertUint8Array = (input: unknown) => * Convert from [Uint8Array][Uint8Array] to [ArrayBuffer][ArrayBuffer] * @group Uint8Array */ -export function uint8ArrayToArrayBuffer(uint8Array: Uint8Array): ArrayBuffer { +export function uint8ArrayToArrayBuffer( + uint8Array: Uint8Array, +): ArrayBufferLike { return uint8Array.buffer; } diff --git a/src/types.ts b/src/types.ts index b832b5b..b6a70df 100644 --- a/src/types.ts +++ b/src/types.ts @@ -10,6 +10,7 @@ export type DataTypeName = export type DataType = | ArrayBuffer + | ArrayBufferLike | Blob | DataView | number[]