mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add definitions for connect-flash
This commit is contained in:
parent
ed38db403a
commit
978ee56f6c
16
connect-flash/connect-flash-tests.ts
Normal file
16
connect-flash/connect-flash-tests.ts
Normal file
@ -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
connect-flash/connect-flash.d.ts
vendored
Normal file
22
connect-flash/connect-flash.d.ts
vendored
Normal file
@ -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;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user