This is the example code from my video about using async/await with Cloud Functions. I've placed it here in a gist so it's easier to compare the "before" and "after" states for each case.
The code in this project is licensed under the Apache License 2.0.
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@Marcus-C137 @ykabbara
I must admit that I haven't tested this, but I think you can fix it by defining the type in the array. From the code it looks like it should be an array of DocumentData objects.
add this import to index.ts if you don't have it to get firebase types:
import * as firebase from 'firebase';
And edit package.json to add in the firebase reference so it looks something like the following:
Then edit the line where const results is created to read
const results: firebase.firestore.DocumentData [] = []
Like I said I didn't test this, so I'm not certain that DocumentData is the correct object type, You should be able to check it by calling typeof, and you can see the list in this doc: https://firebase.google.com/docs/reference/js/firebase.firestore.html.
I had a similar issue on my project when trying to pass a snapshot into an arrow function and fixed it by adding the type to the snapshot:
.then( (snapshot: firebase.firestore.QuerySnapshot) => {}
I hope that helps you and this isn't a red herring!