Merge pull request #26008 from davewasmer/patch-6

[Koa] Remove Context index signature
This commit is contained in:
Benjamin Lichtman
2018-05-31 18:29:15 -07:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
-2
View File
@@ -659,8 +659,6 @@ declare namespace Application {
* Default error handling.
*/
onerror(err: Error): void;
[key: string]: any;
}
interface Request extends BaseRequest {
+10
View File
@@ -1,11 +1,21 @@
import Koa = require("koa");
declare module 'koa' {
export interface BaseContext {
db(): void;
}
export interface Context {
user: {};
}
}
const app = new Koa();
app.context.db = () => {};
app.use(async ctx => {
console.log(ctx.db);
ctx.user = {};
});
app.use((ctx, next) => {