You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that there's a type mismatch. The type Event in nostr-tools has id and sig as optional. But when receiving an event from a relay, those two parameters must exist. So the type of events from a relay is, I believe, actually a Required<Event>.
I suspect that the type should be Required<NostrEvent> here:
It looks to me as though the type of what a subscription.on('event', cb) receives (so the type of the argument passed to cb) is not specified in nostr-tools. I think that means that by changing line 136 above to Required<NostrEvent> the type would be correct.
I noticed this because when I'm trying to read the id of events in React, TypeScript complains the id could be undfined. I don't think it can be when it comes from a relay.
Apologies if this is not very clear! I'll try to explain it more clearly if this doesn't make sense.
The text was updated successfully, but these errors were encountered:
I think that there's a type mismatch. The type
Event
in nostr-tools hasid
andsig
as optional. But when receiving an event from a relay, those two parameters must exist. So the type of events from a relay is, I believe, actually aRequired<Event>
.I suspect that the type should be
Required<NostrEvent>
here:nostr-react/src/core.tsx
Line 136 in 55d9f5f
It looks to me as though the type of what a
subscription.on('event', cb)
receives (so the type of the argument passed tocb
) is not specified in nostr-tools. I think that means that by changing line 136 above toRequired<NostrEvent>
the type would be correct.I noticed this because when I'm trying to read the
id
of events in React, TypeScript complains theid
could beundfined
. I don't think it can be when it comes from a relay.Apologies if this is not very clear! I'll try to explain it more clearly if this doesn't make sense.
The text was updated successfully, but these errors were encountered: