【发布时间】:2017-04-30 13:31:04
【问题描述】:
- 打字稿版本:2.1.4
- @types/mongoose 版本:4.7.1
我使用猫鼬的类型:
post<T extends Document>(method: string, fn: (
error: mongodb.MongoError, doc: T, next: (err?: NativeError) => void
) => void): this;
post<T extends Document>(method: string, fn: (
doc: T, next: (err?: NativeError) => void
) => void): this;
在我的代码中:
function (schema: Schema) {
schema.post('remove', function (doc, next) { });
}
它总是首先选择post定义,doc将是mongodb.MongoError,next将是T。
我错过了什么吗?
以及如何让它选择第二个post定义?
【问题讨论】:
标签: typescript mongoose