From d7b7aa4f1d6ca3f398ef39695bbdf87275701e52 Mon Sep 17 00:00:00 2001 From: Richard Michael Coo Date: Thu, 2 Mar 2017 00:49:13 +0800 Subject: [PATCH] Improve typedefs --- index.d.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index d8e1ae7..9c0e49e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,7 +1,13 @@ -declare function rest(handler:Function): Function; +import 'express'; -declare namespace rest{ - export function formatter(req:any, res:any, next:Function): void; +declare function rest(handler?: Formatter): Function; + +declare interface Formatter { + (request: Express.Request, response: Express.Response, next?: Function); +} + +declare namespace rest { + const formatter: Formatter; } export = rest;