typescript - Typescript Mongoose 在 VS Code 中获取 Schema 字段的 IntelliSense 或警告
问题描述
我想为我的 Mongoose 模型设置代码完成。
因此,如果我创建一个新模型,我想查看在我的 Mongoose Schema 中定义的可用字段。编译器的错误/警告,并非所有字段都提供会很好
简单示例
//define Schema
const MyUserSchema = new Schema({
name: String,
firstname: String,
password: String
})
//create Model
export const MyUserModel = model('user', MyUserSchema)
//instance of MyUserModel
let testUser = new MyUserModel({
//want IntelliSense for fields here
name: "Lastname",
firstname: "Firstname",
password: "securepassword"
}):
我想我必须以某种方式使用接口。但我不知道如何使用它们。
解决方案
推荐阅读
- angular - 部署后从 URL 中删除 # 不起作用 - HTTP 404
- javascript - 需要帮助以使我的华夫饼图表响应
- c# - 根据Condition读取多个节点
- reactjs - React Native功能未触发
- java - 垃圾收集线程不断使用 100% cpu 的可能原因
- ios - PushKit 后台通知在初始视图控制器上触发 viewDidAppear
- react-native - ReactNative:如何将删除图像下载/保存到照片库?
- java - 如何在spring boot中从系统属性中获取值
- .htaccess - 如何仅将主页重定向到 https 而没有 www?
- php - AJAX删除方法在LARAVEL中添加两个路由参数