-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom prototype objects cannot be stored #476
Comments
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight. |
Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information. |
Our reasoning here essentially in two parts. We can't read data back into custom objects and since we can't reconstitute your object at read time we don't want to half-implement object mapping. The second part is that even if we did support custom objects for the obvious cases, inevitably people will be dissatisfied by what we've done. For example:
I realize you "just" want to store custom objects but really this opens a kind of Pandora's box that creates just as many problems as it solves. |
Thanks @wilhuff for the answer. Closing this issue as we consider this decision final. |
AngularFireStoreCollection.add()
has a hard validation for the typeobject
. I notice that the validator does not accept any objects with a 'custom' prototype:firebase-js-sdk/packages/firestore/src/util/input_validation.ts
Lines 241 to 251 in 6abd648
My question is what the reasoning is behind this hard check against the Object prototype?
When you're using custom objects as we do in Typescript the action fails even though the type is defined as
add(data: T): Promise<DocumentReference>;
- a type definition that implies any Object can be used.Related to #311.
The text was updated successfully, but these errors were encountered: