From 66e00b7dd7c4a09072cfd84c78e6e15ec52039f5 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Mon, 30 Aug 2021 07:33:34 +0200 Subject: [PATCH] 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: https://github.com/socketio/socket.io-client/issues/1486 --- lib/typed-events.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/typed-events.ts b/lib/typed-events.ts index 4294e44c..f759d1d3 100644 --- a/lib/typed-events.ts +++ b/lib/typed-events.ts @@ -58,7 +58,7 @@ export type ReservedOrUserListener< * Needed because of https://github.com/microsoft/TypeScript/issues/41778 */ type FallbackToUntypedListener = [T] extends [never] - ? (...args: any[]) => void + ? (...args: any[]) => void | Promise : T; /**