firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

onDocumentUpdate event is typed as having data potentially undefined

Open cedvdb opened this issue 2 years ago • 0 comments

It seems weird that an update event could contain nothing, if that's the case an update event did not occur, did it ?

// firestore.d.ts
export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;

It is annoying because it forces an additional, seemingly unnecessary, check.

cedvdb avatar May 30 '23 09:05 cedvdb