From bda57b42efa66e1b87ee311df7a64157a54dcbdd Mon Sep 17 00:00:00 2001 From: Jordan Sexton Date: Mon, 4 Nov 2019 18:26:58 -0600 Subject: [PATCH] expand createHash API support (#39991) --- types/create-hash/index.d.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/types/create-hash/index.d.ts b/types/create-hash/index.d.ts index 35af12c772..a5e704454a 100644 --- a/types/create-hash/index.d.ts +++ b/types/create-hash/index.d.ts @@ -1,16 +1,24 @@ // Type definitions for create-hash 1.2 // Project: https://github.com/crypto-browserify/createHash // Definitions by: BendingBender , -// Konstantin Yuriev -// Max Boguslavskiy +// Konstantin Yuriev , +// Max Boguslavskiy , +// Jordan Sexton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 +/// + declare namespace createHash { + type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array; + interface HashAlgorithm { - update(data: string): void; - digest(target?: encoding): string; - write(data: string): void; + digest(target: encoding): string; + digest(): Buffer; + + update(data: string | Buffer | TypedArray | DataView, encoding?: string): this; + write(data: string | Buffer | TypedArray | DataView, encoding?: string): this; + end(): void; read(): void; }