[express-serve-static-core] Fix listen callback type (#35883)

* [express-serve-static-core] Add tests

* [express-serve-static-core] listen's callback can take some parameters

* [express-serve-static-core] Add a definitions by section
This commit is contained in:
aereal 2019-06-07 04:59:30 +09:00 committed by Andrew Casey
parent e1e63171f3
commit 34f4572c07
2 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,7 @@
import * as express from 'express-serve-static-core';
// null test file - everything should be tested from express.d.ts and serve-static.d.ts
const app: express.Application = {} as any;
app.listen(3000);
app.listen(3000, (err: any) => {
// no-op error callback
});

View File

@ -5,6 +5,7 @@
// Kacper Polak <https://github.com/kacepe>
// Satana Charuwichitratana <https://github.com/micksatana>
// Sami Jaber <https://github.com/samijaber>
// aereal <https://github.com/aereal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@ -996,11 +997,11 @@ export interface Application extends EventEmitter, IRouter, Express.Application
* http.createServer(app).listen(80);
* https.createServer({ ... }, app).listen(443);
*/
listen(port: number, hostname: string, backlog: number, callback?: () => void): http.Server;
listen(port: number, hostname: string, callback?: () => void): http.Server;
listen(port: number, callback?: () => void): http.Server;
listen(callback?: () => void): http.Server;
listen(path: string, callback?: () => void): http.Server;
listen(port: number, hostname: string, backlog: number, callback?: (...args: any[]) => void): http.Server;
listen(port: number, hostname: string, callback?: (...args: any[]) => void): http.Server;
listen(port: number, callback?: (...args: any[]) => void): http.Server;
listen(callback?: (...args: any[]) => void): http.Server;
listen(path: string, callback?: (...args: any[]) => void): http.Server;
listen(handle: any, listeningListener?: () => void): http.Server;
router: string;