【问题标题】:How to install typings for Firebase 3 in a TypeScript 2 project?如何在 TypeScript 2 项目中为 Firebase 3 安装类型?
【发布时间】:2017-02-09 21:15:42
【问题描述】:

npm install @types/firebase --save-dev 为 v2.4.30 而非 v3 安装类型定义文件。

我的猜测是它们可能还不能通过 npm 获得。我说的对吗?

注意:在 TypeScript v2 中,类型定义文件通过 npm 安装,不再使用打字工具。

【问题讨论】:

  • 我也遇到了同样的问题。你找到解决方法了吗?

标签: typescript types firebase npm typescript-typings


【解决方案1】:

包括输入,所以 npm install firebase 仅此而已

【讨论】:

    【解决方案2】:

    我也有同样的问题。正如 Maciej 所说,它在包装中提供。但是,没有在 node_modules/firebase/* 路径中获取定义。作为一种解决方法,我将该文件包含在我的 tsconfig.json 中的“包含”数组中。 (我从 node_modules 中删除,因为输入包括不起作用并使用了对我的凉亭安装的引用)。

    "include": [
            "src/app/**/*.ts",
            "src/components/**/*.ts",
            "bower_components/firebase/firebase.d.ts"
    ]
    

    我这样做是因为如果我使用 'types' 或 'typeRoots',它会覆盖 /node_modules/@types 查找。

    【讨论】:

      猜你喜欢
      • 2017-02-15
      • 2021-07-08
      • 2019-02-04
      • 2021-01-24
      • 1970-01-01
      • 2022-11-25
      • 2016-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多