-
Notifications
You must be signed in to change notification settings - Fork 218
Closed
Labels
Description
Related issues
None found.
[REQUIRED] Version info
node: v10.15.1
firebase-functions: v2.2.0
firebase-tools: v6.3.1
firebase-admin: ^7.0.0
[REQUIRED] Test case
import { firestore } from 'firebase-functions';
firestore
.document('collection/{documentId}')
.onUpdate(change => change.after.data());[REQUIRED] Steps to reproduce
Try to compile the above snippet using the latest version of TypeScript compiler (v3.3.0 at the time) with strictNullChecks enabled.
Compilation will fail with the following error:
test.ts:5:23 - error TS2532: Object is possibly 'undefined'.
5 .onUpdate(change => change.after.data());
~~~~~~~~~~~~
Found 1 error.
[REQUIRED] Expected behavior
Typings should not define before nor after as optional, according to the docs:
function(non-null functions.Change containing non-null functions.firestore.DocumentSnapshot, optional non-null functions.EventContext)
Event handler which is run every time data is updated in Cloud Firestore.
Value must not be null.
[REQUIRED] Actual behavior
See Steps to reproduce.
Were you able to successfully deploy your functions?
Not applicable.