Skip to content

Commit

Permalink
feat(plataform-express): replace any return type on #listen
Browse files Browse the repository at this point in the history
  • Loading branch information
micalevisk committed Oct 30, 2022
1 parent bff8527 commit d6a89fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/platform-express/adapters/express-adapter.ts
@@ -1,3 +1,4 @@
import type { Server } from 'net';
import {
InternalServerErrorException,
Logger,
Expand Down Expand Up @@ -127,9 +128,13 @@ export class ExpressAdapter extends AbstractHttpAdapter {
return response.set(name, value);
}

public listen(port: string | number, callback?: () => void);
public listen(port: string | number, hostname: string, callback?: () => void);
public listen(port: any, ...args: any[]) {
public listen(port: string | number, callback?: () => void): Server;
public listen(
port: string | number,
hostname: string,
callback?: () => void,
): Server;
public listen(port: any, ...args: any[]): Server {
return this.httpServer.listen(port, ...args);
}

Expand Down
@@ -1,3 +1,4 @@
import { Server } from 'net';
import { INestApplication } from '@nestjs/common';
import { ServeStaticOptions } from './serve-static-options.interface';

Expand All @@ -9,6 +10,21 @@ import { ServeStaticOptions } from './serve-static-options.interface';
* @publicApi
*/
export interface NestExpressApplication extends INestApplication {
/**
* Starts the application.
*
* @param {number|string} port
* @param {string} [hostname]
* @param {Function} [callback] Optional callback
* @returns {Promise} A Promise that, when resolved, is a reference to the underlying HttpServer.
*/
listen(port: number | string, callback?: () => void): Promise<Server>;
listen(
port: number | string,
hostname: string,
callback?: () => void,
): Promise<Server>;

/**
* A wrapper function around native `express.set()` method.
*
Expand Down

0 comments on commit d6a89fa

Please sign in to comment.