From 7a34519cfe16c1b3a14e29a295a8c71f9f4a0cff Mon Sep 17 00:00:00 2001 From: whxaxes Date: Wed, 19 Dec 2018 14:56:42 +0800 Subject: [PATCH] fix: fix context declaration not works --- index.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 09b55daf39..98ed1c0860 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,6 +4,7 @@ import * as KoaRouter from 'koa-router'; import { EventEmitter } from 'events' import { Readable } from 'stream'; import { Socket } from 'net'; +import { IncomingMessage, ServerResponse } from 'http'; import { EggLogger, EggLoggers, LoggerLevel as EggLoggerLevel, EggContextLogger } from 'egg-logger'; import { HttpClient2, RequestOptions } from 'urllib'; import EggCookies = require('egg-cookies'); @@ -710,11 +711,17 @@ declare module 'egg' { * special properties (e.g: encrypted). So we must remove this property and * create our own with the same name. */ - export interface Context extends RemoveSpecProp { + export interface Context extends KoaApplication.BaseContext { [key: string]: any; app: Application; + // property of koa.Context + req: IncomingMessage; + res: ServerResponse; + originalUrl: string; + respond?: boolean; + service: IService; request: Request;