add csurf type file

This commit is contained in:
Horiuchi_H
2014-08-19 19:35:30 +09:00
parent 17f8e5aca2
commit a422e8fc07
2 changed files with 42 additions and 17 deletions
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for csurf
// Project: http://expressjs.com
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module Express {
export interface Request {
csrfToken(): string;
}
}
declare module "csurf" {
import express = require('express');
function csurf(options?: {
value?: (req: express.Request) => string;
cookie?: csurf.CookieOptions;
}): express.RequestHandler;
module csurf {
export interface CookieOptions extends express.CookieOptions {
key: string;
}
}
export = csurf;
}
+12 -17
View File
@@ -8,6 +8,18 @@
declare module Express {
export interface Request {
session?: any;
// These declarations are merged into express's Request type
login(user: any, done: (err: any) => void): void;
login(user: any, options: Object, done: (err: any) => void): void;
logIn(user: any, done: (err: any) => void): void;
logIn(user: any, options: Object, done: (err: any) => void): void;
logout(): void;
logOut(): void;
isAuthenticated(): boolean;
isUnauthenticated(): boolean;
}
}
@@ -68,20 +80,3 @@ declare module 'passport' {
}
}
declare module Express {
export interface Request {
// These declarations are merged into express's Request type
login(user: any, done: (err: any) => void): void;
login(user: any, options: Object, done: (err: any) => void): void;
logIn(user: any, done: (err: any) => void): void;
logIn(user: any, options: Object, done: (err: any) => void): void;
logout(): void;
logOut(): void;
isAuthenticated(): boolean;
isUnauthenticated(): boolean;
}
}