gpt4 book ai didi

firebase-realtime-database - 角 7 :TypeError: Class constructor Observable cannot be invoked without 'new'

转载 作者:行者123 更新时间:2023-12-03 23:28:12 25 4
gpt4 key购买 nike

this.db.object('/users/'+user.uid).update({
name:user.displayName,email:user.email
});
}

收到此错误:

core.js:9110 ERROR TypeError: Class constructor Observable cannot be invoked without 'new'
at new FirebaseObjectObservable (firebase_object_observable.js:16)
at FirebaseObjectFactory (firebase_object_factory.js:7)
at AngularFireDatabase.push../node_modules/angularfire2/database/database.js.AngularFireDatabase.object (database.js:18)
at UserService.save (user.service.ts:20)
at SafeSubscriber._next (app.component.ts:23)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:185)
at SafeSubscriber.next (Subscriber.js:124)
at Subscriber._next (Subscriber.js:72)
at Subscriber.next (Subscriber.js:49)
at Notification.observe (Notification.js:20)
defaultErrorLogger @ core.js:9110

最佳答案

转到 tsconfig.json,

将目标从 es2015 更改为 es5。

这对我有用。

我认为当您使用 AngularFire 数据库方法时编译器仍然有问题,我不是 100% 确定原因,但更改目标立即解决了问题,并且我的用户字段很容易在数据库中创建

关于firebase-realtime-database - 角 7 :TypeError: Class constructor Observable cannot be invoked without 'new' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57029413/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com