讨论加特殊图标

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-03-21 15:49:12 +08:00
parent 0ed747a035
commit dd619643c9
202 changed files with 2973 additions and 2866 deletions

View File

@@ -5,9 +5,12 @@ var define = require('define-data-property');
var hasDescriptors = require('has-property-descriptors')();
var gOPD = require('gopd');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var $floor = GetIntrinsic('%Math.floor%');
/** @typedef {(...args: unknown[]) => unknown} Func */
/** @type {<T extends Func = Func>(fn: T, length: number, loose?: boolean) => T} */
module.exports = function setFunctionLength(fn, length) {
if (typeof fn !== 'function') {
throw new $TypeError('`fn` is not a function');
@@ -32,9 +35,9 @@ module.exports = function setFunctionLength(fn, length) {
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
if (hasDescriptors) {
define(fn, 'length', length, true, true);
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
} else {
define(fn, 'length', length);
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
}
}
return fn;