Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emannuell opened this issue Aug 22, 2018 · 3 comments

Comments

@emannuell
Copy link

emannuell commented Aug 22, 2018

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'.

@ifiokjr
Copy link

ifiokjr commented Nov 4, 2018

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

@ben-wall
Copy link

ben-wall commented Jun 13, 2019

  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.

mjpoulsen added a commit to mjpoulsen/geofirex that referenced this issue Oct 12, 2019
# This is the 1st commit message:

Update lock to include dev and optional properties.

# This is the commit message codediodeio#2:

Comment out dist.

# This is the commit message codediodeio#3:

dist initial commit.

# This is the commit message codediodeio#4:

Add firebase-admin.

# This is the commit message codediodeio#5:

Add firebase-admin.

# This is the commit message codediodeio#6:

Add firebase admin firestore typing.

# This is the commit message codediodeio#7:

Add logic to prevent duplicate results.

# This is the commit message codediodeio#8:

Update dist.

# This is the commit message codediodeio#9:

Add @firebase/app-types

# This is the commit message codediodeio#10:

Add static constructors for collection.

# This is the commit message codediodeio#11:

Remove @firebase/app-types

# This is the commit message codediodeio#12:

Remove CollectionReference typing.

# This is the commit message codediodeio#13:

Test point logic.

# This is the commit message codediodeio#14:

Another point test.

# This is the commit message codediodeio#15:

Add admin.app.App typing

# This is the commit message codediodeio#16:

Adjust point logic.

# This is the commit message codediodeio#17:

Revert point logic.

# This is the commit message codediodeio#18:

Distinct test.

# This is the commit message codediodeio#19:

Another distinct test.
@DK9000
Copy link

DK9000 commented Jul 5, 2021

it fixed my issue with version 8.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants