Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#6361 from chrootsu/finalhandler
Browse files Browse the repository at this point in the history
finalhandler: definition of the module has been added
  • Loading branch information
vvakame committed Oct 21, 2015
2 parents 393c201 + bcba8a9 commit 7e3ae82
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions finalhandler/finalhandler-tests.ts
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);
20 changes: 20 additions & 0 deletions finalhandler/finalhandler.d.ts
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;
}

0 comments on commit 7e3ae82

Please sign in to comment.