diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index e0b1dd25a27..1f13a3fdcaf 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -5854,9 +5854,9 @@ arrays! { /// `BigInt64Array()` /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array - BigInt64Array: BigInt, + BigInt64Array: i64, /// `BigUint64Array()` /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array - BigUint64Array: BigInt, + BigUint64Array: u64, } diff --git a/crates/js-sys/tests/wasm/Array.js b/crates/js-sys/tests/wasm/Array.js index 8810bd9db88..f4d6ab71382 100644 --- a/crates/js-sys/tests/wasm/Array.js +++ b/crates/js-sys/tests/wasm/Array.js @@ -1,6 +1,7 @@ // Used for `Array.rs` tests -exports.populate_array = function(arr, start, len) { +exports.populate_array = function(arr, start, len) { + var isBigInt = typeof(arr[0]) === "bigint"; for (i = 0; i < len; i++) { - arr[i] = start + i; + arr[i] = isBigInt ? BigInt(start + i) : start + i; } }; diff --git a/crates/js-sys/tests/wasm/Array.rs b/crates/js-sys/tests/wasm/Array.rs index 9554f39f711..e498c2cc0a9 100644 --- a/crates/js-sys/tests/wasm/Array.rs +++ b/crates/js-sys/tests/wasm/Array.rs @@ -594,6 +594,15 @@ fn Int32Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Int32Array::view_mut_raw, i32::from, JsValue::from); } +#[wasm_bindgen_test] +fn BigInt64Array_view_mut_raw() { + test_array_view_mut_raw( + js_sys::BigInt64Array::view_mut_raw, + i64::from, + JsValue::from, + ); +} + #[wasm_bindgen_test] fn Uint8Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Uint8Array::view_mut_raw, u8::from, JsValue::from); @@ -618,6 +627,15 @@ fn Uint32Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Uint32Array::view_mut_raw, u32::from, JsValue::from); } +#[wasm_bindgen_test] +fn BigUint64Array_view_mut_raw() { + test_array_view_mut_raw( + js_sys::BigUint64Array::view_mut_raw, + u64::from, + JsValue::from, + ); +} + #[wasm_bindgen_test] fn Float32Array_view_mut_raw() { test_array_view_mut_raw(js_sys::Float32Array::view_mut_raw, f32::from, JsValue::from);