根据官方文档在app.module中导入@ angular / fire时输入错误?

塞巴斯蒂安

我在这里使用官方文档尝试将firebase添加到我的angular应用程序中,但是我不断收到以下类型错误:

ype '{ ngModule: typeof AngularFireModule; providers: { provide: InjectionToken<string | FirebaseAppConfig>; useValue: string | FirebaseAppConfig; }[]; }' is not assignable to type 'any[] | Type<any>'.
  Type '{ ngModule: typeof AngularFireModule; providers: { provide: InjectionToken<string | FirebaseAppConfig>; useValue: string | FirebaseAppConfig; }[]; }' is missing the following properties from type 'Type<any>': apply, call, bind, prototype, and 5 more.ts(2322)

这是一个专门用于测试Firebase的新项目,经过一段时间后,在github和firebase松弛上,我似乎无法弄清楚我做错了什么基本的事情。

我的进口:

import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireAuthModule } from '@angular/fire/auth';

在app.module中的imports数组中:

AngularFireModule.initializeApp(config), // <== this one throws the error
AngularFirestoreModule, // firestore
AngularFireAuthModule, // auth

我使用了命令:

yarn add firebase @angular/fire

按照文档和我的package.json安装,我有:

    "firebase": "^6.2.2",
    "@angular/fire": "^5.2.1",

在以下版本中使用Angular 8:

    "@angular/animations": "~8.0.2",
    "@angular/common": "~8.0.2",
    "@angular/compiler": "~8.0.2",
    "@angular/core": "~8.0.2",
塞巴斯蒂安

事实证明一切正常,我以错误的数组导入它,没有注意到。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在 App 和每个 Module angular 2 中导入 sharedModule

在App Module中导入可注入值到SubModule时

无法在app.module中导入MatDialogModule

如何使用ModuleWithProviders在Angular Module中导入其他模块

即使在app.module中导入了不使用的模块并且不使用它,angular-cli也会删除未使用的模块吗?

Angular 2+,有什么方法可以声明一个模块中的所有组件,然后在 app.module.ts 中导入?

在Angular中导入数据

在组件(Angular 2)中导入ComponentResolver时出错

在Angular 9 CLI Webworker中导入mathjs时出错

Angular5 在项目中导入 RxJS 时出错

为什么要在app.module.ts中导入{HttpClientModule}

在app.module.ts中导入外部模块

在类中导入模块时出现“NameError: name [module] is not defined”

在Angular项目中导入库时出现“找不到模块Fingerprintjs2”错误

在Angular 6中导入“ ngx-bootstrap / datepicker”模块时遇到错误

在Nativescript Angular中导入组件

在Angular中导入库/模块

在Angular中导入JS库

在Angular中导入很多模块

在应用程序中导入时,Angular Library Route Module不起作用

在angular 6 angular.json中导入bootstrap错误:ENOENT:没有这样的文件或目录

如何在Angular 4.x(Angular Cli)App中导入RequireJS(AMD)模块?

类不是Angular模块-仅在IntelliJ / Webstorm中导入本地构建的Angular库时

node_modules/@angular/fire/firebase.app.module.d.ts中的错误?

Angular Fire 导入 Angular 13

尝试在Swift App中导入MoPub库时出错(错误:使用未声明的类型)

在Angular6中导入jquery:找不到模块:错误:无法解析'jquery'

在Angular 7中导入Bootstrap时,Bootstrap 4下拉菜单中断

在Angular中导入@ ngrx / core @ ngrx / store时出现问题