From 4558c6039b5739f185aedc23e87cbfa02f90d649 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 12 Jan 2026 16:00:45 +0000 Subject: [PATCH] fix: resolve remaining TypeScript strict type errors ## BaseEventRenderer - Import React namespace for React.MouseEvent types ## thread-builder - Remove unused EventPointer and AddressPointer imports - Remove unused isReplaceable variable - Add type annotation for tag array parameter (t: string[]) - Remove unused npub variable, add TODO comment ## ComposeDialog - Replace Badge component with div to avoid asChild prop issue - Use inline-flex with Tailwind classes for mention badges ## RelaySelector - Add explicit string[] type assertion for knownRelays array - Fixes "unknown[]" inference from Map.keys() All type errors fixed except environmental issues (missing deps). --- src/components/ComposeDialog.tsx | 10 +++------- src/components/RelaySelector.tsx | 2 +- src/components/nostr/kinds/BaseEventRenderer.tsx | 2 +- src/lib/thread-builder.ts | 12 +++++------- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/components/ComposeDialog.tsx b/src/components/ComposeDialog.tsx index 507a290..0e86d29 100644 --- a/src/components/ComposeDialog.tsx +++ b/src/components/ComposeDialog.tsx @@ -391,13 +391,9 @@ function MentionBadge({ const displayName = getDisplayName(pubkey, profile); return ( - +
- {displayName} + {displayName} - +
); } diff --git a/src/components/RelaySelector.tsx b/src/components/RelaySelector.tsx index c7103b2..6a0387e 100644 --- a/src/components/RelaySelector.tsx +++ b/src/components/RelaySelector.tsx @@ -104,7 +104,7 @@ export function RelaySelector({ ); // Get all known relays from pool - const knownRelays = Array.from(relayStats.keys()); + const knownRelays: string[] = Array.from(relayStats.keys()) as string[]; return ( diff --git a/src/components/nostr/kinds/BaseEventRenderer.tsx b/src/components/nostr/kinds/BaseEventRenderer.tsx index 05fb9e8..e9fa821 100644 --- a/src/components/nostr/kinds/BaseEventRenderer.tsx +++ b/src/components/nostr/kinds/BaseEventRenderer.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import React, { useState } from "react"; import { NostrEvent } from "@/types/nostr"; import { UserName } from "../UserName"; import { KindBadge } from "@/components/KindBadge"; diff --git a/src/lib/thread-builder.ts b/src/lib/thread-builder.ts index 0e9defe..c397263 100644 --- a/src/lib/thread-builder.ts +++ b/src/lib/thread-builder.ts @@ -1,5 +1,4 @@ import type { NostrEvent } from "nostr-tools/core"; -import type { EventPointer, AddressPointer } from "nostr-tools/nip19"; import { getNip10References } from "applesauce-common/helpers/threading"; /** @@ -108,13 +107,12 @@ export function buildNip22Tags( // Add K tag (kind of parent event) tags.push(["K", String(replyTo.kind)]); - // Check if this is a replaceable event (30000-39999) - const isReplaceable = replyTo.kind >= 30000 && replyTo.kind < 40000; + // Check if this is a parameterized replaceable event (30000-39999) const isParameterized = replyTo.kind >= 30000 && replyTo.kind < 40000; if (isParameterized) { // Use A tag for parameterized replaceable events - const dTag = replyTo.tags.find((t) => t[0] === "d")?.[1] || ""; + const dTag = replyTo.tags.find((t: string[]) => t[0] === "d")?.[1] || ""; const coordinate = `${replyTo.kind}:${replyTo.pubkey}:${dTag}`; const relay = replyTo.relay; tags.push(relay ? ["A", coordinate, relay] : ["A", coordinate]); @@ -187,10 +185,10 @@ export function extractMentionsFromContent(content: string): string[] { for (const match of matches) { try { - // Remove "nostr:" prefix and decode npub - const npub = match.replace("nostr:", ""); - // We'll need to decode this - for now just extract the pattern + // Remove "nostr:" prefix + // TODO: decode npub to pubkey // The MentionEditor already handles encoding, so we can extract from tags instead + // This function is a placeholder for future enhancement } catch { // Skip invalid npubs }