11import http = require( "http" ) ;
2+ import type { Server as HTTPSServer } from "https" ;
23import { createReadStream } from "fs" ;
34import { createDeflate , createGzip , createBrotliCompress } from "zlib" ;
45import accepts = require( "accepts" ) ;
@@ -131,7 +132,7 @@ export class Server<
131132 *@private
132133 */
133134_connectTimeout :number ;
134- private httpServer :http . Server ;
135+ private httpServer :http . Server | HTTPSServer ;
135136
136137/**
137138 * Server constructor.
@@ -141,13 +142,26 @@ export class Server<
141142 *@public
142143 */
143144constructor ( opts ?:Partial < ServerOptions > ) ;
144- constructor ( srv ?:http . Server | number , opts ?:Partial < ServerOptions > ) ;
145145constructor (
146- srv : undefined | Partial < ServerOptions > | http . Server | number ,
146+ srv ?: http . Server | HTTPSServer | number ,
147147opts ?:Partial < ServerOptions >
148148) ;
149149constructor (
150- srv :undefined | Partial < ServerOptions > | http . Server | number ,
150+ srv :
151+ | undefined
152+ | Partial < ServerOptions >
153+ | http . Server
154+ | HTTPSServer
155+ | number ,
156+ opts ?:Partial < ServerOptions >
157+ ) ;
158+ constructor (
159+ srv :
160+ | undefined
161+ | Partial < ServerOptions >
162+ | http . Server
163+ | HTTPSServer
164+ | number ,
151165opts :Partial < ServerOptions > = { }
152166) {
153167super ( ) ;
@@ -167,7 +181,8 @@ export class Server<
167181this . adapter ( opts . adapter || Adapter ) ;
168182this . sockets = this . of ( "/" ) ;
169183this . opts = opts ;
170- if ( srv || typeof srv == "number" ) this . attach ( srv as http . Server | number ) ;
184+ if ( srv || typeof srv == "number" )
185+ this . attach ( srv as http . Server | HTTPSServer | number ) ;
171186}
172187
173188/**
@@ -300,7 +315,7 @@ export class Server<
300315 *@public
301316 */
302317public listen (
303- srv :http . Server | number ,
318+ srv :http . Server | HTTPSServer | number ,
304319opts :Partial < ServerOptions > = { }
305320) : this{
306321return this . attach ( srv , opts ) ;
@@ -315,7 +330,7 @@ export class Server<
315330 *@public
316331 */
317332public attach (
318- srv :http . Server | number ,
333+ srv :http . Server | HTTPSServer | number ,
319334opts :Partial < ServerOptions > = { }
320335) : this{
321336if ( "function" == typeof srv ) {
@@ -421,7 +436,7 @@ export class Server<
421436 *@private
422437 */
423438private initEngine (
424- srv :http . Server ,
439+ srv :http . Server | HTTPSServer ,
425440opts :EngineOptions & AttachOptions
426441) :void {
427442// initialize engine
@@ -444,7 +459,7 @@ export class Server<
444459 *@param srv http server
445460 *@private
446461 */
447- private attachServe ( srv :http . Server ) :void {
462+ private attachServe ( srv :http . Server | HTTPSServer ) :void {
448463debug ( "attaching client serving req handler" ) ;
449464
450465const evs = srv . listeners ( "request" ) . slice ( 0 ) ;