From: Fabrice Bellard Date: Tue, 24 Nov 2026 16:47:24 +0000 (+0100) Subject: Make BigInt64Array.prototype.with() throw TypeError instead of RangeError when value... X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static/%7B@url%7D?a=commitdiff_plain;h=b5fe2d4890626a04b6b4fbb23ab6bda209129d6c;p=quickjs.git Make BigInt64Array.prototype.with() throw TypeError instead of RangeError when value is invalid (Samir) --- diff --git a/quickjs.c b/quickjs.c index e5cbaf0..9b5dd55 100644 --- a/quickjs.c +++ b/quickjs.c @@ -61865,7 +61865,11 @@ static JSValue js_typed_array_with(JSContext *ctx, JSValueConst this_val, if (idx < 0) idx = len + idx; - val = JS_ToPrimitive(ctx, argv[1], JS_HINT_NUMBER); + if (p->class_id == JS_CLASS_BIG_INT64_ARRAY || p->class_id == JS_CLASS_BIG_UINT64_ARRAY) { + val = JS_ToBigInt(ctx, argv[1]); + } else { + val = JS_ToNumber(ctx, argv[1]); + } if (JS_IsException(val)) return JS_EXCEPTION;