-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Issue
- Firestore doc
updatemethod 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 errorExpected 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 });
}nclarx, vysker, midroid, larssn, RaymsDev and 2 more
Metadata
Metadata
Assignees
Labels
No labels
