Search code examples
angulartypescriptfirebasevisual-studio-codeangular-config

Argument of type 'EnvironmentProviders' is not assignable to parameter of type 'ImportProvidersSource'.ts(2345) in Angular Firebase project


I am working on an Angular project that is deployed on Firebase. All the tutorials about Firebase suggest the following way to store Firebase in the app.config.ts:

export const appConfig: ApplicationConfig = {
  providers: [
    importProvidersFrom(
      provideFirebaseApp(() => initializeApp(environment.firebase)), /* The problem line */
      provideFirestore(() => getFirestore()),
    ),
    provideRouter(routes)
  ],
};

I am currently have an error that is marked in VS Code and reported during ng serve: "Argument of type 'EnvironmentProviders' is not assignable to parameter of type 'ImportProvidersSource'.ts(2345)"

And I have no idea what to do and how to resolve that. I hope someone here can help me with that.

I tried many times different things. I have totally deleted and recreated my Firebase project, my application in Firebase, my Angular project. Nothing works.

If I am deleting the problem line, then the next one reporting the same problem.


Solution

  • This is related to Angular version not angular/fire, to solve the problem just remove the importProvidersFrom as it's no longer needed.