Skip to content

Commit

Permalink
fix: egg definition (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 authored Sep 28, 2020
1 parent faa6ff9 commit 3e2f1e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/web/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class MidwayWebFramework extends MidwayKoaBaseFramework<
protected async afterDirectoryLoad(
options: Partial<IMidwayBootstrapOptions>
) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
if (this.isTsMode) {
process.env.EGG_TYPESCRIPT = 'true';
Expand Down
20 changes: 17 additions & 3 deletions packages/web/src/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Context, Application } from 'egg';
import { IMidwayApplication, IMidwayContext } from '@midwayjs/core';
import {
IMidwayContainer,
MidwayFrameworkType,
MidwayProcessTypeEnum
} from '@midwayjs/core';
import { IMidwayKoaConfigurationOptions, IMidwayKoaContext, IMidwayKoaNext } from '@midwayjs/koa';
import { DefaultState, Middleware } from 'koa';

Expand All @@ -8,12 +12,22 @@ declare module 'egg' {
appDir: string;
}

interface Application extends IMidwayApplication {
interface Application {
applicationContext: IMidwayContainer;
getBaseDir(): string;
getAppDir(): string;
getEnv(): string;
getFrameworkType(): MidwayFrameworkType;
getProcessType(): MidwayProcessTypeEnum;
getApplicationContext(): IMidwayContainer;
getConfig(key?: string): any;
generateController?(controllerMapping: string);
generateMiddleware?(middlewareId: string): Promise<Middleware<DefaultState, IMidwayKoaContext>>;
}

interface Context extends IMidwayContext {
interface Context {
getRequestContext(): IMidwayContainer;
requestContext: IMidwayContainer;
}
}

Expand Down

0 comments on commit 3e2f1e9

Please sign in to comment.