Skip to content

Firestore document .update() not working as intended #1245

Closed
@markgoho

Description

@markgoho

Version info

Angular: 4.3

Firebase: 4.5.0

AngularFire: 5.0 rc1

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

https://stackblitz.com/edit/angular-abcgfq?file=app%2Fapp.component.ts

I think stackblitz is having trouble with the AngularFire2 import, if you get the red squiggly under angularfire2/firestore go to dependencies, delete the library and re-install

Steps to set up and reproduce

Create an AngularFirestoreDocument call .update() on it with a single field (of a larger object) and it is not accepted.

Sample data and security rules n/a

<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->

Debug output

** Errors in the JavaScript console **

** Output from firebase.database().enableLogging(true); **

** Screenshots **

Expected behavior

I would expect that I can update a single field on a larger object as per the Firestore docs

Actual behavior

Typescript is telling me:

Argument of type '{ votes: number; }' is not assignable to parameter of type 'Post'.
  Property 'text' is missing in type '{ votes: number; }'.

That is to say, "We're looking for you to pass in the whole Post object, not just one field."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions