@types/koa-session: support missing options

This commit is contained in:
Hiroshi Ioka
2019-01-26 13:49:12 +09:00
parent ef74551c48
commit 9699c212d2
3 changed files with 9 additions and 19 deletions
+7 -18
View File
@@ -1,9 +1,10 @@
// Type definitions for koa-session 5.7
// Type definitions for koa-session 5.10
// Project: https://github.com/koajs/session
// Definitions by: Yu Hsin Lu <https://github.com/kerol2r20>
// Tomek Łaziuk <https://github.com/tlaziuk>
// Hiroshi Ioka <https://github.com/hirochachacha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/* =================== USAGE ===================
@@ -16,6 +17,9 @@
=============================================== */
import Koa = require("koa");
import Cookies = require("cookies");
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
declare namespace session {
/**
@@ -108,7 +112,7 @@ declare namespace session {
hash(sess: any): string;
}
interface opts {
interface opts extends Omit<Cookies.SetOption, 'maxAge'> {
/**
* cookie key (default is koa:sess)
*/
@@ -121,21 +125,6 @@ declare namespace session {
*/
maxAge?: number | "session";
/**
* can overwrite or not (default true)
*/
overwrite: boolean;
/**
* httpOnly or not (default true)
*/
httpOnly: boolean;
/**
* signed or not (default true)
*/
signed: boolean;
/**
* custom encode method
*/
+1
View File
@@ -37,6 +37,7 @@ app.use(session({
console.log(key);
},
},
path: "/",
}, app));
app.use((ctx, next) => {
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/lonord/koa2-session-redis
// Definitions by: Dima Mukhin <https://github.com/DimaMukhin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as Redis from 'redis';
import * as session from 'koa-session';