-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
AFS document update type error and custom object error #1215
Comments
The data you're passing to the store must be an Object, not a class instance. Using plain Objects + interfaces is the method i'd advise |
@Toxicable that makes sense, but it seems like AngularFire could convert instances implicitly without harm? For example, you have PhoneNumber class you instantiate, then send that to update the userDocument - you wouldn't expect an instance back, but also wouldn't expect an error. What do you think about removing the generic type on the data argument, it was an |
That wouldn't be inconsistent if you don't get an instance back, what if the class has a method on it? you'd be able to use that method on the out going object but not in the incoming one, this would be very unintuitive. Also the type
|
That's how |
Well still, it feels a bit silly. It's nice being able to do: My current (silly) workaround is |
@larssn An easier solution would be the spread syntax, |
@codediodeio I don't think that works for deep objects |
@larssn Nope, one-level. |
Still this workaround for nested objects? |
@lakinduakash Yes |
Issue
update
method raises a type error when passing individual properties.Version info
AngularFire 5.0.0
Steps to Reproduce
Expected behavior
Proposed fix: remove generic and add spread to data argument in firestore/document.ts
The text was updated successfully, but these errors were encountered: