geofirex icon indicating copy to clipboard operation
geofirex copied to clipboard

Argument of type 'typeof firebase'is not assignable to parameter of type 'FirebaseApp'

Open emannuell opened this issue 7 years ago • 3 comments

Im getting this error from a fresh project, i have didnt found any answere. Thank you. package.json "dependencies": { "@agm/core": "^1.0.0-beta.3", "@angular/animations": "^5.2.0", "@angular/common": "^5.2.0", "@angular/compiler": "^5.2.0", "@angular/core": "^5.2.0", "@angular/forms": "^5.2.0", "@angular/http": "^5.2.0", "@angular/platform-browser": "^5.2.0", "@angular/platform-browser-dynamic": "^5.2.0", "@angular/router": "^5.2.0", "angularfire2": "^5.0.0-rc.11", "core-js": "^2.4.1", "firebase": "^5.4.0", "geofirex": "0.0.6", "rxjs": "^5.5.11", "zone.js": "^0.8.19" }, "devDependencies": { "@angular/cli": "~1.7.4", "@angular/compiler-cli": "^5.2.0", "@angular/language-service": "^5.2.0", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~4.1.0", "tslint": "~5.9.1", "typescript": "~2.5.3" }

app,module.ts

`import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AngularFireModule } from 'angularfire2';
import { AngularFirestoreModule } from 'angularfire2/firestore';
import { AngularFireStorageModule } from 'angularfire2/storage';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AgmCoreModule } from '@agm/core';
import { environment } from '../environments/environment';
import { GoogleMapComponent } from './google-map/google-map.component';

@NgModule({
  declarations: [
    AppComponent,
    GoogleMapComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    AngularFireModule.initializeApp(environment.firebase), // imports firebase/app needed for everything
    AngularFirestoreModule, // imports firebase/firestore, only needed for database features
    AngularFireAuthModule, // imports firebase/auth, only needed for auth features,
    AngularFireStorageModule,
    AgmCoreModule.forRoot({
      apiKey: environment.googleMapsKey
    })
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
`

webpack: Compiled successfully. ERROR in src/app/google-map/google-map.component.ts(23,31): error TS2345: Argument of type 'typeof firebase'is not assignable to parameter of type 'FirebaseApp'. Types of property 'firestore' are incompatible. Type 'typeof firestore' is not assignable to type '() => FirebaseFirestore'. Type 'Firestore' is not assignable to type 'FirebaseFirestore'. Types of property 'collection' are incompatible. Type '(collectionPath: string) => firebase.firestore.CollectionReference' is not assignable to type '(collectionPath: string) => CollectionReference'. Type 'firebase.firestore.CollectionReference' is not assignable to type 'CollectionReference'. Types of property 'parent' are incompatible. Type 'firebase.firestore.DocumentReference' is not assignable to type 'DocumentReference'. Types of property 'firestore' are incompatible. Type 'Firestore' is not assignable to type 'FirebaseFirestore'.

emannuell avatar Aug 22 '18 21:08 emannuell

@emannuell What's the code in your '../environments/environment' module?

ifiokjr avatar Nov 04 '18 23:11 ifiokjr

  firebase: {
    apiKey: '...',
    authDomain: '...',
    databaseURL: '...',
    projectId: '...',
    storageBucket: '...',
    messagingSenderId: '...',
  },

I'm having the same issue and I'm passing it firebase after initialising with this configuration ( replaced values with '...' for this comment)

This issue began for me after I removed node_modules/ and ran npm install.

During that time my firebase version went from

"firebase": "^5.9.1",

to

"firebase": "^5.11.1",

running

npm un firebase && npm i firebase

fixed my issue.

ben-wall avatar Jun 13 '19 01:06 ben-wall

it fixed my issue with version 8.7.0

DK9000 avatar Jul 05 '21 21:07 DK9000