Skip to content

Commit

Permalink
feat(d.ts): add middleware to Application and other ts improvement (#…
Browse files Browse the repository at this point in the history
…2465)

* add middleware to Application
* plugin type can be boolean
* rename EggPluginValue to EggPluginItem
  • Loading branch information
whxaxes authored and popomore committed Apr 28, 2018
1 parent 4377853 commit 1ada8e3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions index.d.ts
Expand Up @@ -605,6 +605,8 @@ declare module 'egg' {
controller: IController;

Controller: Controller;

middleware: KoaApplication.Middleware[] & IMiddleware;
}

export interface FileStream extends Readable { // tslint:disable-line
Expand Down Expand Up @@ -878,11 +880,13 @@ declare module 'egg' {
*
* Now I can get ctx.service.foo at controller and other service file.
*/
export interface IService { } // tslint:disable-line
export interface IService extends PlainObject { } // tslint:disable-line

export interface IController extends PlainObject { } // tslint:disable-line

export interface IController { } // tslint:disable-line
export interface IMiddleware extends PlainObject {} // tslint:disable-line

export interface IHelper {
export interface IHelper extends PlainObject {
/**
* Generate URL path(without host) for route. Takes the route name and a map of named params.
* @method Helper#pathFor
Expand Down Expand Up @@ -919,15 +923,17 @@ declare module 'egg' {
export type EggEnvType = 'local' | 'unittest' | 'prod' | string;

/**
* plugin config item
* plugin config item interface
*/
export interface EggPluginItem {
export interface IEggPluginItem {
env?: EggEnvType[];
path?: string;
package?: string;
enable?: boolean;
}

export type EggPluginItem = IEggPluginItem | boolean;

/**
* build-in plugin list
*/
Expand Down

0 comments on commit 1ada8e3

Please sign in to comment.