Ad
Type Error When Importing @angular/fire In App.module Based On The Official Documentation?
I'm using the official documentation here to try to add firebase to my angular app, but I keep getting the following type error:
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)
this is a fresh project built specifically to test firebase out and after a bit of time here, on github and on the firebase slack, I can't seem to figure out what basic thing I'm doing wrong.
My imports:
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireAuthModule } from '@angular/fire/auth';
in the imports array in app.module:
AngularFireModule.initializeApp(config), // <== this one throws the error
AngularFirestoreModule, // firestore
AngularFireAuthModule, // auth
I used the command:
yarn add firebase @angular/fire
to install as in the documentation and in my package.json I have:
"firebase": "^6.2.2",
"@angular/fire": "^5.2.1",
Using Angular 8 with these versions:
"@angular/animations": "~8.0.2",
"@angular/common": "~8.0.2",
"@angular/compiler": "~8.0.2",
"@angular/core": "~8.0.2",
Ad
Answer
Turns out everything works fine, I was importing it in the wrong array and didn't notice.
Ad
source: stackoverflow.com
Related Questions
- → Make a Laravel collection into angular array (octobercms)
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → Angularjs not working inside laravel form
- → Analysis of Flux implementations
- → how to write react component to construct HTML DOM
- → angular ng-repeat and images in a row
- → Conditional BG Color on AngularJS
- → Should I 'use strict' for every single javascript function I write?
- → getting the correct record in Angular with a json feed and passed data
- → "Undefined is not a function" at .toBe fucntion
- → angularjs data binding issue
- → Angular / JavaScript auto hydrate an instance
- → Convert generic text string in json object into valid url using Angular
Ad