找不到命名空间 'FirebaseFirestore' - Node.js、Express、Typescript

Cannot find namespace 'FirebaseFirestore' - Node.js, Express, Typescript

我在我的 Express + Typescript 服务器中使用 Firebase Admin SDK。我正在尝试使用 Firestore 的方法 withConverter() 但是,我收到错误消息“找不到名称空间 'FirebaseFirestore'.ts(2503)”。我该如何处理?

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount)
});

const firestore = admin.firestore();

interface BlogpostColletion {
    text: String,
    title: String,
}

interface UsersCollection {
    blogposts: BlogpostColletion
}

const converter = {
    toFirestore: (data: UsersCollection) => data,
    // PROBLEM HERE "Cannot find namespace 'FirebaseFirestore'.ts(2503)" 
    fromFirestore: (snap: FirebaseFirestore.QueryDocumentSnapshot) =>
        snap.data() as UsersCollection
}

您可以像这样从 Admin SDK 导入 QueryDocumentSnapshot

import * as admin from "firebase-admin"

fromFirestore: (snap: admin.firestore.QueryDocumentSnapshot)