forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefinitelyTyped#6361 from chrootsu/finalhandler
finalhandler: definition of the module has been added
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// <reference path="./finalhandler.d.ts" /> | ||
|
||
import {ServerRequest, ServerResponse} from "http"; | ||
import finalHandler from "finalhandler"; | ||
|
||
let req: ServerRequest; | ||
let res: ServerResponse; | ||
let options: { | ||
onerror: (err: any, req: ServerRequest, res: ServerResponse) => void; | ||
message: boolean|((err: any, status: number) => string); | ||
stacktrace: boolean; | ||
}; | ||
|
||
let result: (err: any) => void; | ||
|
||
result = finalHandler(req, res); | ||
result = finalHandler(req, res, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Type definitions for finalhandler | ||
// Project: https://github.com/pillarjs/finalhandler | ||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
|
||
declare module "finalhandler" { | ||
import {ServerRequest, ServerResponse} from "http"; | ||
|
||
export interface Options { | ||
message?: boolean|((err: any, status: number) => string); | ||
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void; | ||
stacktrace?: boolean; | ||
} | ||
|
||
function finalHandler(req: ServerRequest, res: ServerResponse, options?: Options): (err: any) => void; | ||
|
||
export default finalHandler; | ||
} |