Typescript types for Firebase and Firestore

Viewed 676

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))
}
0 Answers
Related