mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 16:48:50 +00:00
trick typescript into accepting our types.
This commit is contained in:
9
pool.ts
9
pool.ts
@@ -1,4 +1,4 @@
|
||||
import { relayInit, type Relay, type Sub, type SubscriptionOptions } from './relay.ts'
|
||||
import { relayInit, eventsGenerator, type Relay, type Sub, type SubscriptionOptions } from './relay.ts'
|
||||
import { normalizeURL } from './utils.ts'
|
||||
|
||||
import type { Event } from './event.ts'
|
||||
@@ -118,10 +118,10 @@ export class SimplePool {
|
||||
}
|
||||
})
|
||||
|
||||
let greaterSub: Sub = {
|
||||
let greaterSub: Sub<K> = {
|
||||
sub(filters, opts) {
|
||||
subs.forEach(sub => sub.sub(filters, opts))
|
||||
return greaterSub
|
||||
return greaterSub as any
|
||||
},
|
||||
unsub() {
|
||||
subs.forEach(sub => sub.unsub())
|
||||
@@ -138,6 +138,9 @@ export class SimplePool {
|
||||
eventListeners.delete(cb)
|
||||
} else if (type === 'eose') eoseListeners.delete(cb as () => void | Promise<void>)
|
||||
},
|
||||
get events() {
|
||||
return eventsGenerator(greaterSub)
|
||||
},
|
||||
}
|
||||
|
||||
return greaterSub
|
||||
|
||||
Reference in New Issue
Block a user