Updates type signature for memo-cache and fix security issue #3943
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.
Platforms Impacted
Description of changes
Type Updates
This updates the types in the memo-cache package to split the untyped and typed usage. Previously it used any in ways would make it look like it was typed, when in fact it had lost the type inferences. Now there are two patterns:
GetMemoValue<MyType>andgetMemoCache<MyType>()except things are more explicitly typed here. The previous utilities are replaced byGetTypedMemoValue<T>andgetTypedMemoCache<T>The previous usage was type unsafe, fails a bunch of more advanced lint rules and TS 5+ compilations, and at times would break inferencing in the project.
Security Fix
This fix addresses the code scanning issue: https://github.com/microsoft/fluentui-react-native/security/code-scanning/4 by making the calls to ensure entries in the underlying cache explicit rather than using the helper function.
Export entry removals
This also removes the export map entries for immutable-merge, memo-cache, and merge-props from framework base. These would require special handling in metro bundling to use and I don't want to tempt people into using something that breaks their bundling. It also eliminates another place where additional exports would need to be added.
Verification
Builds work, tests run, the changes should be almost entirely type only.