{"record":{"id":"49e0769f1c032373","repo":"zloirock/core-js","slug":"incorrect-invocation","errorCode":null,"errorMessage":"Incorrect invocation","messagePattern":"Incorrect invocation","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core-js/internals/array-buffer-view-core.js","lineNumber":149,"sourceCode":"\nfor (NAME in TypedArrayConstructorsList) {\n  Constructor = globalThis[NAME];\n  Prototype = Constructor && Constructor.prototype;\n  if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;\n  else NATIVE_ARRAY_BUFFER_VIEWS = false;\n}\n\nfor (NAME in BigIntArrayConstructorsList) {\n  Constructor = globalThis[NAME];\n  Prototype = Constructor && Constructor.prototype;\n  if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;\n}\n\n// WebKit bug - typed arrays constructors prototype is Object.prototype\nif (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {\n  // eslint-disable-next-line no-shadow -- safe\n  TypedArray = function TypedArray() {\n    throw new TypeError('Incorrect invocation');\n  };\n  if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {\n    if (globalThis[NAME]) setPrototypeOf(globalThis[NAME], TypedArray);\n  }\n}\n\nif (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {\n  TypedArrayPrototype = TypedArray.prototype;\n  if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {\n    if (globalThis[NAME]) setPrototypeOf(globalThis[NAME].prototype, TypedArrayPrototype);\n  }\n}\n\n// WebKit bug - one more object in Uint8ClampedArray prototype chain\nif (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {\n  setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);\n}\n","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/zloirock/core-js/blob/84e45fba098dd3a177d5cf2247d06ab8e98d3790/packages/core-js/internals/array-buffer-view-core.js#L131-L167","documentation":"In engines lacking native ArrayBuffer views, core-js installs a placeholder TypedArray base function that only throws 'TypeError: Incorrect invocation' when called. This prevents constructing the abstract TypedArray base directly, mirroring the spec rule that %TypedArray% is not a constructor.","triggerScenarios":"Directly invoking the abstract TypedArray constructor: new TypedArray() or TypedArray() — e.g. via reflect.construct(TypedArray, []) or code that treats TypedArray as a concrete class.","commonSituations":"Code referencing the exported/internal TypedArray symbol instead of a concrete constructor like Uint8Array; metaprogramming that iterates constructor lists and instantiates the base; misuse of Reflect.construct with the base as target.","solutions":["Instantiate a concrete constructor: new Uint8Array(n), new Float32Array(...), etc.","Never call the abstract %TypedArray% base; it exists only as a prototype hub.","If dynamically choosing a type, index a real list: {u8: Uint8Array, f32: Float32Array}[name]."],"exampleFix":"// before\nvar a = new TypedArray(8); // TypeError: Incorrect invocation\n// after\nvar a = new Uint8Array(8);","handlingStrategy":"type-guard","validationCode":"function isConcreteTypedArrayCtor(C){ return C !== Object.getPrototypeOf(Uint8Array) && typeof C === 'function' && Object.getPrototypeOf(C) === Object.getPrototypeOf(Uint8Array); }","typeGuard":null,"tryCatchPattern":"try { view = new C(n); } catch (e) { if (/Incorrect invocation/.test(e.message)) throw new Error('use a concrete typed-array constructor, not the %TypedArray% base'); throw e; }","preventionTips":["Never instantiate the abstract TypedArray base; always pick Uint8Array/Float32Array/etc.","When mapping names to constructors, build an explicit {name: ctor} table excluding the base.","Don't use Reflect.construct with %TypedArray% as target."],"tags":["typeerror","typed-array","constructor","illegal-invocation"],"backgroundTag":"typed-array-incorrect-invocation","analyzedSha":"84e45fba098dd3a177d5cf2247d06ab8e98d3790","analyzedAt":"2026-08-30T20:36:10.323Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}