diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ae24bfe4e..e0e3a1e05 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -16,7 +16,7 @@ import { FirebaseApp, FirebaseApps } from './app'; export function defaultFirebaseAppFactory(provided: FirebaseApp[]|undefined) { // Use the provided app, if there is only one, otherwise fetch the default app - if (provided && provided.length === 1) { return provided[0]; } + if (provided?.length === 1) { return provided[0]; } return new FirebaseApp(getApp()); } diff --git a/src/compat/firebase.app.module.ts b/src/compat/firebase.app.module.ts index 6e54b0fd4..a84d79379 100644 --- a/src/compat/firebase.app.module.ts +++ b/src/compat/firebase.app.module.ts @@ -15,7 +15,7 @@ export function ɵfirebaseAppFactory(options: FirebaseOptions, zone: NgZone, nam const config = typeof nameOrConfig === 'object' && nameOrConfig || {}; config.name = config.name || name; // Added any due to some inconsistency between @firebase/app and firebase types - const existingApp = firebase.apps.find(app => app && app.name === config.name); + const existingApp = firebase.apps.find(app => app?.name === config.name); // We support FirebaseConfig, initializeApp's public type only accepts string; need to cast as any // Could be solved with https://github.com/firebase/firebase-js-sdk/pull/1206 const app = (existingApp || zone.runOutsideAngular(() => firebase.initializeApp(options, config as any)));