UNPKG

1.09 kBTypeScriptView Raw
1// Type definitions for express-unless 0.5
2// Project: https://www.npmjs.org/package/express-unless
3// Definitions by: Wonshik Kim <https://github.com/wokim>
4// Joao Vieira <https://github.com/joaovieira>
5// Michal Kaminski <https://github.com/michal-b-kaminski>
6// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7// TypeScript Version: 2.3
8
9import express = require("express");
10
11declare function unless(options: unless.Options): express.RequestHandler;
12declare function unless(options: unless.Options["custom"]): express.RequestHandler;
13
14declare namespace unless {
15 type pathFilter = string | RegExp | { url: string | RegExp, methods?: string[], method?: string | string[] };
16
17 export interface Options {
18 custom?: (req: express.Request) => boolean;
19 path?: pathFilter | pathFilter[];
20 ext?: string | string[];
21 method?: string | string[];
22 useOriginalUrl?: boolean;
23 }
24 export interface RequestHandler extends express.RequestHandler {
25 unless?: typeof unless;
26 }
27}
28
29export = unless;