story-research-zapwall/fixKnowledge/2025-12-22-lint-type-fixes.md
2025-12-23 02:20:57 +01:00

1.6 KiB

Lint & type fixes (exactOptionalPropertyTypes)

Problem: TypeScript strict optional props and nostr-tools API differences caused npm run type-check and next lint to fail.

Impact: Build blocked (exact optional props errors, nostr-tools signing types), lint blocked (max-lines-per-function, prefer-const).

Root cause: Code was written against older nostr-tools typings and passed undefined into optional props under exactOptionalPropertyTypes.

Corrections (code):

  • Normalized optional props handling (conditional spreads) across editor, fields, notifications, storage, markdown rendering.
  • Added safe category handling for article drafts; tightened defaults and guards.
  • Aligned signing with nostr-tools 1.17.0 (explicit pubkey/created_at, hash/sign helpers).
  • Fixed async return contracts, removed unused params, and satisfied lint structure rules.
  • Kept storage and notification payloads free of undefined fields; guarded link rendering.

Modifications (files): components/ArticleEditor*.tsx, components/ArticleField.tsx, components/UserArticles.tsx, components/CategorySelect.tsx, lib/{nostr,nostrRemoteSigner,nostrconnect,articlePublisher,articleStorage,markdownRenderer,notifications,zapVerification}.ts, hooks/useArticles.ts, hooks/useUserArticles.ts, types/nostr-tools-extended.ts, package.json (nostr-tools 1.17.0).

Deployment: No special steps; run npm run lint && npm run type-check (already clean).

Analysis: Ensured strict optional handling without fallbacks, restored compatibility with stable nostr-tools API, and kept functions within lint boundaries.