From: Chris Duncan Date: Tue, 3 Dec 2024 23:00:30 +0000 (-0800) Subject: Remove unused blake2b import. Remove typescript no-check flags and start adding typings. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=ad75e152bee59642fd7f6807c7131d4314e85d46;p=libnemo.git Remove unused blake2b import. Remove typescript no-check flags and start adding typings. --- diff --git a/src/lib/nano-nacl.ts b/src/lib/nano-nacl.ts index 9a38cf8..5fc5202 100644 --- a/src/lib/nano-nacl.ts +++ b/src/lib/nano-nacl.ts @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: 2024 Chris Duncan // SPDX-License-Identifier: GPL-3.0-or-later -//@ts-nocheck + 'use strict' import { Blake2b } from './blake2b.js' @@ -27,6 +27,7 @@ const n = () => { d.publicKey = convert(d.privateKey) } const buf = new TextEncoder().encode(JSON.stringify(data)).buffer + //@ts-expect-error postMessage(buf, [buf]) }) diff --git a/src/lib/pow.ts b/src/lib/pow.ts index 5f8485c..547a758 100644 --- a/src/lib/pow.ts +++ b/src/lib/pow.ts @@ -1,14 +1,12 @@ // SPDX-FileCopyrightText: 2024 Chris Duncan // SPDX-License-Identifier: GPL-3.0-or-later -//@ts-nocheck -import { Blake2b } from './blake2b.js' const p = () => { const SEND_THRESHOLD = '0xfffffff8' /** * Listens for messages from a calling function. */ - addEventListener('message', (message) => { + addEventListener('message', message => { const data = JSON.parse(new TextDecoder().decode(message.data ?? message)) for (const d of data) { if (d === 'stop') { @@ -69,7 +67,7 @@ const p = () => { return out } - function calculate (hashHex, callback, progressCallback, threshold = '0xFFFFFFF8') { + function calculate (hashHex: string, callback: (nonce: string) => any, progressCallback: (frames: number) => any, threshold: number | string = '0xFFFFFFF8'): void { if (typeof threshold === 'number') threshold = '0x' + threshold.toString(16) const canvas = new OffscreenCanvas(webglWidth, webglHeight)