Skip to content

Commit 246fb91

Browse files
committed
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
1 parent 865268c commit 246fb91

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

types/events.d.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,14 @@ interface Params<Payload> {
1010
payload: Payload;
1111
}
1212

13-
// Consumers of this library should not care exactly what this is. Just that
14-
// it's a lambda function which should be exported as a handler.
15-
type LambdaFunction = unknown;
16-
1713
interface EventsOrQueues<PublishResult> {
1814
publish<Payload = any>(params: Params<Payload>): Promise<PublishResult>;
1915
publish<Payload = any>(
2016
params: Params<Payload>,
2117
callback: Callback<PublishResult>,
2218
): void;
23-
subscribe<Event = any>(
24-
handler:
25-
| ((event: Event) => Promise<void>)
26-
| ((event: Event, callback: Callback<void>) => void),
27-
): LambdaFunction;
19+
subscribe<Event = any>(handler: (e: Event) => Promise<void>): (e: Event) => Promise<void>;
20+
subscribe<Event = any>(handler: (e: Event, callback: Callback<PublishResult>) => void): (e: Event, context: any, callback: Callback<PublishResult>) => void;
2821
}
2922

3023
export type ArcEvents = EventsOrQueues<SnsPublishResponse>;

0 commit comments

Comments
 (0)