From 978ee56f6cfc2c207efceb4ddb44ceadf4e3cb4e Mon Sep 17 00:00:00 2001 From: Andreas Gassmann Date: Tue, 14 Apr 2015 10:24:52 +0200 Subject: [PATCH] Add definitions for connect-flash --- connect-flash/connect-flash-tests.ts | 16 ++++++++++++++++ connect-flash/connect-flash.d.ts | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 connect-flash/connect-flash-tests.ts create mode 100644 connect-flash/connect-flash.d.ts diff --git a/connect-flash/connect-flash-tests.ts b/connect-flash/connect-flash-tests.ts new file mode 100644 index 0000000000..6d672c33d9 --- /dev/null +++ b/connect-flash/connect-flash-tests.ts @@ -0,0 +1,16 @@ +/// + +import express = require('express'); +import flash = require('connect-flash'); + +var app = express(); + +app.use(flash()); +app.use(flash({ + unsafe: false +})); + +app.use(function(req: Express.Request, res, next) { + req.flash('Message'); + req.flash('info', 'Message'); +}); diff --git a/connect-flash/connect-flash.d.ts b/connect-flash/connect-flash.d.ts new file mode 100644 index 0000000000..0b8047a720 --- /dev/null +++ b/connect-flash/connect-flash.d.ts @@ -0,0 +1,22 @@ +// Type definitions for connect-flash +// Project: https://github.com/jaredhanson/connect-flash +// Definitions by: Andreas Gassmann +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + export interface Request { + flash(message: string): any; + flash(event: string, message: string): any; + } +} + +declare module "connect-flash" { + import express = require('express'); + interface IConnectFlashOptions { + unsafe?: boolean; + } + function e(options?: IConnectFlashOptions): express.RequestHandler; + export = e; +}