From 29f9cae85eef6f7b2d5a35d3afbde3af43092859 Mon Sep 17 00:00:00 2001 From: Juodumas Date: Wed, 12 May 2021 17:45:31 -0700 Subject: [PATCH] Missing types in crypto randomFill & randomFillSync node definitions Summary: In current definitions `buffer` arg only accepts `Buffer` type, but according to docs [1] it should accept `Buffer | $TypedArray | DataView`. [1] https://nodejs.org/api/crypto.html#crypto_crypto_randomfillsync_buffer_offset_size Pull Request resolved: https://github.com/facebook/flow/pull/8373 Reviewed By: nmote Differential Revision: D28344647 Pulled By: mroch fbshipit-source-id: d3d46d93a5eb7e510534f0d19f2b5b09d7aeb37f --- lib/node.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node.js b/lib/node.js index c32843c59eb..83ad05c94f2 100644 --- a/lib/node.js +++ b/lib/node.js @@ -672,24 +672,24 @@ declare module "crypto" { size: number, callback: (err: ?Error, buffer: Buffer) => void ): void; - declare function randomFillSync(buffer: Buffer): void - declare function randomFillSync(buffer: Buffer, offset: number): void + declare function randomFillSync(buffer: Buffer | $TypedArray | DataView): void + declare function randomFillSync(buffer: Buffer | $TypedArray | DataView, offset: number): void declare function randomFillSync( - buffer: Buffer, + buffer: Buffer | $TypedArray | DataView, offset: number, size: number ): void declare function randomFill( - buffer: Buffer, + buffer: Buffer | $TypedArray | DataView, callback: (err: ?Error, buffer: Buffer) => void ): void declare function randomFill( - buffer: Buffer, + buffer: Buffer | $TypedArray | DataView, offset: number, callback: (err: ?Error, buffer: Buffer) => void ): void declare function randomFill( - buffer: Buffer, + buffer: Buffer | $TypedArray | DataView, offset: number, size: number, callback: (err: ?Error, buffer: Buffer) => void