Skip to content

BigInt64Array.prototype.with() throws RangeError instead of TypeError when called without arguments #1625

Closed

Description

@d01c2

Reproduction

new BigInt64Array().with();

Expected

A TypeError is thrown.

V8 (15.3.27):

d8> new BigInt64Array().with();
TypeError: Cannot convert undefined to a BigInt

Actual (QuickJS-ng)

qjs > new BigInt64Array().with();
RangeError: invalid typed array index
    at with (native)
    at <eval> (<evalScript>:1:20)

Spec

In %TypedArray%.prototype.with, both index and value are undefined when the arguments are omitted.

After converting index, the algorithm applies ToBigInt to value because the receiver has BigInt content. ToBigInt(undefined) throws a TypeError. This conversion occurs before the index validity check that would throw a RangeError, so the RangeError must not be reached.

Versions

  • QuickJS-ng: 0.16.0
  • V8: 15.3.27

Activity

  1. saghul commented on Aug 2, 2026

    @saghul
    Contributor

    Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions