Skip to content

Commit

Permalink
review eslint config: enforce new with error constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Sep 14, 2023
1 parent c9d9049 commit d86daaa
Show file tree
Hide file tree
Showing 105 changed files with 211 additions and 200 deletions.
2 changes: 1 addition & 1 deletion packages/core-js-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = async function ({
filename = null,
summary = {},
} = {}) {
if (!['bundle', 'cjs', 'esm'].includes(format)) throw TypeError('Incorrect output type');
if (!['bundle', 'cjs', 'esm'].includes(format)) throw new TypeError('Incorrect output type');
summary = { comment: normalizeSummary(summary.comment), console: normalizeSummary(summary.console) };

const TITLE = filename !== null || filename !== undefined ? filename : '`core-js`';
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-compat/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const allModules = require('./modules');
const targetsParser = require('./targets-parser');

function throwInvalidFilter(filter) {
throw TypeError(`Specified invalid module name or pattern: ${ filter }`);
throw new TypeError(`Specified invalid module name or pattern: ${ filter }`);
}

function atLeastSomeModules(modules, filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const modules = require('./modules');
module.exports = function (raw) {
const corejs = semver(raw);
if (corejs.major !== 3) {
throw RangeError('This version of `core-js-compat` works only with `core-js@3`.');
throw new RangeError('This version of `core-js-compat` works only with `core-js@3`.');
}
const result = [];
for (const version of Object.keys(modulesByVersions)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-compat/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function semver(input) {
// eslint-disable-next-line new-cap -- ok
if (!(this instanceof semver)) return new semver(input);
const match = /(\d+)(?:\.(\d+))?(?:\.(\d+))?/.exec(input);
if (!match) throw TypeError(`Invalid version: ${ input }`);
if (!match) throw new TypeError(`Invalid version: ${ input }`);
const [, $major, $minor, $patch] = match;
this.major = +$major;
this.minor = $minor ? +$minor : 0;
Expand Down
4 changes: 3 additions & 1 deletion packages/core-js-pure/override/internals/a-map.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use strict';
var tryToString = require('../internals/try-to-string');

var $TypeError = TypeError;

// Perform ? RequireInternalSlot(M, [[MapData]])
module.exports = function (it) {
if (typeof it == 'object' && 'size' in it && 'has' in it && 'get' in it && 'set' in it && 'delete' in it && 'entries' in it) return it;
throw TypeError(tryToString(it) + ' is not a map');
throw new $TypeError(tryToString(it) + ' is not a map');
};
4 changes: 3 additions & 1 deletion packages/core-js-pure/override/internals/a-set.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use strict';
var tryToString = require('../internals/try-to-string');

var $TypeError = TypeError;

// Perform ? RequireInternalSlot(M, [[SetData]])
module.exports = function (it) {
if (typeof it == 'object' && 'size' in it && 'has' in it && 'add' in it && 'delete' in it && 'keys' in it) return it;
throw TypeError(tryToString(it) + ' is not a set');
throw new $TypeError(tryToString(it) + ' is not a set');
};
4 changes: 3 additions & 1 deletion packages/core-js-pure/override/internals/a-weak-map.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use strict';
var tryToString = require('../internals/try-to-string');

var $TypeError = TypeError;

// Perform ? RequireInternalSlot(M, [[WeakMapData]])
module.exports = function (it) {
if (typeof it == 'object' && 'has' in it && 'get' in it && 'set' in it && 'delete') return it;
throw TypeError(tryToString(it) + ' is not a weakmap');
throw new $TypeError(tryToString(it) + ' is not a weakmap');
};
4 changes: 3 additions & 1 deletion packages/core-js-pure/override/internals/a-weak-set.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use strict';
var tryToString = require('../internals/try-to-string');

var $TypeError = TypeError;

// Perform ? RequireInternalSlot(M, [[WeakSetData]])
module.exports = function (it) {
if (typeof it == 'object' && 'has' in it && 'add' in it && 'delete' in it) return it;
throw TypeError(tryToString(it) + ' is not a weakset');
throw new $TypeError(tryToString(it) + ' is not a weakset');
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/a-callable.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ var $TypeError = TypeError;
// `Assert: IsCallable(argument) is true`
module.exports = function (argument) {
if (isCallable(argument)) return argument;
throw $TypeError(tryToString(argument) + ' is not a function');
throw new $TypeError(tryToString(argument) + ' is not a function');
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/a-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ var $TypeError = TypeError;
// `Assert: IsConstructor(argument) is true`
module.exports = function (argument) {
if (isConstructor(argument)) return argument;
throw $TypeError(tryToString(argument) + ' is not a constructor');
throw new $TypeError(tryToString(argument) + ' is not a constructor');
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/a-possible-prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ var $TypeError = TypeError;

module.exports = function (argument) {
if (typeof argument == 'object' || isCallable(argument)) return argument;
throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
throw new $TypeError("Can't set " + $String(argument) + ' as a prototype');
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/an-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ var $TypeError = TypeError;

module.exports = function (it, Prototype) {
if (isPrototypeOf(Prototype, it)) return it;
throw $TypeError('Incorrect invocation');
throw new $TypeError('Incorrect invocation');
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/an-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ var $TypeError = TypeError;
// `Assert: Type(argument) is Object`
module.exports = function (argument) {
if (isObject(argument)) return argument;
throw $TypeError($String(argument) + ' is not an object');
throw new $TypeError($String(argument) + ' is not an object');
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-buffer-byte-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ var $TypeError = TypeError;
// - Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
// - If IsSharedArrayBuffer(O) is true, throw a TypeError exception.
module.exports = uncurryThisAccessor(ArrayBuffer.prototype, 'byteLength', 'get') || function (O) {
if (classof(O) !== 'ArrayBuffer') throw $TypeError('ArrayBuffer expected');
if (classof(O) !== 'ArrayBuffer') throw new $TypeError('ArrayBuffer expected');
return O.byteLength;
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-buffer-transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = PROPER_TRANSFER && function (arrayBuffer, newLength, preserveRe
var byteLength = arrayBufferByteLength(arrayBuffer);
var newByteLength = newLength === undefined ? byteLength : toIndex(newLength);
var fixedLength = !isResizable || !isResizable(arrayBuffer);
if (isDetached(arrayBuffer)) throw TypeError('ArrayBuffer is detached');
if (isDetached(arrayBuffer)) throw new TypeError('ArrayBuffer is detached');
var newBuffer = structuredClone(arrayBuffer, { transfer: [arrayBuffer] });
if (byteLength === newByteLength && (preserveResizability || fixedLength)) return newBuffer;
if (byteLength >= newByteLength && (!preserveResizability || fixedLength)) return slice(newBuffer, 0, newByteLength);
Expand Down
6 changes: 3 additions & 3 deletions packages/core-js/internals/array-buffer-view-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ var isTypedArray = function (it) {

var aTypedArray = function (it) {
if (isTypedArray(it)) return it;
throw TypeError('Target is not a typed array');
throw new TypeError('Target is not a typed array');
};

var aTypedArrayConstructor = function (C) {
if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C;
throw TypeError(tryToString(C) + ' is not a typed array constructor');
throw new TypeError(tryToString(C) + ' is not a typed array constructor');
};

var exportTypedArrayMethod = function (KEY, property, forced, options) {
Expand Down Expand Up @@ -146,7 +146,7 @@ for (NAME in BigIntArrayConstructorsList) {
if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
// eslint-disable-next-line no-shadow -- safe
TypedArray = function TypedArray() {
throw TypeError('Incorrect invocation');
throw new TypeError('Incorrect invocation');
};
if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
Expand Down
8 changes: 4 additions & 4 deletions packages/core-js/internals/array-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var get = function (view, count, index, isLittleEndian) {
var store = getInternalDataViewState(view);
var intIndex = toIndex(index);
var boolIsLittleEndian = !!isLittleEndian;
if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
if (intIndex + count > store.byteLength) throw new RangeError(WRONG_INDEX);
var bytes = store.bytes;
var start = intIndex + store.byteOffset;
var pack = arraySlice(bytes, start, start + count);
Expand All @@ -94,7 +94,7 @@ var set = function (view, count, index, conversion, value, isLittleEndian) {
var intIndex = toIndex(index);
var pack = conversion(+value);
var boolIsLittleEndian = !!isLittleEndian;
if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
if (intIndex + count > store.byteLength) throw new RangeError(WRONG_INDEX);
var bytes = store.bytes;
var start = intIndex + store.byteOffset;
for (var i = 0; i < count; i++) bytes[start + i] = pack[boolIsLittleEndian ? i : count - i - 1];
Expand Down Expand Up @@ -123,9 +123,9 @@ if (!NATIVE_ARRAY_BUFFER) {
var bufferState = getInternalArrayBufferState(buffer);
var bufferLength = bufferState.byteLength;
var offset = toIntegerOrInfinity(byteOffset);
if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
if (offset < 0 || offset > bufferLength) throw new RangeError('Wrong offset');
byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
if (offset + byteLength > bufferLength) throw new RangeError(WRONG_LENGTH);
setInternalState(this, {
type: DATA_VIEW,
buffer: buffer,
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var createMethod = function (IS_RIGHT) {
}
index += i;
if (IS_RIGHT ? index < 0 : length <= index) {
throw $TypeError('Reduce of empty array with no initial value');
throw new $TypeError('Reduce of empty array with no initial value');
}
}
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-set-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {

module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
throw $TypeError('Cannot set read only .length');
throw new $TypeError('Cannot set read only .length');
} return O.length = length;
} : function (O, length) {
return O.length = length;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-with.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = function (O, C, index, value) {
var len = lengthOfArrayLike(O);
var relativeIndex = toIntegerOrInfinity(index);
var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex;
if (actualIndex >= len || actualIndex < 0) throw $RangeError('Incorrect index');
if (actualIndex >= len || actualIndex < 0) throw new $RangeError('Incorrect index');
var A = new C(len);
var k = 0;
for (; k < len; k++) A[k] = k === actualIndex ? value : O[k];
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/composite-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function () {
for (i = 0; i < length; i++) {
if (isObject(it = arguments[i])) active = active.next(i, it, true);
}
if (this === $Object && active === root) throw $TypeError('Composite keys must contain a non-primitive component');
if (this === $Object && active === root) throw new $TypeError('Composite keys must contain a non-primitive component');
for (i = 0; i < length; i++) {
if (!isObject(it = arguments[i])) active = active.next(i, it, false);
} return active;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/date-to-iso-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = (fails(function () {
}) || !fails(function () {
nativeDateToISOString.call(new Date(NaN));
})) ? function toISOString() {
if (!$isFinite(thisTimeValue(this))) throw $RangeError('Invalid time value');
if (!$isFinite(thisTimeValue(this))) throw new $RangeError('Invalid time value');
var date = this;
var year = getUTCFullYear(date);
var milliseconds = getUTCMilliseconds(date);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/date-to-primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ var $TypeError = TypeError;
module.exports = function (hint) {
anObject(this);
if (hint === 'string' || hint === 'default') hint = 'string';
else if (hint !== 'number') throw $TypeError('Incorrect hint');
else if (hint !== 'number') throw new $TypeError('Incorrect hint');
return ordinaryToPrimitive(this, hint);
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/delete-property-or-throw.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ var tryToString = require('../internals/try-to-string');
var $TypeError = TypeError;

module.exports = function (O, P) {
if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/error-stack-clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var uncurryThis = require('../internals/function-uncurry-this');
var $Error = Error;
var replace = uncurryThis(''.replace);

var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
// eslint-disable-next-line redos/no-vulnerable -- safe
var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/error-stack-installable.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var fails = require('../internals/fails');
var createPropertyDescriptor = require('../internals/create-property-descriptor');

module.exports = !fails(function () {
var error = Error('a');
var error = new Error('a');
if (!('stack' in error)) return true;
// eslint-disable-next-line es/no-object-defineproperty -- safe
Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/get-iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ var $TypeError = TypeError;
module.exports = function (argument, usingIterator) {
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
throw $TypeError(tryToString(argument) + ' is not iterable');
throw new $TypeError(tryToString(argument) + ' is not iterable');
};
4 changes: 2 additions & 2 deletions packages/core-js/internals/get-set-record.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ module.exports = function (obj) {
var numSize = +obj.size;
// NOTE: If size is undefined, then numSize will be NaN
// eslint-disable-next-line no-self-compare -- NaN check
if (numSize !== numSize) throw $TypeError(INVALID_SIZE);
if (numSize !== numSize) throw new $TypeError(INVALID_SIZE);
var intSize = toIntegerOrInfinity(numSize);
if (intSize < 0) throw $RangeError(INVALID_SIZE);
if (intSize < 0) throw new $RangeError(INVALID_SIZE);
return new SetRecord(
obj,
max(intSize, 0),
Expand Down
6 changes: 3 additions & 3 deletions packages/core-js/internals/internal-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
Expand All @@ -34,7 +34,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
store.set = store.set;
/* eslint-enable no-self-assign -- prototype methods protection */
set = function (it, metadata) {
if (store.has(it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
store.set(it, metadata);
return metadata;
Expand All @@ -49,7 +49,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
var STATE = sharedKey('state');
hiddenKeys[STATE] = true;
set = function (it, metadata) {
if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
createNonEnumerableProperty(it, STATE, metadata);
return metadata;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/iterate.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = function (iterable, unboundFunction, options) {
iterator = iterable;
} else {
iterFn = getIteratorMethod(iterable);
if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
// optimisation for array iterators
if (isArrayIteratorMethod(iterFn)) {
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/map-upsert.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function upsert(key, updateFn /* , insertFn */) {
var insertFn = arguments.length > 2 ? arguments[2] : undefined;
var value;
if (!isCallable(updateFn) && !isCallable(insertFn)) {
throw $TypeError('At least one callback required');
throw new $TypeError('At least one callback required');
}
if (call(has, map, key)) {
value = call(get, map, key);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/new-promise-capability.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var $TypeError = TypeError;
var PromiseCapability = function (C) {
var resolve, reject;
this.promise = new C(function ($$resolve, $$reject) {
if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor');
resolve = $$resolve;
reject = $$reject;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/not-a-nan.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ var $RangeError = RangeError;
module.exports = function (it) {
// eslint-disable-next-line no-self-compare -- NaN check
if (it === it) return it;
throw $RangeError('NaN is not allowed');
throw new $RangeError('NaN is not allowed');
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/not-a-regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ var $TypeError = TypeError;

module.exports = function (it) {
if (isRegExp(it)) {
throw $TypeError("The method doesn't accept regular expressions");
throw new $TypeError("The method doesn't accept regular expressions");
} return it;
};
10 changes: 5 additions & 5 deletions packages/core-js/internals/numeric-range-iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ var $TypeError = TypeError;
var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) {
// TODO: Drop the first `typeof` check after removing legacy methods in `core-js@4`
if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) {
throw $TypeError(INCORRECT_RANGE);
throw new $TypeError(INCORRECT_RANGE);
}
if (start === Infinity || start === -Infinity) {
throw $RangeError(INCORRECT_RANGE);
throw new $RangeError(INCORRECT_RANGE);
}
var ifIncrease = end > start;
var inclusiveEnd = false;
Expand All @@ -35,16 +35,16 @@ var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(sta
} else if (typeof option == type) {
step = option;
} else {
throw $TypeError(INCORRECT_RANGE);
throw new $TypeError(INCORRECT_RANGE);
}
if (isNullOrUndefined(step)) {
step = ifIncrease ? one : -one;
}
if (typeof step != type) {
throw $TypeError(INCORRECT_RANGE);
throw new $TypeError(INCORRECT_RANGE);
}
if (step === Infinity || step === -Infinity || (step === zero && start !== end)) {
throw $RangeError(INCORRECT_RANGE);
throw new $RangeError(INCORRECT_RANGE);
}
// eslint-disable-next-line no-self-compare -- NaN check
var hitsEnd = start !== start || end !== end || step !== step || (end > start) !== (step > zero);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/object-define-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P
if (IE8_DOM_DEFINE) try {
return $defineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
Loading

0 comments on commit d86daaa

Please sign in to comment.