Skip to content

fix(schematics): only emit FirebaseOptions keys in the generated app config#3707

Open
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:fix/schematic-firebase-options-allowlist
Open

fix(schematics): only emit FirebaseOptions keys in the generated app config#3707
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:fix/schematic-firebase-options-allowlist

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

ng add @angular/fire inlines the Firebase CLI's apps.sdkconfig response into initializeApp(). That response includes management-API fields (projectNumber, version, locationId) that FirebaseOptions does not accept; only locationId was being stripped (added for #3452 / #3556), so the generated app fails to compile with TS2769: 'projectNumber' does not exist in type 'FirebaseOptions'. This is the third report of the class.

This replaces the single-key delete with an allowlist of the keys initializeApp() accepts, so future additions to the CLI response can't break the generated config.

Companion PR #3706 declares the ES2022 lib the Object.fromEntries here relies on (IDE-only; not required for CI).

Fixes #3675

…config

The Firebase CLI's apps.sdkconfig response includes management-API
fields (projectNumber, version, locationId) alongside the web app
config. The schematic only deleted locationId and inlined the rest
into initializeApp(), so the generated app failed to compile with
TS2769: 'projectNumber' does not exist in type 'FirebaseOptions'.

Keep only the keys FirebaseOptions accepts, so future additions to
the CLI response cannot break the generated config again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ng add @angular/fire <- Generates the config that does not compile

2 participants