From: Chris Duncan Date: Tue, 26 Nov 2024 21:41:13 +0000 (-0800) Subject: Clarify array typings. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=cad73bed172c6804eb9fa5fd8b21b759f53d6991;p=libnemo.git Clarify array typings. --- diff --git a/src/lib/convert.ts b/src/lib/convert.ts index 630b894..41bb662 100644 --- a/src/lib/convert.ts +++ b/src/lib/convert.ts @@ -45,7 +45,7 @@ export const bin = { * @returns {Uint8Array} Byte array representation of the input string */ toBytes (bin: string): Uint8Array { - const bytes = [] + const bytes: number[] = [] while (bin.length > 0) { const bits = bin.substring(0, 8) bytes.push(parseInt(bits, 2)) @@ -222,7 +222,7 @@ export const dec = { throw new TypeError('Invalid padding') } let integer = BigInt(decimal) - const bytes = [] + const bytes: number[] = [] while (integer > 0) { const lsb = BigInt.asUintN(8, integer) bytes.push(Number(lsb))