ERROR in node_modules/@angular/fire/firestore/firestore.module.d.ts:7:74 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
7 static enablePersistence(persistenceSettings?: PersistenceSettings): ModuleWithProviders;
The above error is popping up as I try to integrate Firebase into my Angular 10 project. There were no issues when working with an older Angular 9 project.
Here are the steps I followed to add firebase:
npm install firebase @angular/fire --save
ng add @angular/fire
Updated environment.ts
production: false,
firebase: {
apiKey: <secret> ,
authDomain: <secret>,
databaseURL: <secret>,
projectId: <secret>,
storageBucket: <secret>,
messagingSenderId: <secret>,
appId: <secret>,
measurementId: <secret>
}
};
- Updated app.module.ts
// Firebase imports
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule} from '@angular/fire/firestore';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [
QuicklinkModule,
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
FlexLayoutModule,
SharedModule,
AngularFireModule.initializeApp(environment.firebase), // Main Angular fire module
AngularFirestoreModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Check out the ModuleWithProviders Migration Guide on Angular.io for more information.