diff --git a/eslint.config.js b/eslint.config.js index a361d046e..826ea03c8 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -54,11 +54,6 @@ export default [...compat.extends( "no-case-declarations": "off", quotes: "off", - "@/quotes": ["error", "single", { - avoidEscape: true, - allowTemplateLiterals: true, - }], - "prefer-rest-params": "off", "no-bitwise": "off", "no-console": "off", diff --git a/ts_src/psbt/psbtutils.ts b/ts_src/psbt/psbtutils.ts index 298f4769c..3d5dcced3 100644 --- a/ts_src/psbt/psbtutils.ts +++ b/ts_src/psbt/psbtutils.ts @@ -4,6 +4,7 @@ import * as bscript from '../script.js'; import { Transaction } from '../transaction.js'; import { hash160 } from '../crypto.js'; import * as payments from '../payments/index.js'; +import type { PaymentCreator } from '../payments/index.js'; import * as tools from 'uint8array-tools'; /** @@ -11,7 +12,7 @@ import * as tools from 'uint8array-tools'; * @param payment The payment factory to check. * @returns A function that takes a script and returns a boolean indicating whether the payment factory can generate a payment script from the script. */ -function isPaymentFactory(payment: any): (script: Uint8Array) => boolean { +function isPaymentFactory(payment: PaymentCreator): (script: Uint8Array) => boolean { return (script: Uint8Array): boolean => { try { payment({ output: script }); diff --git a/ts_src/types.ts b/ts_src/types.ts index 975f408c8..d9d11d4a6 100644 --- a/ts_src/types.ts +++ b/ts_src/types.ts @@ -58,8 +58,8 @@ export interface Tapleaf { } export const TAPLEAF_VERSION_MASK = 0xfe; -export function isTapleaf(o: any): o is Tapleaf { - if (!o || !('output' in o)) return false; +export function isTapleaf(o: unknown): o is Tapleaf { + if (!o || typeof o !== 'object' || !('output' in o)) return false; if (!(o.output instanceof Uint8Array)) return false; if (o.version !== undefined) return (o.version & TAPLEAF_VERSION_MASK) === o.version; @@ -67,16 +67,16 @@ export function isTapleaf(o: any): o is Tapleaf { } /** - * Binary tree repsenting script path spends for a Taproot input. + * Binary tree representing script path spends for a Taproot input. * Each node is either a single Tapleaf, or a pair of Tapleaf | Taptree. * The tree has no balancing requirements. */ export type Taptree = [Taptree | Tapleaf, Taptree | Tapleaf] | Tapleaf; -export function isTaptree(scriptTree: any): scriptTree is Taptree { +export function isTaptree(scriptTree: unknown): scriptTree is Taptree { if (!Array.isArray(scriptTree)) return isTapleaf(scriptTree); if (scriptTree.length !== 2) return false; - return scriptTree.every((t: any) => isTaptree(t)); + return scriptTree.every((t: unknown) => isTaptree(t)); } export interface TinySecp256k1Interface { @@ -110,7 +110,7 @@ export const SatoshiSchema = v.pipe( v.maxValue(0x7fff_ffff_ffff_ffffn), ); -export const NullablePartial = (a: Record) => +export const NullablePartial = (a: Record) => v.object( Object.entries(a).reduce( (acc, next) => ({ ...acc, [next[0]]: v.nullish(next[1]) }),