Files
DefinitelyTyped/types/easy-session/index.d.ts
Dimitri Benin dfeadbd5ac [cookie-parser] finish incomplete typings (#18191)
* [cookie-parser] finish incomplete typings

* [cookie-parser] bump compiler version as suggested by travis output

* [cookie-parser] revert compiler bump

* [cookie-parser] restrict compiler version in failing packages

* [cookie-parser] fix indentation
2017-07-24 10:04:09 -07:00

43 lines
1.5 KiB
TypeScript

// Type definitions for easy-session
// Project: https://github.com/DeadAlready/node-easy-session
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="express" />
declare namespace Express {
interface ErrorCallback {
(err?: any): void;
}
export interface Session {
login(callback: Function): void;
login(extend: Object, callback: ErrorCallback): void;
login(role: string, callback: ErrorCallback): void;
login(role: string, extend: Object, callback: ErrorCallback): void;
logout(callback: ErrorCallback): void;
isLoggedIn(role?: string): boolean;
isGuest(): boolean;
isFresh(): boolean;
setRole(role: string): Session;
getRole(): string;
hasRole(role: string): boolean;
}
}
declare module "easy-session" {
import express = require('express');
interface SessionOptions {
ipCheck?: boolean;
uaCheck?: boolean;
freshTimeout?: number;
maxFreshTimeout?: number;
}
export function main(session: any, options?: SessionOptions): express.RequestHandler;
export function isLoggedIn(errorCallback?: Function): express.RequestHandler;
export function isFresh(errorCallback?: Function): express.RequestHandler;
export function checkRole(role: string, errorCallback?: Function): express.RequestHandler;
}