-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
43 lines (34 loc) · 1.3 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as Mongoose from 'mongoose';
declare namespace ThinkMongoose {
interface MongooseModel<T extends Mongoose.Document = Mongoose.Document> extends Mongoose.Model<T> {
new(modelName?: string, config?: object): MongooseModel<T>;
readonly tablePrefix: string;
readonly tableName: string;
models: object;
mongoose<T extends Mongoose.Document, U extends MongooseModel<T>>(name: string): U;
}
interface MongooseModelDefinition {
new(): MongooseModelDefinition;
readonly schema: Mongoose.SchemaDefinition | Mongoose.Schema;
}
interface ModelThinkExtend {
Mongoose: MongooseModelDefinition;
}
interface ModelExtend {
mongoose(name: string, config?: any, module?: string): ThinkMongoose.MongooseModel;
}
}
declare module 'thinkjs' {
interface Think extends ThinkMongoose.ModelExtend, ThinkMongoose.ModelThinkExtend { }
interface Controller extends ThinkMongoose.ModelExtend { }
interface Context extends ThinkMongoose.ModelExtend { }
interface Service extends ThinkMongoose.ModelExtend { }
}
declare interface IThinkMongoose {
think: ThinkMongoose.ModelExtend & ThinkMongoose.ModelThinkExtend
controller: ThinkMongoose.ModelExtend
context: ThinkMongoose.ModelExtend
service: ThinkMongoose.ModelExtend
}
declare function model(app): IThinkMongoose
export = model