From 4fa9fd98dc3fae34b8ffacfa7e7ace571680224c Mon Sep 17 00:00:00 2001 From: Ivan Lyons Date: Tue, 6 Nov 2018 14:49:09 +0800 Subject: [PATCH 1/2] [Koa] custom properties example: ``` const config = require('./config') const app = new Koa(); app.context.config = config; app.use((ctx, next) => { // use `config` object const config = ctx.config }) ``` --- types/koa/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/koa/index.d.ts b/types/koa/index.d.ts index ea6bd60a46..1cd6166f62 100644 --- a/types/koa/index.d.ts +++ b/types/koa/index.d.ts @@ -694,6 +694,7 @@ declare namespace Application { * To bypass Koa's built-in response handling, you may explicitly set `ctx.respond = false;` */ respond?: boolean; + [key: string]: any; } } From 850d8d25ec808d25db5a2e8da9a84d528f1bd9f5 Mon Sep 17 00:00:00 2001 From: Ivan Lyons Date: Tue, 6 Nov 2018 15:10:40 +0800 Subject: [PATCH 2/2] Update index.d.ts --- types/koa/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/koa/index.d.ts b/types/koa/index.d.ts index 1cd6166f62..802d6a242f 100644 --- a/types/koa/index.d.ts +++ b/types/koa/index.d.ts @@ -659,6 +659,10 @@ declare namespace Application { * Default error handling. */ onerror(err: Error): void; + /** + * Custom properties. + */ + [key: string]: any; } interface Request extends BaseRequest { @@ -694,7 +698,6 @@ declare namespace Application { * To bypass Koa's built-in response handling, you may explicitly set `ctx.respond = false;` */ respond?: boolean; - [key: string]: any; } }