After upgrading the firebase JS SDK from v7 to v8.0.0, I changed my import of firebase as shown below.
import * as firebase from 'firebase';
However, attempting to access certain properties resulted in an error message:
firebase.firestore.FieldValue.serverTimestamp()
firebase.User
firebase.auth.UserCredential
The error: export 'firestore' (imported as 'firebase') was not found in 'firebase' Property 'firestore' does not exist on type 'typeof import("appPath/node_modules/firebase/index")'
To work around this issue, I had to modify my code by using firebase.default instead, like so:
firebase.default.firestore.FieldValue.serverTimestamp()
Is this the correct solution to resolve the problem?
In addition to that, AngularFire is also being used in this project. I attempted another approach:
import firebase from 'firebase/app';
import 'firebase/firestore';
export const firestore = firebase.firestore();
Unfortunately, this led to a different error:
Uncaught FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).