{
address: "123"
number: "456643634634634"
postcode: "hshshs"
}
文件定义如下:
userDocument : AngularFirestoreDocument<User>;
this.userDocument = this.afs.collection('users').doc(`${this.userId}`);
addCard(card: Card){
this.userDocument.update({
cards : firebase.firestore.FieldValue.arrayUnion(card)
});
}
但是,在保存文档之前,我会出错,说:
[ts]
Type 'FieldValue' is not assignable to type 'Card[]'.
Property 'length' is missing in type 'FieldValue'. [2322]
user.model.ts(15, 5): The expected type comes from property 'cards' which is declared here on type 'Partial<User>'
不知道怎么用
arrayUnion