Skip to content

1.15.0

Compare
Choose a tag to compare
@whxaxes whxaxes released this 29 Nov 07:34
· 173 commits to master since this release
  • feat: add declareTo option
  • chore: upgrade typescript to 3.0
// ./tshelper.js

module.exports = {
  watchDirs: {
    model: {
      path: 'app/model', // dir path
      generator: 'class', // generator name
      interface: 'IModel',  // interface name
      declareTo: 'Context.model', // declare to this interface
    }
  }
}

declareTo set to Context.model

import Station from '../../../app/model/station';

declare module 'egg' {
  interface Context {
    model: IModel;
  }

  interface IModel {
    Station: Station;
  }
}

declareTo set to Application.model.subModel

import Station from '../../../app/model/station';

declare module 'egg' {
  interface Application {
    model: {
      subModel: IModel;
    }
  }

  interface IModel {
    Station: Station;
  }
}