From ccfd178bb4f9e78f2238e5add93b7b2ed20d0389 Mon Sep 17 00:00:00 2001 From: Cao Jiannan Date: Sat, 9 Jul 2016 10:20:53 +0800 Subject: [PATCH] Update param declare --- .../express-serve-static-core.d.ts | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/express-serve-static-core/express-serve-static-core.d.ts b/express-serve-static-core/express-serve-static-core.d.ts index 3bfe0a7daf..4e3bee4691 100644 --- a/express-serve-static-core/express-serve-static-core.d.ts +++ b/express-serve-static-core/express-serve-static-core.d.ts @@ -31,7 +31,7 @@ declare module "express-serve-static-core" { type PathParams = string | RegExp | (string | RegExp)[]; - type RequestHandlerParams = RequestHandler | ErrorRequestHandler; + type RequestHandlerParams = RequestHandler | ErrorRequestHandler | (RequestHandler | ErrorRequestHandler)[]; interface IRouterMatcher { (path: PathParams, ...handlers: RequestHandler[]): T; @@ -73,12 +73,10 @@ declare module "express-serve-static-core" { * @param name * @param fn */ - param: { - (name: string, handler: RequestParamHandler): this; - // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API - // deprecated since express 4.11.0 - (callback: (name: string, matcher: RegExp) => RequestParamHandler): this; - }; + param(name: string, handler: RequestParamHandler): this; + // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API + // deprecated since express 4.11.0 + param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; /** * Special-cased "all" method, applying the given route `path`, @@ -874,12 +872,10 @@ declare module "express-serve-static-core" { set(setting: string, val: any): Application; get: {(name: string): any;} & IRouterMatcher; - param: { - (name: string | string[], handler: RequestParamHandler): this; - // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API - // deprecated since express 4.11.0 - param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; - }; + param(name: string[], handler: RequestParamHandler): this; + param(name: string, handler: RequestParamHandler): this; + // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API + param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; /** * Return the app's absolute pathname