mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-05 08:50:16 +00:00
Add tests for BaseContext as well as Context
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import Koa = require("koa");
|
||||
|
||||
declare module 'koa' {
|
||||
export interface Context {
|
||||
export interface BaseContext {
|
||||
db(): void;
|
||||
}
|
||||
export interface Context {
|
||||
user: {};
|
||||
}
|
||||
}
|
||||
|
||||
const app = new Koa();
|
||||
@@ -12,6 +15,7 @@ app.context.db = () => {};
|
||||
|
||||
app.use(async ctx => {
|
||||
console.log(ctx.db);
|
||||
ctx.user = {};
|
||||
});
|
||||
|
||||
app.use((ctx, next) => {
|
||||
|
||||
Reference in New Issue
Block a user