Firebase namespace error out of sudden

Hi, what has happen to my ionic code? Out of sudden my firebase is having error.

import { InjectionToken } from '@angular/core';
import { FirebaseAppConfig } from './';
import * as firebase from 'firebase/app';
export declare const FirebaseAppConfigToken: InjectionToken<FirebaseAppConfig>;
export declare class FirebaseApp implements {
    name: string;
    options: {};
    auth: () => firebase.auth.Auth;
    database: () => firebase.database.Database;
    messaging: () => firebase.messaging.Messaging;
    storage: () =>;
    delete: () => Promise<any>;
    firestore: () => firebase.firestore.Firestore;
export declare function _firebaseAppFactory(config: FirebaseAppConfig, appName?: string): FirebaseApp;

All my firebase is underline with red.

Hey there,

When Firebase updated to version 4.8.1 they refactored their type definitions, I wrote an email yesterday explaining this to my list, you can see the archive here:


If you simply want the error gone

npm uninstall --save firebase 

in package.json change “firebase”: “^4.8.1”
to “4.8.0” then save package.json

reinstall firebase.

I don’t know if this is necessarily what you “should” do, but to the best of my knowledge, rolling back .1 should be fine until 4.8.1 and Ionic are working harmoniously (or we know exactly how to reword our imports to get in line with @javebratt ‘s post)

1 Like

The thing is, it’s not about that, it’s not a mismatch between Ionic and Firebase, it’s simply that the version 4.8.1 of Firebase refactored their type definitions, so you need to make some changes if you want to use them (or you can declare everything as any).

Check out this provider I use for UserProfile related stuff: it’s already refactored to 4.8.1 and it’s working without any issues.

So update types and carry on. Thank’s for the example / link @javebratt.

No problem, that updated hit me out of the blue. I do believe Firebase should have done a better job at letting us know about it and what we needed to do to upgrade :smiley:

Yeah. It literally came out of nowhere. The forum acts as pretty effective word-of-mouth updating though. Perhaps they took that into consideration.

Thankyou guys for all the great help. Didn’t know that Ionic is still in beta mode.