I'm inserting a new document into my firestore collection like so:
this.afs.collection<Client>('clients').add(this.form.value).then(docRef => {
console.log("Need to output the firestore generated doc id of the document here: ...")
})
Got it: then() takes a union type (http://www.typescriptlang.org/docs/handbook/advanced-types.html): void | DocumentReference
.
Therefore needs to be addressed like this:
this.afs.collection<Client>('clients').add(this.form.value).then(docRef => {
console.log((docRef) ? (<DocumentReference>docRef).id : 'void') // docRef of type void | DocumentReference
})