Skip to content

Commit

Permalink
Add definitions for connect-flash
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasGassmann committed Apr 14, 2015
1 parent ed38db4 commit 978ee56
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions connect-flash/connect-flash-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="./connect-flash.d.ts" />

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');
});
22 changes: 22 additions & 0 deletions connect-flash/connect-flash.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Type definitions for connect-flash
// Project: https://github.com/jaredhanson/connect-flash
// Definitions by: Andreas Gassmann <https://github.com/AndreasGassmann/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../express/express.d.ts" />

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;
}

0 comments on commit 978ee56

Please sign in to comment.