{"id":"154087aeaf585d7f","repo":"sindresorhus/is","slug":"expected-value-which-is-bigint64array-received","errorCode":null,"errorMessage":"Expected value which is `BigInt64Array`, received value of type `${is(value)}`.","messagePattern":"Expected value which is `BigInt64Array`, received value of type `(.+?)`\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"source/index.ts","lineNumber":1492,"sourceCode":"\t\tthrow new TypeError(message ?? typeErrorMessage('AsyncGeneratorFunction', value));\n\t}\n}\n\nexport function assertAsyncIterable<T = unknown>(value: unknown, message?: string): asserts value is AsyncIterable<T> {\n\tif (!isAsyncIterable(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('AsyncIterable', value));\n\t}\n}\n\nexport function assertBigint(value: unknown, message?: string): asserts value is bigint {\n\tif (!isBigint(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('bigint', value));\n\t}\n}\n\nexport function assertBigInt64Array(value: unknown, message?: string): asserts value is BigInt64Array {\n\tif (!isBigInt64Array(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('BigInt64Array', value));\n\t}\n}\n\nexport function assertBigUint64Array(value: unknown, message?: string): asserts value is BigUint64Array {\n\tif (!isBigUint64Array(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('BigUint64Array', value));\n\t}\n}\n\nexport function assertBlob(value: unknown, message?: string): asserts value is Blob {\n\tif (!isBlob(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('Blob', value));\n\t}\n}\n\nexport function assertBoolean(value: unknown, message?: string): asserts value is boolean {\n\tif (!isBoolean(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('boolean', value));","sourceCodeStart":1474,"sourceCodeEnd":1510,"githubUrl":"https://github.com/sindresorhus/is/blob/7821031c66cdeb7256a0feb2d506535f9e84fcaf/source/index.ts#L1474-L1510","documentation":"Thrown by `assertBigInt64Array(value)` when the value's object tag is not `BigInt64Array`. Only a genuine `BigInt64Array` passes — a `BigUint64Array`, a `Float64Array`/`Int32Array`, a plain array of bigints, an `ArrayBuffer`, or a `DataView` over the same bytes all fail even though they may hold equivalent data.","triggerScenarios":"Passing an ordinary array like `[1n, 2n]` instead of `new BigInt64Array([1n, 2n])`; passing the unsigned variant `BigUint64Array` where the signed one is asserted; passing a raw `ArrayBuffer`/`Buffer` from I/O without wrapping it in the correct view; a `Number`-based typed array used for 64-bit values that actually need bigint precision.","commonSituations":"WebAssembly/FFI or binary-protocol code where buffers arrive as Node `Buffer`/`ArrayBuffer` and need an explicit `new BigInt64Array(buf.buffer, ...)` view; sign confusion between Int64/Uint64 columns; environments predating BigInt64Array (Safari < 15, old Node) where a polyfill or fallback array is substituted.","solutions":["Construct the proper view: `new BigInt64Array(arrayOfBigints)` or `new BigInt64Array(buffer, byteOffset, length)` — the byte length must be a multiple of 8.","If you have a BigUint64Array and the signed type is required, create a signed view over the same buffer: `new BigInt64Array(u.buffer, u.byteOffset, u.length)` (mind reinterpretation of values ≥ 2^63).","If any 64-bit bigint view is acceptable, assert `assert.any([is.bigInt64Array, is.bigUint64Array], value)`.","Verify the runtime supports BigInt64Array (Node 10.4+/modern browsers) rather than a fallback shim."],"exampleFix":"// before\nassert.bigInt64Array([1n, 2n]); // plain Array, throws\n// after\nassert.bigInt64Array(new BigInt64Array([1n, 2n]));","handlingStrategy":"type-guard","validationCode":"if (!(value instanceof BigInt64Array)) {\n  // e.g. construct: new BigInt64Array(buffer) — do not pass the raw buffer\n}","typeGuard":"const isBigInt64Array = (value) => value instanceof BigInt64Array;","tryCatchPattern":"try {\n  assert.bigInt64Array(value);\n} catch (error) {\n  if (error instanceof TypeError) { /* wrong TypedArray flavor or raw ArrayBuffer */ }\n  else { throw error; }\n}","preventionTips":["BigUint64Array, Int32Array, and raw ArrayBuffers all fail — the exact TypedArray class matters","Wrap buffers explicitly with new BigInt64Array(buffer, byteOffset, length) before passing","Cross-realm instances fail instanceof — prefer the library's is.bigInt64Array guard for values crossing realms/workers"],"tags":["type-assertion","typed-array","bigint","binary-data"],"analyzedSha":"7821031c66cdeb7256a0feb2d506535f9e84fcaf","analyzedAt":"2026-07-31T18:34:06.268Z","schemaVersion":2}