I'm getting an error with my typescript code in Ionic/Angular. The error output is:
[22:55:09] typescript: C:/xampp/htdocs/project x/anonymous-social/src/pages/chat/chat.ts, line: 103 Expected 1 arguments, but got 0.
L102: if(!this.isUserThreadEmpty) {
L103: let threadKey = this.database.list('users/'+this.userData.uid+'/threads/'+this.recipient).push().key;
L104: let recipientData = {
I don't know exactly why it's happening, I would guess that push()
needs an argument but all the stackoverflow answers I saw online regarding how to get a key
in firebase pointed towards this solution so I'm not sure what's going on.
The actual code is:
if(!this.isUserThreadEmpty) {
let threadKey = this.database.list('users/'+this.userData.uid+'/threads/'+this.recipient).push().key;
let recipientData = {
recipient: this.recipient,
threadId: threadKey,
displayName: this.displayName,
}
Any ideas? I need to pass the key
to the recipientData
... What am I doing wrong?