From 8071e2f4fa49aaae7cfa212e0d8d4418ccebc337 Mon Sep 17 00:00:00 2001 From: Tristan Date: Sun, 25 Dec 2022 13:30:52 +0100 Subject: [PATCH] Make `opts` arg optional for `sub` method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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! 👍 --- relay.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relay.ts b/relay.ts index 4686fcd..f879ebc 100644 --- a/relay.ts +++ b/relay.ts @@ -10,7 +10,7 @@ export type Relay = { status: number connect: () => Promise close: () => Promise - sub: (filters: Filter[], opts: SubscriptionOptions) => Sub + sub: (filters: Filter[], opts?: SubscriptionOptions) => Sub publish: (event: Event) => Pub on: (type: RelayEvent, cb: any) => void off: (type: RelayEvent, cb: any) => void