diff --git a/packages/util/src/u8a/eq.ts b/packages/util/src/u8a/eq.ts index 708b2eb48..b28409aae 100644 --- a/packages/util/src/u8a/eq.ts +++ b/packages/util/src/u8a/eq.ts @@ -5,26 +5,14 @@ import type { HexString } from '../types'; import { u8aToU8a } from './toU8a'; -interface Constructor { +interface Constructor { BYTES_PER_ELEMENT: number; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - new(...args: any[]): T; + new(...args: unknown[]): T; } -// React-native does not have BigUint64Array, check others as well -const U64_BYTES = typeof BigUint64Array !== 'undefined' - ? BigUint64Array.BYTES_PER_ELEMENT - : 0; -const U32_BYTES = typeof Uint32Array !== 'undefined' - ? Uint32Array.BYTES_PER_ELEMENT - : 0; -const U16_BYTES = typeof Uint16Array !== 'undefined' - ? Uint16Array.BYTES_PER_ELEMENT - : 0; - // Creates a Uint8Array, ensuring that the alignment is correct -function createArray (Clazz: Constructor, value: Uint8Array): T { +function createArray (Clazz: Constructor, value: Uint8Array): T { // The byteOffset needs to match the size of the data, i.e. for Uint32 it needs to be 4 // NOTE: DataView doesn't have this limitation, but getters are slower const align = Clazz.BYTES_PER_ELEMENT; @@ -34,7 +22,7 @@ function createArray (a: T, b: T): boolean { +function equalsArray (a: T, b: T): boolean { for (let i = 0; i < a.length; i++) { if (a[i] !== b[i]) { return false; @@ -46,13 +34,12 @@ function equalsArray