1.15.0
- 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;
}
}