From 25106fe5c44d086380b6761f4c405c18dac3894e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 09:18:26 +0000 Subject: [PATCH] fix: improve type definitions for Buffer and Uint8Array Co-Authored-By: shryas.londhe@gmail.com --- packages/helpers/src/lib/mailauth/tools.ts | 7 ++----- packages/helpers/src/sha-utils.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/helpers/src/lib/mailauth/tools.ts b/packages/helpers/src/lib/mailauth/tools.ts index 3b0b2298..53a9395d 100644 --- a/packages/helpers/src/lib/mailauth/tools.ts +++ b/packages/helpers/src/lib/mailauth/tools.ts @@ -24,16 +24,13 @@ const keyOrderingDKIM = ['v', 'a', 'c', 'd', 'h', 'i', 'l', 'q', 's', 't', 'x', export const writeToStream = async ( stream: DkimVerifier, - input: Buffer & { pipe: (...args: any) => void; on: (...args: any) => void }, + input: Buffer & NodeJS.ReadableStream, chunkSize: number = 0, ) => { chunkSize = chunkSize || 64 * 1024; if (typeof input === 'string') { - input = Buffer.from(input) as Buffer & { - pipe: (...args: any) => void; - on: (...args: any) => void; - }; + input = Buffer.from(input) as Buffer & NodeJS.ReadableStream; } return new Promise((resolve, reject) => { diff --git a/packages/helpers/src/sha-utils.ts b/packages/helpers/src/sha-utils.ts index c74bb65f..16501c84 100644 --- a/packages/helpers/src/sha-utils.ts +++ b/packages/helpers/src/sha-utils.ts @@ -19,7 +19,7 @@ export function findIndexInUint8Array(array: Uint8Array, selector: Uint8Array): return -1; } -export function padUint8ArrayWithZeros(array: Uint8Array, length: number) { +export function padUint8ArrayWithZeros(array: Uint8Array, length: number): Uint8Array { while (array.length < length) { // eslint-disable-next-line no-param-reassign array = mergeUInt8Arrays(array, int8toBytes(0));