Skip to content

Commit

Permalink
fix(typings): allow async listener in typed events
Browse files Browse the repository at this point in the history
So that:

```ts
socket.on("my-event", async () => {
  // ...
});
```

is valid under the @typescript-eslint/no-misused-promises rule.

Related: #1486
  • Loading branch information
darrachequesne committed Aug 30, 2021
1 parent 4e1b656 commit 66e00b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/typed-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type ReservedOrUserListener<
* Needed because of https://github.com/microsoft/TypeScript/issues/41778
*/
type FallbackToUntypedListener<T> = [T] extends [never]
? (...args: any[]) => void
? (...args: any[]) => void | Promise<void>
: T;

/**
Expand Down

0 comments on commit 66e00b7

Please sign in to comment.