草庐IT

javascript - 类型 'Observable<Object>' 不可分配给类型 'Observable<IUser[]>'

在我的Api服务中,我有这个简单的getUsers函数来获取API上的所有用户。publicgetUsers(url:string):Observable{returnthis._http.get(url);}这是我的IUser界面,我现在将所有字段设为可选。exportinterfaceIUser{id?:string;first_name?:string;last_name?:string;location?:string;followers?:string;following?:string;checkins?:string;image?:string;}下面是我在组件中使用该服

node.js - 使用 Typescript 在 Mongoose 中链接 ES6 Promise

我正在尝试将ES6promise与Mongoose4.5.4链接起来publicstaticsignup(req:express.Request,res:express.Response){UserModel.findOne({email:req.body.email}).exec().then(existingUser=>{if(existingUser){returnres.send({message:'Emailisinuse'});}returnUserModel.create({firstName:req.body.firstName,lastName:req.body.la