Skip to content

Commit

Permalink
fix(typescript): infer TTransformed from createEventHandler() opt…
Browse files Browse the repository at this point in the history
…ions (#459)
  • Loading branch information
jablko authored Feb 11, 2021
1 parent 80ee43f commit d2a0b73
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/event-handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { receiverHandle as receive } from "./receive";
import { removeListener } from "./remove-listener";

interface EventHandler<TTransformed = unknown> {
interface EventHandler<TTransformed> {
on<E extends EmitterWebhookEventName>(
event: E | E[],
callback: HandlerFunction<E, TTransformed>
Expand All @@ -28,7 +28,9 @@ interface EventHandler<TTransformed = unknown> {
receive(event: EmitterWebhookEvent): Promise<void>;
}

export function createEventHandler(options: Options<any>): EventHandler {
export function createEventHandler<TTransformed>(
options: Options<any, TTransformed>
): EventHandler<TTransformed> {
const state: State = {
hooks: {},
};
Expand Down

0 comments on commit d2a0b73

Please sign in to comment.