Skip to content

Commit

Permalink
fix(ext/crypto): adjust getRandomValues types (#14714)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkldshv authored and bartlomieju committed Jun 2, 2022
1 parent 9f7e314 commit 5eef49c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions cli/tests/unit/get_random_values_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ext/crypto/lib.deno_crypto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ declare interface Crypto {
| Uint16Array
| Uint32Array
| Uint8ClampedArray
| Float32Array
| Float64Array
| BigInt64Array
| BigUint64Array
| DataView
| null,
>(
Expand Down

0 comments on commit 5eef49c

Please sign in to comment.