How to use the egg.BaseContextClass function in egg

To help you get started, we’ve selected a few egg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eggjs / egg / test / fixtures / apps / app-ts-type-check / error.ts View on Github external
import {
  BaseContextClass,
  Context,
  Application,
  Agent,
  Controller,
  Service,
  EggAppConfig,
  PowerPartial,
  Singleton,
} from 'egg';

new BaseContextClass({} as Context).ctx;

class MyController extends Controller {
  async test() {
    this.ctx.locals.test.localsCheckAny();
    this.app.config.keys.configKeysCheckAny();
    this.app.appCheckAny();
  }
}
new MyController();

// service
class MyService extends Service {
  async test() {
    this.ctx.locals.test.serviceLocalCheckAny();
    this.app.config.keys.serviceConfigCheckAny();
    this.app.serviceAppCheckAny();