【发布时间】:2021-10-17 01:33:36
【问题描述】:
如何在猫鼬模式中使用 TS 类型?我有以下内容:
...
type Associated = {
associatedId : string
imei : string
vehicleTypeId: string
}
interface IGroup extends Document {
...
associated: Associated
...
}
const Group = new Schema(
{
...
associated: {
type: Associated
},
...
},
{
collection: 'group'
}
)
...
但我收到一个错误:“关联”仅指一种类型,但在此处用作值。
【问题讨论】:
标签: node.js typescript mongoose mongoose-schema