mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
[koa-session] types were overwriting a Class with an interface FIX (#36206)
* koa-session was overwriting a Class with an interface * forgot semicolons
This commit is contained in:
committed by
Benjamin Lichtman
parent
c4686d3e82
commit
3d4db2e667
Vendored
-5
@@ -205,11 +205,6 @@ declare module "koa" {
|
||||
session: session.Session | null;
|
||||
readonly sessionOptions: session.opts | undefined;
|
||||
}
|
||||
|
||||
interface Application {
|
||||
on(name: "session:missed" | "session:expired" | "session:invalid", data: { key?: string, value?: Partial<session.Session>, ctx: Context }): void;
|
||||
once(name: "session:missed" | "session:expired" | "session:invalid", data: { key?: string, value?: Partial<session.Session>, ctx: Context }): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = session;
|
||||
|
||||
@@ -40,10 +40,18 @@ app.use(session({
|
||||
path: "/",
|
||||
}, app));
|
||||
|
||||
// can still use koa-session events, although without autocomplete
|
||||
app.on('session:missed', () => {});
|
||||
app.on('session:expired', () => {});
|
||||
app.on('session:invalid', () => {});
|
||||
|
||||
app.use((ctx, next) => {
|
||||
// reset the session
|
||||
ctx.session = null;
|
||||
|
||||
// does not interfere with Application->EventEmitter #32389
|
||||
ctx.app.emit('error', new Error('this is an user-generated Error'));
|
||||
|
||||
return next();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user