From a422e8fc073c5adee3ac7796d63d9d0815a4e394 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Tue, 19 Aug 2014 19:35:30 +0900 Subject: [PATCH 1/3] add csurf type file --- csurf/csurf.d.ts | 30 ++++++++++++++++++++++++++++++ passport/passport.d.ts | 29 ++++++++++++----------------- 2 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 csurf/csurf.d.ts diff --git a/csurf/csurf.d.ts b/csurf/csurf.d.ts new file mode 100644 index 000000000..3a95435d7 --- /dev/null +++ b/csurf/csurf.d.ts @@ -0,0 +1,30 @@ +// Type definitions for csurf +// Project: http://expressjs.com +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +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; +} + diff --git a/passport/passport.d.ts b/passport/passport.d.ts index fc3dd786f..6d03093eb 100644 --- a/passport/passport.d.ts +++ b/passport/passport.d.ts @@ -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; - } -} - From 688f734b69f454c90191f0f1caad0b05610ff446 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Tue, 19 Aug 2014 19:37:13 +0900 Subject: [PATCH 2/3] add semicolon --- express/express.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express/express.d.ts b/express/express.d.ts index d9551e22b..9d5d3d33a 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -821,7 +821,7 @@ declare module "express" { (name: string): string; // Getter (name: string, ...handlers: RequestHandler[]): Application; (name: RegExp, ...handlers: RequestHandler[]): Application; - } + }; /** * Return the app's absolute pathname From 451f712613ab0effc1318a5d55e047764d1c53ac Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Wed, 20 Aug 2014 00:27:36 +0900 Subject: [PATCH 3/3] change Project URL --- csurf/csurf.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csurf/csurf.d.ts b/csurf/csurf.d.ts index 3a95435d7..cc78f9599 100644 --- a/csurf/csurf.d.ts +++ b/csurf/csurf.d.ts @@ -1,5 +1,5 @@ // Type definitions for csurf -// Project: http://expressjs.com +// Project: https://www.npmjs.org/package/csurf // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/borisyankov/DefinitelyTyped