From 08ccc4449f3ce12214331ef7dac25b12fd8866e4 Mon Sep 17 00:00:00 2001 From: filmaj Date: Sat, 17 Aug 2024 17:03:29 -0400 Subject: [PATCH] Fix event.subscribe types: arc.events.subscribe does not return unknown, but a function returning a promise or not, depending on whether an async or callback function was provided to subscribe dont care about args to callbacks --- types/events.d.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/types/events.d.ts b/types/events.d.ts index 5c5fada3..445f9f29 100644 --- a/types/events.d.ts +++ b/types/events.d.ts @@ -10,21 +10,14 @@ interface Params { payload: Payload; } -// Consumers of this library should not care exactly what this is. Just that -// it's a lambda function which should be exported as a handler. -type LambdaFunction = unknown; - interface EventsOrQueues { publish(params: Params): Promise; publish( params: Params, callback: Callback, ): void; - subscribe( - handler: - | ((event: Event) => Promise) - | ((event: Event, callback: Callback) => void), - ): LambdaFunction; + subscribe(handler: (e: Event) => Promise): (e: Event) => Promise; + subscribe(handler: (e: Event, callback: Function) => void): (e: Event, context: any, callback: Function) => void; } export type ArcEvents = EventsOrQueues;