我在这里使用官方文档尝试将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] 删除。
我来说两句