1
- // Type definitions for connect v3.4.0.
1
+ // Type definitions for connect v3.4.0
2
2
// Project: https://github.com/senchalabs/connect
3
3
// Definitions by: Maxime LUCE <https://github.com/SomaticIT/>
4
4
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -16,20 +16,19 @@ declare module "connect" {
16
16
17
17
module createServer {
18
18
export type ServerHandle = HandleFunction | http . Server ;
19
-
20
- export interface HandleFunction {
21
- ( req : http . IncomingMessage , res : http . ServerResponse ) : void ;
22
- ( req : http . IncomingMessage , res : http . ServerResponse , next : Function ) : void ;
23
- ( err : Error , req : http . IncomingMessage , res : http . ServerResponse , next : Function ) : void ;
24
- }
19
+
20
+ export type SimpleHandleFunction = ( req : http . IncomingMessage , res : http . ServerResponse ) => void ;
21
+ export type NextHandleFunction = ( req : http . IncomingMessage , res : http . ServerResponse , next : Function ) => void ;
22
+ export type ErrorHandleFunction = ( err : Error , req : http . IncomingMessage , res : http . ServerResponse , next : Function ) => void ;
23
+ export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction ;
25
24
26
25
export interface ServerStackItem {
27
26
route : string ;
28
27
handle : ServerHandle ;
29
28
}
30
29
31
30
export interface Server extends NodeJS . EventEmitter {
32
- ( req : http . IncomingMessage , res : http . ServerResponse , next : Function ) => void ;
31
+ ( req : http . IncomingMessage , res : http . ServerResponse , next ? : Function ) : void ;
33
32
34
33
route : string ;
35
34
stack : ServerStackItem [ ] ;
0 commit comments