{"id":"8816f6ea7f05217d","repo":"sindresorhus/is","slug":"expected-value-which-is-uint32array-received-va","errorCode":null,"errorMessage":"Expected value which is `Uint32Array`, received value of type `${is(value)}`.","messagePattern":"Expected value which is `Uint32Array`, received value of type `(.+?)`\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"source/index.ts","lineNumber":1932,"sourceCode":"\t\tthrow new TypeError(message ?? typeErrorMessage('tuple-like', value));\n\t}\n}\n\nexport function assertTypedArray(value: unknown, message?: string): asserts value is TypedArray {\n\tif (!isTypedArray(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('TypedArray', value));\n\t}\n}\n\nexport function assertUint16Array(value: unknown, message?: string): asserts value is Uint16Array {\n\tif (!isUint16Array(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('Uint16Array', value));\n\t}\n}\n\nexport function assertUint32Array(value: unknown, message?: string): asserts value is Uint32Array {\n\tif (!isUint32Array(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('Uint32Array', value));\n\t}\n}\n\nexport function assertUint8Array(value: unknown, message?: string): asserts value is Uint8Array {\n\tif (!isUint8Array(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('Uint8Array', value));\n\t}\n}\n\nexport function assertUint8ClampedArray(value: unknown, message?: string): asserts value is Uint8ClampedArray {\n\tif (!isUint8ClampedArray(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('Uint8ClampedArray', value));\n\t}\n}\n\nexport function assertUndefined(value: unknown, message?: string): asserts value is undefined {\n\tif (!isUndefined(value)) {\n\t\tthrow new TypeError(message ?? typeErrorMessage('undefined', value));","sourceCodeStart":1914,"sourceCodeEnd":1950,"githubUrl":"https://github.com/sindresorhus/is/blob/7821031c66cdeb7256a0feb2d506535f9e84fcaf/source/index.ts#L1914-L1950","documentation":"Thrown by `assertUint32Array()` in @sindresorhus/is when the value is not an actual Uint32Array instance (checked via its toStringTag). It guards code paths that require 32-bit unsigned element views, throwing a TypeError naming the actual received type.","triggerScenarios":"`assert.uint32Array(value)` with a plain number array, a different TypedArray (Int32Array, Uint8Array), a DataView, or an ArrayBuffer.","commonSituations":"Hash/crypto/WebGL code expecting Uint32Array but handed a Buffer or Uint8Array; data deserialized from JSON or postMessage without reconstructing the typed array.","solutions":["Wrap or convert: `new Uint32Array(buffer)` or `Uint32Array.from(values)`.","Verify byte alignment — `new Uint32Array(buffer)` throws if the buffer length isn't a multiple of 4; slice/pad first.","Use `assert.typedArray()` if the exact element type doesn't matter."],"exampleFix":"// before\nassert.uint32Array(nodeBuffer);\n// after\nassert.uint32Array(new Uint32Array(nodeBuffer.buffer, nodeBuffer.byteOffset, nodeBuffer.byteLength / 4));","handlingStrategy":"type-guard","validationCode":"if (!is.uint32Array(value)) {\n  value = Uint32Array.from(value); // normalize or reject\n}","typeGuard":"if (is.uint32Array(value)) {\n  // value is Uint32Array here\n}","tryCatchPattern":"try {\n  assert.uint32Array(value);\n} catch (error) {\n  if (error instanceof TypeError) { /* handle non-Uint32Array input */ }\n  throw error;\n}","preventionTips":["Guard with is.uint32Array() before asserting","Don't confuse a plain number[] with a typed array — convert with Uint32Array.from() first","Check data received from workers/postMessage, since structured clone preserves the concrete TypedArray type"],"tags":["typescript","type-assertion","typed-array","runtime-validation"],"analyzedSha":"7821031c66cdeb7256a0feb2d506535f9e84fcaf","analyzedAt":"2026-07-31T18:34:06.268Z","schemaVersion":2}