Skip to content

Commit

Permalink
export Response thanks to a namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrotoff committed Dec 19, 2015
1 parent e16ce4a commit b42e2a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api-error-handler/api-error-handler-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ api.get('/users/:userid', function (req, res, next) {
});

api.use(errorHandler());

let res: errorHandler.Response;
16 changes: 16 additions & 0 deletions api-error-handler/api-error-handler.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@
declare module 'api-error-handler' {
import * as express from 'express';

namespace apiErrorHandler {

// Body response: the JSON returned by api-error-handler
// See https://github.com/expressjs/api-error-handler/blob/1.0.0/index.js
interface Response {
status: number;
stack?: string;
message: string;

// Client errors
code?: any;
name?: string;
type?: any;
}
}

function apiErrorHandler(options?: any): express.ErrorRequestHandler;

export = apiErrorHandler;
Expand Down

0 comments on commit b42e2a2

Please sign in to comment.