import { ViewConfig } from "./config/config.default.js"; import { RenderOptions, ViewManager } from "./lib/view_manager.js"; import { ContextView } from "./lib/context_view.js"; //#region src/types.d.ts declare module "egg" { interface EggAppConfig { /** * view default config * @member Config#view * @property {String} [root=${baseDir}/app/view] - give a path to find the file, you can specify multiple path with `,` delimiter * @property {Boolean} [cache=true] - whether cache the file's path * @property {String} [defaultExtension] - defaultExtension can be added automatically when there is no extension when call `ctx.render` * @property {String} [defaultViewEngine] - set the default view engine if you don't want specify the viewEngine every request. * @property {Object} mapping - map the file extension to view engine, such as `{ '.ejs': 'ejs' }` */ view: ViewConfig; } interface Application { get view(): ViewManager; } interface Context { view: ContextView; render(name: string, locals?: Record, options?: RenderOptions): Promise; renderView(name: string, locals?: Record, options?: RenderOptions): Promise; renderString(tpl: string, locals?: Record, options?: RenderOptions): Promise; } } //#endregion