diff --git a/express-unless/express-unless-tests.ts b/express-unless/express-unless-tests.ts new file mode 100644 index 000000000..a6d57d486 --- /dev/null +++ b/express-unless/express-unless-tests.ts @@ -0,0 +1,12 @@ +/// + +import express = require('express'); +import unless = require('express-unless'); + +var app = express(); + +var middleware:unless.RequestHandler = function (req, res, next) { + next(); +} +middleware.unless = unless; +app.use(middleware.unless({ method: 'OPTIONS' })); \ No newline at end of file diff --git a/express-unless/express-unless.d.ts b/express-unless/express-unless.d.ts new file mode 100644 index 000000000..e3d81ed13 --- /dev/null +++ b/express-unless/express-unless.d.ts @@ -0,0 +1,26 @@ +// Type definitions for express-unless +// Project: https://www.npmjs.org/package/express-unless +// Definitions by: Wonshik Kim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "express-unless" { + import express = require('express'); + + function unless(options:unless.Options): express.RequestHandler; + + module unless { + export interface Options { + custom?: (req: express.Request) => boolean; + path?: any; // TODO: union type 'string|string[]' is not supported yet + ext?: any; // TODO: union type 'string|string[]' is not supported yet + method?: any; // TODO: union type 'string|string[]' is not supported yet + } + export interface RequestHandler extends express.RequestHandler { + unless?: typeof unless; + } + } + + export = unless; +} \ No newline at end of file