From 2767eea70e1be462a570d2d65d55678609b60bbf Mon Sep 17 00:00:00 2001 From: HexaField Date: Sat, 16 Oct 2021 19:25:48 +1100 Subject: [PATCH 1/2] fix server not being attached when not a direct instance of https.Server or number --- lib/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 5f9427c3c2..f31f187602 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -156,9 +156,7 @@ export class Server< this.adapter(opts.adapter || Adapter); this.sockets = this.of("/"); this.opts = opts; - if (srv instanceof http.Server || typeof srv === "number") { - this.attach(srv); - } + if (srv) this.attach(srv as http.Server | number); } /** From 991e062a9a48019adcc2190331220a24fbae9365 Mon Sep 17 00:00:00 2001 From: HexaField Date: Sat, 16 Oct 2021 19:40:03 +1100 Subject: [PATCH 2/2] fix test --- lib/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.ts b/lib/index.ts index f31f187602..72c87ef677 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -156,7 +156,7 @@ export class Server< this.adapter(opts.adapter || Adapter); this.sockets = this.of("/"); this.opts = opts; - if (srv) this.attach(srv as http.Server | number); + if (srv || typeof srv == "number") this.attach(srv as http.Server | number); } /**