diff --git a/index.d.ts b/index.d.ts index e50f93e519..959a6773d2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -187,7 +187,7 @@ declare module 'egg' { * ```js * // config/config.default.ts * import { EggAppInfo } from 'egg'; - * + * * export default (appInfo: EggAppInfo) => { * return { * keys: appInfo.name + '123456', @@ -570,7 +570,7 @@ declare module 'egg' { * global locals for view * @see Context#locals */ - locals: any; + locals: IApplicationLocals; /** * HTTP get method @@ -627,6 +627,8 @@ declare module 'egg' { runInBackground(scope: (ctx: Context) => void): void; } + export interface IApplicationLocals extends PlainObject {} + export interface FileStream extends Readable { // tslint:disable-line fields: any; @@ -792,7 +794,7 @@ declare module 'egg' { * * @member {Object} Context#locals */ - locals: any; + locals: IApplicationLocals & IContextLocals; /** * alias to {@link locals}, compatible with koa that use this variable @@ -875,6 +877,8 @@ declare module 'egg' { redirect(url: string, alt?: string): void; } + export interface IContextLocals extends PlainObject {} + export class Controller extends BaseContextClass { } export class Service extends BaseContextClass { } @@ -998,7 +1002,7 @@ declare module 'egg' { * Powerful Partial, Support adding ? modifier to a mapped property in deep level * @example * import { PowerPartial, EggAppConfig } from 'egg'; - * + * * // { view: { defaultEngines: string } } => { view?: { defaultEngines?: string } } * type EggConfig = PowerPartial */