Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FirebaseServerApp Typescript exactOptionalPropertyTypes error #8341

Merged
merged 11 commits into from
Jul 1, 2024

Conversation

DellaBitta
Copy link
Contributor

@DellaBitta DellaBitta commented Jun 27, 2024

Discussion

This change fixes a TypeScript compilation error.

The FirebaseServerAppSettings.name field inherited from FirebaseAppSettings but the type was redefined from string to undefined. This redefinition would cause a TypeScript compliation error if exactOptionalPropertyTypes was set true in packages/app/tsconfig.json.

This change now uses omit< , > to strip the name field from the FirebaseServerAppSettings declaration, where FirebaseAppSettings is extended.

Fixes #8336

Testing

  • Local build with the TypeScript exactOptionalPropertyTypes setting defined as true.
  • CI

API Changes

While the type definition of FirebaseServerAppSettings has changed visually, the effective signature is the same. In both versions of FirebaseServerAppSettings the use of the name field would result in TypeScript compliation errors. I ensured this by creating a simple TypeScript app that attempted to use the name field, and compiled against the two varying FirebaseServerAppSettings definitiions.

Copy link

changeset-bot bot commented Jun 27, 2024

🦋 Changeset detected

Latest commit: ad7a9ad

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
firebase Patch
@firebase/app Patch
@firebase/app-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 27, 2024

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 27, 2024

Copy link
Contributor

github-actions bot commented Jun 28, 2024

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

@DellaBitta DellaBitta marked this pull request as ready for review June 28, 2024 19:54
@DellaBitta DellaBitta requested review from a team as code owners June 28, 2024 19:54
//
// @public
export function isWebWorker(): boolean;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently I missed the doc generate step on the user-created PR that added this function (#8315). My bad.

Copy link
Contributor

@hsubox76 hsubox76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, thanks!

Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text strings LGTM, thanks!

@DellaBitta DellaBitta merged commit f018062 into master Jul 1, 2024
42 checks passed
@DellaBitta DellaBitta deleted the ddb-firebaseserverappsettings-name branch July 1, 2024 22:09
@google-oss-bot google-oss-bot mentioned this pull request Jul 2, 2024
tom-andersen pushed a commit that referenced this pull request Jul 24, 2024
)

This change fixes a TypeScript compilation error. 

The `FirebaseServerAppSettings.name` field inherited from `FirebaseAppSettings` but the type was redefined from `string` to `undefined`. This redefinition would cause a TypeScript compliation error if `exactOptionalPropertyTypes` was set `true` in `packages/app/tsconfig.json`.

This change now uses `omit< , >` to strip the `name` field from the `FirebaseServerAppSettings` declaration, where `FirebaseAppSettings` is extended.

Fixes #8336
@firebase firebase locked and limited conversation to collaborators Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation Error with Typescript when enabling "exactOptionalPropertyTypes"
5 participants