Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b43c91

Browse files
h110mdarrachequesne
authored andcommitted
fix(typings): add HTTPS server to accepted types (#4351)
1 parent8ecfcba commit9b43c91

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

‎lib/index.ts‎

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importhttp= require("http");
2+
importtype{ServerasHTTPSServer}from"https";
23
import{createReadStream}from"fs";
34
import{createDeflate,createGzip,createBrotliCompress}from"zlib";
45
importaccepts= require("accepts");
@@ -131,7 +132,7 @@ export class Server<
131132
*@private
132133
*/
133134
_connectTimeout:number;
134-
privatehttpServer:http.Server;
135+
privatehttpServer:http.Server|HTTPSServer;
135136

136137
/**
137138
* Server constructor.
@@ -141,13 +142,26 @@ export class Server<
141142
*@public
142143
*/
143144
constructor(opts?:Partial<ServerOptions>);
144-
constructor(srv?:http.Server|number,opts?:Partial<ServerOptions>);
145145
constructor(
146-
srv:undefined|Partial<ServerOptions>|http.Server|number,
146+
srv?:http.Server|HTTPSServer|number,
147147
opts?:Partial<ServerOptions>
148148
);
149149
constructor(
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,
151165
opts:Partial<ServerOptions>={}
152166
){
153167
super();
@@ -167,7 +181,8 @@ export class Server<
167181
this.adapter(opts.adapter||Adapter);
168182
this.sockets=this.of("/");
169183
this.opts=opts;
170-
if(srv||typeofsrv=="number")this.attach(srvashttp.Server|number);
184+
if(srv||typeofsrv=="number")
185+
this.attach(srvashttp.Server|HTTPSServer|number);
171186
}
172187

173188
/**
@@ -300,7 +315,7 @@ export class Server<
300315
*@public
301316
*/
302317
publiclisten(
303-
srv:http.Server|number,
318+
srv:http.Server|HTTPSServer|number,
304319
opts:Partial<ServerOptions>={}
305320
): this{
306321
returnthis.attach(srv,opts);
@@ -315,7 +330,7 @@ export class Server<
315330
*@public
316331
*/
317332
publicattach(
318-
srv:http.Server|number,
333+
srv:http.Server|HTTPSServer|number,
319334
opts:Partial<ServerOptions>={}
320335
): this{
321336
if("function"==typeofsrv){
@@ -421,7 +436,7 @@ export class Server<
421436
*@private
422437
*/
423438
privateinitEngine(
424-
srv:http.Server,
439+
srv:http.Server|HTTPSServer,
425440
opts:EngineOptions&AttachOptions
426441
):void{
427442
// initialize engine
@@ -444,7 +459,7 @@ export class Server<
444459
*@param srv http server
445460
*@private
446461
*/
447-
privateattachServe(srv:http.Server):void{
462+
privateattachServe(srv:http.Server|HTTPSServer):void{
448463
debug("attaching client serving req handler");
449464

450465
constevs=srv.listeners("request").slice(0);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp