mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
@types/koa-session: support missing options
This commit is contained in:
Vendored
+7
-18
@@ -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
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,7 @@ app.use(session({
|
||||
console.log(key);
|
||||
},
|
||||
},
|
||||
path: "/",
|
||||
}, app));
|
||||
|
||||
app.use((ctx, next) => {
|
||||
|
||||
Vendored
+1
-1
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user