UNPKG

1.19 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[] | undefined, method?: string | string[] | undefined };
16
17 export interface Options {
18 custom?: ((req: express.Request) => boolean) | undefined;
19 path?: pathFilter | pathFilter[] | undefined;
20 ext?: string | string[] | undefined;
21 method?: string | string[] | undefined;
22 useOriginalUrl?: boolean | undefined;
23 }
24 export interface RequestHandler extends express.RequestHandler {
25 unless?: typeof unless | undefined;
26 }
27}
28
29export = unless;
30
\No newline at end of file