Node.js 如何在typescript中正确键入mongoose引用文档

Node.js 如何在typescript中正确键入mongoose引用文档,node.js,typescript,mongoose,Node.js,Typescript,Mongoose,mongoose.Types.ObjectId工作正常,但我希望使用用户文档类型更好地键入它,因此如果填充它,它将推断出正确的类型,如profile.User.toObject({getters:true})。我看到过使用UserDocument['id']的文章,但它会返回any。有没有合适的方法来输入这个 interface IProfile { user: // <- what type to put here (reference to User model) bio: s

mongoose.Types.ObjectId工作正常,但我希望使用用户文档类型更好地键入它,因此如果填充它,它将推断出正确的类型,如
profile.User.toObject({getters:true})
。我看到过使用
UserDocument['id']
的文章,但它会返回
any
。有没有合适的方法来输入这个

interface IProfile {
  user: // <- what type to put here (reference to User model)
  bio: string
  jobTitle: string
}
接口IProfile{
用户://