From 0d2ab6d643e3df421e8fdcd2413f567ed2ef15d4 Mon Sep 17 00:00:00 2001 From: Armando Navarro Date: Wed, 7 Oct 2026 13:24:30 -0700 Subject: [PATCH] style: use the optional chains typescript-eslint 8.71 asks for The Angular 22 upgrade needs @typescript-eslint 8.71 for TypeScript 6, and that release reports prefer-optional-chain on these two checks, so lint fails once it lands. Both rewrites keep behavior. An undefined provided list still falls through to getApp(). config.name is always a non-empty string, so a missing app still never matches it. --- src/app/app.module.ts | 2 +- src/compat/firebase.app.module.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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)));