【问题标题】:In Cloud Functions, where to import the Firestore `Query` type from?在 Cloud Functions 中,从哪里导入 Firestore `Query` 类型?
【发布时间】:2018-07-28 04:47:07
【问题描述】:

我正在尝试在我的一个 TypeScript 文件中输入 import Query 类型,但没有成功。在firebase-admin 包中找不到它,当我尝试使用@firebase/firestore-types(建议不要使用,因为类型应该与firebase一起使用)它抱怨Cannot find module '@firebase/firestore-types' from...

我应该从哪里导入它? firebase 包有,但用于客户端 SDK。

【问题讨论】:

  • ...GeoPoint 类型相同,但我想上面的答案也会给出GeoPoint 的答案。

标签: node.js typescript firebase google-cloud-firestore firebase-admin


【解决方案1】:

您可以通过firestore.d.ts 中声明的命名空间访问这些类型。它被命名为FirebaseFirestore

在你的情况下使用:

import * as admin from 'firebase-admin';
...

const query: FirebaseFirestore.Query = ...

【讨论】:

    猜你喜欢
    • 2020-10-03
    • 2021-11-10
    • 2018-03-23
    • 1970-01-01
    • 2018-06-01
    • 2020-06-04
    • 2021-11-17
    • 1970-01-01
    • 2018-03-27
    相关资源
    最近更新 更多