From 4e26bcb2bb748a810614dd0645c41a58f5a53154 Mon Sep 17 00:00:00 2001 From: Mark Ladyshau <47859603+mrkldshv@users.noreply.github.com> Date: Thu, 2 Jun 2022 15:15:46 +0200 Subject: [PATCH] fix(ext/crypto): adjust `getRandomValues` types (#14714) --- cli/tests/unit/get_random_values_test.ts | 12 ++++++++++++ ext/crypto/lib.deno_crypto.d.ts | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cli/tests/unit/get_random_values_test.ts b/cli/tests/unit/get_random_values_test.ts index 4df22f697b..29c8365ea7 100644 --- a/cli/tests/unit/get_random_values_test.ts +++ b/cli/tests/unit/get_random_values_test.ts @@ -37,12 +37,24 @@ Deno.test(function getRandomValuesInt32Array() { assertNotEquals(arr, new Int32Array(8)); }); +Deno.test(function getRandomValuesBigInt64Array() { + const arr = new BigInt64Array(8); + crypto.getRandomValues(arr); + assertNotEquals(arr, new BigInt64Array(8)); +}); + Deno.test(function getRandomValuesUint32Array() { const arr = new Uint32Array(8); crypto.getRandomValues(arr); assertNotEquals(arr, new Uint32Array(8)); }); +Deno.test(function getRandomValuesBigUint64Array() { + const arr = new BigUint64Array(8); + crypto.getRandomValues(arr); + assertNotEquals(arr, new BigUint64Array(8)); +}); + Deno.test(function getRandomValuesReturnValue() { const arr = new Uint32Array(8); const rtn = crypto.getRandomValues(arr); diff --git a/ext/crypto/lib.deno_crypto.d.ts b/ext/crypto/lib.deno_crypto.d.ts index a5c775a029..7f7703e889 100644 --- a/ext/crypto/lib.deno_crypto.d.ts +++ b/ext/crypto/lib.deno_crypto.d.ts @@ -326,8 +326,8 @@ declare interface Crypto { | Uint16Array | Uint32Array | Uint8ClampedArray - | Float32Array - | Float64Array + | BigInt64Array + | BigUint64Array | DataView | null, >(