Skip to content

change before and after data should not be undefined for onUpdate #659

Closed
@sk-

Description

@sk-

The change argument of the handler for onUpdate should probably be Change<QueryDocumentSnapshot> instead of Change<DocumentSnapshot>, so that change.after.data() and change.before.data() return a non undefined object.

See https://github.com/firebase/firebase-functions/blob/master/src/providers/firestore.ts#L205-L212

If that's not the case, please clarify when either of those can be actually undefined.

[REQUIRED] Version info

firebase-functions: 3.6.0

[REQUIRED] Expected behavior

change.before.data() and change.after.data() should have a type of DocumentData

[REQUIRED] Actual behavior

change.before.data() and change.after.data() have a type of DocumentData | undefined

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