mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
Make opts arg optional for sub method
In the README and the code, it looks like the second argument for the relay's `sub` method is optional:
```typescript
let sub = relay.sub([
{
ids: ['d7dd5eb3ab747e16f8d0212d53032ea2a7cadef53837e5a6c66d42849fcb9027']
}
])
```
In the type definitions it's required however, which leads to an error in editors. Let's mark it as optional in the type definitions too! 👍
This commit is contained in:
2
relay.ts
2
relay.ts
@@ -10,7 +10,7 @@ export type Relay = {
|
|||||||
status: number
|
status: number
|
||||||
connect: () => Promise<void>
|
connect: () => Promise<void>
|
||||||
close: () => Promise<void>
|
close: () => Promise<void>
|
||||||
sub: (filters: Filter[], opts: SubscriptionOptions) => Sub
|
sub: (filters: Filter[], opts?: SubscriptionOptions) => Sub
|
||||||
publish: (event: Event) => Pub
|
publish: (event: Event) => Pub
|
||||||
on: (type: RelayEvent, cb: any) => void
|
on: (type: RelayEvent, cb: any) => void
|
||||||
off: (type: RelayEvent, cb: any) => void
|
off: (type: RelayEvent, cb: any) => void
|
||||||
|
|||||||
Reference in New Issue
Block a user