mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #26008 from davewasmer/patch-6
[Koa] Remove Context index signature
This commit is contained in:
Vendored
-2
@@ -659,8 +659,6 @@ declare namespace Application {
|
||||
* Default error handling.
|
||||
*/
|
||||
onerror(err: Error): void;
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Request extends BaseRequest {
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user