diff --git a/src/providers/firestore.ts b/src/providers/firestore.ts index 291d7d7f9..f91e17306 100644 --- a/src/providers/firestore.ts +++ b/src/providers/firestore.ts @@ -42,6 +42,7 @@ export const service = 'firestore.googleapis.com'; export const defaultDatabase = '(default)'; let firestoreInstance: any; export type DocumentSnapshot = firebase.firestore.DocumentSnapshot; +export type QueryDocumentSnapshot = firebase.firestore.QueryDocumentSnapshot; /** * Select the Firestore document to listen to for events. @@ -204,30 +205,30 @@ export class DocumentBuilder { /** Respond only to document updates. */ onUpdate( handler: ( - change: Change, + change: Change, context: EventContext ) => PromiseLike | any - ): CloudFunction> { + ): CloudFunction> { return this.onOperation(handler, 'document.update', changeConstructor); } /** Respond only to document creations. */ onCreate( handler: ( - snapshot: DocumentSnapshot, + snapshot: QueryDocumentSnapshot, context: EventContext ) => PromiseLike | any - ): CloudFunction { + ): CloudFunction { return this.onOperation(handler, 'document.create', snapshotConstructor); } /** Respond only to document deletions. */ onDelete( handler: ( - snapshot: DocumentSnapshot, + snapshot: QueryDocumentSnapshot, context: EventContext ) => PromiseLike | any - ): CloudFunction { + ): CloudFunction { return this.onOperation( handler, 'document.delete',