Skip to content

Commit ccfd8ca

Browse files
committedAug 30, 2021
fix(typings): allow async listener in typed events
So that: ```ts socket.on("my-event", async () => { // ... }); ``` is valid under the @typescript-eslint/no-misused-promises rule. Related: socketio/socket.io-client#1486
1 parent 24fee27 commit ccfd8ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎lib/typed-events.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export type ReservedOrUserListener<
5858
* Needed because of https://github.com/microsoft/TypeScript/issues/41778
5959
*/
6060
type FallbackToUntypedListener<T> = [T] extends [never]
61-
? (...args: any[]) => void
61+
? (...args: any[]) => void | Promise<void>
6262
: T;
6363

6464
/**

0 commit comments

Comments
 (0)
Please sign in to comment.