Skip to content

Commit

Permalink
fix: typeof server
Browse files Browse the repository at this point in the history
  • Loading branch information
linyyyang committed Jan 13, 2023
1 parent 77d07d2 commit af1ef45
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/api/koatty_serve.httpserver.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Start Server
<b>Signature:</b>

```typescript
Start(listenCallback?: () => void): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
Start(listenCallback?: () => void): Server<typeof IncomingMessage, typeof ServerResponse>;
```

## Parameters
Expand All @@ -20,5 +20,5 @@ Start(listenCallback?: () => void): Server<typeof import("http").IncomingMessage

<b>Returns:</b>

Server&lt;typeof import("http").IncomingMessage, typeof import("http").ServerResponse&gt;
Server&lt;typeof IncomingMessage, typeof ServerResponse&gt;

4 changes: 2 additions & 2 deletions docs/api/koatty_serve.httpsserver.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Start Server
<b>Signature:</b>

```typescript
Start(listenCallback?: () => void): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
Start(listenCallback?: () => void): Server<typeof IncomingMessage, typeof ServerResponse>;
```

## Parameters
Expand All @@ -20,5 +20,5 @@ Start(listenCallback?: () => void): Server<typeof import("http").IncomingMessage

<b>Returns:</b>

Server&lt;typeof import("http").IncomingMessage, typeof import("http").ServerResponse&gt;
Server&lt;typeof IncomingMessage, typeof ServerResponse&gt;

4 changes: 2 additions & 2 deletions docs/api/koatty_serve.wsserver.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Start Server
<b>Signature:</b>

```typescript
Start(listenCallback?: () => void): HttpServer<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | HttpsServer<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
Start(listenCallback?: () => void): HttpServer<typeof IncomingMessage, typeof ServerResponse>;
```

## Parameters
Expand All @@ -20,7 +20,7 @@ Start(listenCallback?: () => void): HttpServer<typeof import("http").IncomingMes

<b>Returns:</b>

HttpServer&lt;typeof import("http").IncomingMessage, typeof import("http").ServerResponse&gt; \| HttpsServer&lt;typeof import("http").IncomingMessage, typeof import("http").ServerResponse&gt;
HttpServer&lt;typeof IncomingMessage, typeof ServerResponse&gt;

{<!-- -->\*<!-- -->} WsServer

6 changes: 3 additions & 3 deletions src/http/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* @Usage:
* @Author: richen
* @Date: 2021-06-28 15:06:13
* @LastEditTime: 2022-11-16 16:04:58
* @LastEditTime: 2023-01-13 16:03:35
*/
import { createServer, Server } from "http";
import { createServer, IncomingMessage, Server, ServerResponse } from "http";
import { Koatty, KoattyServer } from "koatty_core";
import { CreateTerminus } from "../terminus";
import { DefaultLogger as Logger } from "koatty_logger";
Expand Down Expand Up @@ -40,7 +40,7 @@ export class HttpServer implements KoattyServer {
* @param {() => void} listenCallback
* @memberof Http
*/
Start(listenCallback?: () => void) {
Start(listenCallback?: () => void): Server<typeof IncomingMessage, typeof ServerResponse> {
listenCallback = listenCallback ? listenCallback : this.listenCallback;
return this.server.listen({
port: this.options.port,
Expand Down
4 changes: 2 additions & 2 deletions src/http/http2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Usage:
* @Author: richen
* @Date: 2021-06-28 15:06:13
* @LastEditTime: 2022-11-16 16:05:09
* @LastEditTime: 2023-01-13 16:04:05
*/
import { createSecureServer, Http2SecureServer, SecureServerOptions } from "http2";
import { CreateTerminus } from "../terminus";
Expand Down Expand Up @@ -45,7 +45,7 @@ export class Http2Server implements KoattyServer {
* @param {() => void} listenCallback
* @memberof Http2Server
*/
Start(listenCallback?: () => void) {
Start(listenCallback?: () => void): Http2SecureServer {
listenCallback = listenCallback ? listenCallback : this.listenCallback;
return this.server.listen({
port: this.options.port,
Expand Down
5 changes: 3 additions & 2 deletions src/http/https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* @Usage:
* @Author: richen
* @Date: 2021-11-12 11:48:01
* @LastEditTime: 2022-11-16 16:05:17
* @LastEditTime: 2023-01-13 16:04:34
*/
import { createServer, Server, ServerOptions } from "https";
import { Koatty, KoattyServer } from "koatty_core";
import { CreateTerminus } from "../terminus";
import { DefaultLogger as Logger } from "koatty_logger";
import { ListeningOptions } from "../index";
import { IncomingMessage, ServerResponse } from "http";

/**
*
Expand Down Expand Up @@ -52,7 +53,7 @@ export class HttpsServer implements KoattyServer {
* @param {() => void} listenCallback
* @memberof Https
*/
Start(listenCallback?: () => void) {
Start(listenCallback?: () => void): Server<typeof IncomingMessage, typeof ServerResponse> {
listenCallback = listenCallback ? listenCallback : this.listenCallback;
return this.server.listen({
port: this.options.port,
Expand Down
6 changes: 3 additions & 3 deletions src/websocket/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* @Usage:
* @Author: richen
* @Date: 2021-11-12 11:29:16
* @LastEditTime: 2022-11-16 16:05:42
* @LastEditTime: 2023-01-13 16:05:07
*/
import { DefaultLogger as Logger } from "koatty_logger";
import { Koatty, KoattyServer } from 'koatty_core';
import { ServerOptions, WebSocketServer } from 'ws';
import { CreateTerminus } from "../terminus";
import { Server as HttpServer, createServer } from "http";
import { Server as HttpServer, IncomingMessage, ServerResponse, createServer } from "http";
import { Server as HttpsServer, createServer as httpsCreateServer, ServerOptions as httpsServerOptions } from "https";
import { ListeningOptions } from "../index";
import { Helper } from "koatty_lib";
Expand Down Expand Up @@ -59,7 +59,7 @@ export class WsServer implements KoattyServer {
* @returns {*}
* @memberof WsServer
*/
Start(listenCallback?: () => void) {
Start(listenCallback?: () => void): HttpServer<typeof IncomingMessage, typeof ServerResponse> {
listenCallback = listenCallback ? listenCallback : this.listenCallback;
return this.httpServer.listen({
port: this.options.port,
Expand Down

0 comments on commit af1ef45

Please sign in to comment.