Changing UpdateData<T> to expand support for types with index signatures.#7318
Merged
MarkDuckworth merged 14 commits intomasterfrom Jun 30, 2023
Merged
Changing UpdateData<T> to expand support for types with index signatures.#7318MarkDuckworth merged 14 commits intomasterfrom
MarkDuckworth merged 14 commits intomasterfrom
Conversation
🦋 Changeset detectedLatest commit: 4ec7437 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
Collaborator
Size Report 1Affected ProductsNo changes between base commit (f2fb56f) and merge commit (ed7ab0e).Test Logs |
Collaborator
Size Analysis Report 1Affected ProductsNo changes between base commit (f2fb56f) and merge commit (ed7ab0e).Test Logs |
dconeybe
approved these changes
May 25, 2023
Contributor
dconeybe
left a comment
There was a problem hiding this comment.
Thanks for this fix! I can't honestly say I completely understand it; however, the I understand the unit tests so it looks good to me!
…kduckworth/nested-update-data-v9
…base/firebase-js-sdk into markduckworth/nested-update-data-v10
hsubox76
reviewed
Jun 30, 2023
hsubox76
approved these changes
Jun 30, 2023
markarndt
approved these changes
Jun 30, 2023
…kduckworth/nested-update-data-v10
…ebase/firebase-js-sdk into markduckworth/nested-update-data-v10
Merged
Contributor
|
This was included in the v10.0.0 release: https://firebase.google.com/support/release-notes/js#version_1000_-_july_6_2023 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change relaxes
UpdateData<T>, so that dot notation can be used to update typesTwhereTcontains an index signature. An example typeTthat this affects:Without this change, dot notation can not be used to update field
'indexed.foo.booleanProperty'.With this change, the following code is now possible:
The downside of this change is that we lose type safety and auto-complete for these types. For example we can do the following:
However, type safety and auto-complete are still in place if doing full object replacement:
And, we should note that type safety and auto complete are still in place for nested types when index signature is not involved.
Fixes #6105
Reviewers should understand that the unit tests in
lite-api/types.test.tsare all new. These tests are introduced in a different pull request (7319) and are intended to ensure that UpdateData does not regress in unexpected ways with the fix in this PR.