fix: resolve variable naming conflicts and unused variables

Fix remaining TypeScript compilation errors:

1. Remove unused 'nostrUri' from addNodeView destructuring
   - Not needed since we have all individual pieces (eventId, identifier, etc.)

2. Fix variable naming conflict in paste handler
   - Rename 'identifier' (nip19 encoded string) to 'nip19String'
   - Prevents shadowing with 'identifier' (naddr d tag value)
   - Fixes TS6133, TS2448, TS2454 errors

Changes:
- Line 321: Remove nostrUri from node.attrs destructuring
- Line 399: Rename identifier → nip19String
- Line 402: Use nip19String in decode()
- Line 445: Use nip19String in nostr: URI construction

All variable scoping and naming conflicts now resolved.
This commit is contained in:
Claude
2026-01-19 21:02:11 +00:00
parent ccaee2656c
commit 07fb465e69

View File

@@ -318,8 +318,7 @@ const EventMentionNode = Node.create({
addNodeView() {
return ({ node }) => {
const { decodedType, kind, nostrUri, eventId, pubkey, identifier } =
node.attrs;
const { decodedType, kind, eventId, pubkey, identifier } = node.attrs;
// Create wrapper span
const dom = document.createElement("span");
@@ -397,10 +396,10 @@ const EventMentionNode = Node.create({
const matchedText = matches[0];
// Strip "nostr:" prefix if present for decoding
const identifier = matchedText.replace(/^nostr:/i, "");
const nip19String = matchedText.replace(/^nostr:/i, "");
try {
const decoded = nip19.decode(identifier);
const decoded = nip19.decode(nip19String);
// Handle profile identifiers (npub/nprofile) - convert to @ mention
if (decoded.type === "npub") {
@@ -443,7 +442,7 @@ const EventMentionNode = Node.create({
// Always store with "nostr:" prefix for consistency
const nostrUri = matchedText.startsWith("nostr:")
? matchedText
: `nostr:${identifier}`;
: `nostr:${nip19String}`;
let decodedType: string;
let eventId: string | null = null;