Skip to content

Commit

Permalink
fix: fix context declaration not works (#3329)
Browse files Browse the repository at this point in the history
Due to the change of Koa, we have to rewrite all the attributes based on koa.Context.
  • Loading branch information
whxaxes authored and Maledong committed Dec 19, 2018
1 parent ef47a27 commit f312db7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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<KoaApplication.Context, 'cookies'> {
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;
Expand Down

0 comments on commit f312db7

Please sign in to comment.