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:
Tristan
2022-12-25 13:30:52 +01:00
committed by fiatjaf
parent cc2250da1f
commit 8071e2f4fa

View File

@@ -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