{"record":{"id":"fd96fd8a0b9f7442","repo":"zloirock/core-js","slug":"is-not-a-typed-array-constructor","errorCode":null,"errorMessage":" is not a typed array constructor","messagePattern":" is not a typed array constructor","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core-js/internals/array-buffer-view-core.js","lineNumber":85,"sourceCode":"  var state = getInternalState(proto);\n  return (state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);\n};\n\nvar isTypedArray = function (it) {\n  if (!isObject(it)) return false;\n  var klass = classof(it);\n  return hasOwn(TypedArrayConstructorsList, klass)\n    || hasOwn(BigIntArrayConstructorsList, klass);\n};\n\nvar aTypedArray = function (it) {\n  if (isTypedArray(it)) return it;\n  throw new TypeError('Target is not a typed array');\n};\n\nvar aTypedArrayConstructor = function (C) {\n  if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C;\n  throw new TypeError(tryToString(C) + ' is not a typed array constructor');\n};\n\nvar exportTypedArrayMethod = function (KEY, property, forced, options) {\n  if (!DESCRIPTORS) return;\n  if (forced) for (var ARRAY in TypedArrayConstructorsList) {\n    var TypedArrayConstructor = globalThis[ARRAY];\n    if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try {\n      delete TypedArrayConstructor.prototype[KEY];\n    } catch (error) {\n      // old WebKit bug - some methods are non-configurable\n      try {\n        TypedArrayConstructor.prototype[KEY] = property;\n      } catch (error2) { /* empty */ }\n    }\n  }\n  if (!TypedArrayPrototype[KEY] || forced) {\n    defineBuiltIn(TypedArrayPrototype, KEY, forced ? property\n      : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/zloirock/core-js/blob/84e45fba098dd3a177d5cf2247d06ab8e98d3790/packages/core-js/internals/array-buffer-view-core.js#L67-L103","documentation":"aTypedArrayConstructor validates that C is a callable whose prototype chain derives from the intrinsic TypedArray constructor (when setPrototypeOf-based detection works). Otherwise core-js throws a TypeError '<stringified C> is not a typed array constructor'. It guards internal subclassing/exports (e.g. TypedArray.from/of and constructor-dependent method exports).","triggerScenarios":"Passing a non-typed-array constructor to APIs expecting one (e.g. calling a polyfilled generic expecting a typed-array constructor), or invoking the export with a subclass not properly linked via extends/setPrototypeOf, or with undefined (often prints 'undefined is not a typed array constructor').","commonSituations":"Transpilation/down-leveling that breaks `class MyArr extends Uint8Array` prototype linkage (loose mode, broken setPrototypeOf); tooling munging globals so Uint8Array is undefined; passing Array or DataView constructors by mistake.","solutions":["Use a real typed-array constructor (Uint8Array, Float64Array, ...).","Declare subclasses with native `class X extends Uint8Array` so isPrototypeOf(TypedArray, C) holds.","Ensure core-js's chosen globals aren't shadowed/undefined at call time.","Avoid overriding setPrototypeOf or using es5 transpilation for typed-array subclasses."],"exampleFix":"// before\ntypedArrayFrom(Array, [1,2,3]); // Array is not a typed array constructor\n// after\ntypedArrayFrom(Float64Array, [1,2,3]);","handlingStrategy":"validation","validationCode":"function isTypedArrayCtor(C){ return typeof C === 'function' && ['Int8Array','Uint8Array','Uint8ClampedArray','Int16Array','Uint16Array','Int32Array','Uint32Array','Float32Array','Float64Array','BigInt64Array','BigUint64Array'].some(n => typeof globalThis[n] === 'function' && C === globalThis[n]); }","typeGuard":"function isTypedArrayCtor(C){ return typeof C === 'function' && Function.prototype.toString.call(C).includes('[native code]') === false ? C.prototype instanceof Object.getPrototypeOf(Uint8Array) : typeof C === 'function' && C.prototype instanceof Object.getPrototypeOf(Uint8Array); }","tryCatchPattern":"try { C.from(data); } catch (e) { if (/is not a typed array constructor/.test(e.message)) { C = Float64Array; C.from(data); } else throw e; }","preventionTips":["Only pass real typed-array constructors, not Array or DataView.","Use native `class X extends Uint8Array` for subclasses so prototype linkage survives.","Check the global isn't shadowed/undefined (a common cause of 'undefined is not a typed array constructor').","Avoid ES5 transpile targets that break setPrototypeOf-based subclassing."],"tags":["typeerror","typed-array","constructor","subclassing"],"backgroundTag":"not-a-typed-array-constructor","analyzedSha":"84e45fba098dd3a177d5cf2247d06ab8e98d3790","analyzedAt":"2026-08-30T20:36:10.323Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}