From 04b8281f8760bd2e416806115053dc35db972f43 Mon Sep 17 00:00:00 2001 From: leanazulyoro Date: Mon, 16 Apr 2018 10:28:18 -0300 Subject: [PATCH] Add definitions for restify's conditionalHandler plugin --- types/restify/index.d.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index b5f6dd6fe5..30a5220022 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for restify 5.0 // Project: https://github.com/restify/node-restify -// Definitions by: Bret Little , Steve Hipwell +// Definitions by: Bret Little , Steve Hipwell , Leandro Almeida // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -946,6 +946,17 @@ export namespace plugins { */ function authorizationParser(options?: any): RequestHandler; + interface HandlerCandidate { + handler: RequestHandler | RequestHandler[]; + version?: string | string[]; + contentType?: string | string[]; + } + + /** + * Runs first handler that matches to the condition + */ + function conditionalHandler(candidates: HandlerCandidate | HandlerCandidate[]): RequestHandler[]; + /** * Conditional headers (If-*) */