I have the following function
export async function onNewMessage(firestore, snapshot, context) {
console.log(JSON.stringify(snapshot))
}
How can I type the variables firestore
, snapshot
and context
? Where is the package with their types?
EDIT
I am currently using it, is this correct?
import { Firestore, DocumentSnapshot } from '@google-cloud/firestore'
import { EventContext } from 'firebase-functions'
async function onNewMessage(firestore: Firestore, snapshot: DocumentSnapshot, context: EventContext) {
console.log(JSON.stringify(snapshot))
console.log(JSON.stringify(context))
}
question from:
https://stackoverflow.com/questions/65903024/typescript-types-for-firebase-and-firestore 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…