Closed
Description
Issue
- Firestore doc
update
method raises a type error when passing individual properties. - This method will also raise an error on custom JS objects.
Version info
AngularFire 5.0.0
Steps to Reproduce
/// 1. Type error issue
interface IUser {
name: string;
age: number;
}
const userDoc: AngularFirestoreDocument<IUser> = this.afs.doc('user/someId') ;
userDoc.update({ name: 'someName' }) /// not assignable to type IUser
/// 2. Custom object error issue
class User {
constructor(public name: string, public age: number){}
}
userDoc.update(new User('hello', 23) ) /// invalid data error
Expected behavior
- No type error when passing individual params to update
- No errors when passing custom JS objects to update.
Proposed fix: remove generic and add spread to data argument in firestore/document.ts
/**
* Update some fields of a document without overwriting the entire document.
* @param data
*/
update(data): Promise<void> {
return this.ref.update({ ...data });
}
Metadata
Metadata
Assignees
Labels
No labels