Visitar URL original
style: use the optional chains typescript-eslint 8.71 asks for by armando-navarro · Pull Request #3797 · angular/angularfire · GitHub
Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
armando-navarro committed Oct 7, 2026
commit 0d2ab6d643e3df421e8fdcd2413f567ed2ef15d4
2 changes: 1 addition & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion src/compat/firebase.app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
Loading