diff --git a/packages/cbor-web/types/lib/decoder.d.ts b/packages/cbor-web/types/lib/decoder.d.ts index 58507ab..2fe7e4d 100644 --- a/packages/cbor-web/types/lib/decoder.d.ts +++ b/packages/cbor-web/types/lib/decoder.d.ts @@ -127,7 +127,7 @@ declare const NOT_FOUND: unique symbol; /** * Things that can act as inputs, from which a NoFilter can be created. */ -type BufferLike = string | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | DataView | import("stream").Readable; +type BufferLike = string | Buffer | ArrayBuffer | ArrayBufferView | DataView | import("stream").Readable; type ExtendedResults = { /** * The value that was found. diff --git a/packages/cbor/lib/decoder.js b/packages/cbor/lib/decoder.js index 68d27b0..559fcd3 100644 --- a/packages/cbor/lib/decoder.js +++ b/packages/cbor/lib/decoder.js @@ -44,7 +44,7 @@ class UnexpectedDataError extends Error { /** * Things that can act as inputs, from which a NoFilter can be created. * - * @typedef {string|Buffer|ArrayBuffer|Uint8Array|Uint8ClampedArray + * @typedef {string|Buffer|ArrayBuffer|ArrayBufferView * |DataView|import('stream').Readable} BufferLike */ /** diff --git a/packages/cbor/test/decoder.ava.js b/packages/cbor/test/decoder.ava.js index 0e0fb53..18bfbcc 100644 --- a/packages/cbor/test/decoder.ava.js +++ b/packages/cbor/test/decoder.ava.js @@ -230,6 +230,7 @@ test('typed arrays', t => { t.is(cbor.decode(ab), 9007199254740992n); t.is(cbor.decode(new Uint8Array(ab)), 9007199254740992n); t.is(cbor.decode(new Uint8ClampedArray(ab)), 9007199254740992n); + t.is(cbor.decode(new Int8Array(ab)), 9007199254740992n); // Beware endian-ness const u8b = new Uint8ClampedArray([0x61, 0x62]); diff --git a/packages/cbor/types/lib/decoder.d.ts b/packages/cbor/types/lib/decoder.d.ts index 58507ab..2fe7e4d 100644 --- a/packages/cbor/types/lib/decoder.d.ts +++ b/packages/cbor/types/lib/decoder.d.ts @@ -127,7 +127,7 @@ declare const NOT_FOUND: unique symbol; /** * Things that can act as inputs, from which a NoFilter can be created. */ -type BufferLike = string | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | DataView | import("stream").Readable; +type BufferLike = string | Buffer | ArrayBuffer | ArrayBufferView | DataView | import("stream").Readable; type ExtendedResults = { /** * The value that was found.