mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make feature flags module and overrides read-only (#48229)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48229 Changelog: [internal] The type definitions for these objects (the exported value by the `ReactNativeFeatureFlags` module, and the input value for `ReactNativeFeatureFlags.override()` method) were writable objects, which is incorrect and causes other problems down the line. This just makes them read-only. Reviewed By: yungsters Differential Revision: D67109719 fbshipit-source-id: 8d56e05042587a53cdd05e51b4207ef27ace2d91
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e04738b7ec
commit
11c49d60cc
+4
-4
@@ -34,18 +34,18 @@ import {
|
||||
setOverrides,
|
||||
} from './ReactNativeFeatureFlagsBase';
|
||||
|
||||
export type ReactNativeFeatureFlagsJsOnly = {
|
||||
export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{
|
||||
${Object.entries(definitions.jsOnly)
|
||||
.map(
|
||||
([flagName, flagConfig]) =>
|
||||
` ${flagName}: Getter<${typeof flagConfig.defaultValue}>,`,
|
||||
)
|
||||
.join('\n')}
|
||||
};
|
||||
}>;
|
||||
|
||||
export type ReactNativeFeatureFlagsJsOnlyOverrides = OverridesFor<ReactNativeFeatureFlagsJsOnly>;
|
||||
|
||||
export type ReactNativeFeatureFlags = {
|
||||
export type ReactNativeFeatureFlags = $ReadOnly<{
|
||||
...ReactNativeFeatureFlagsJsOnly,
|
||||
${Object.entries(definitions.common)
|
||||
.map(
|
||||
@@ -53,7 +53,7 @@ ${Object.entries(definitions.common)
|
||||
` ${flagName}: Getter<${typeof flagConfig.defaultValue}>,`,
|
||||
)
|
||||
.join('\n')}
|
||||
}
|
||||
}>;
|
||||
|
||||
${Object.entries(definitions.jsOnly)
|
||||
.map(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<52cce0be8ae96e530267bf0dbbcfbd2d>>
|
||||
* @generated SignedSource<<0c6bca5d443beff11d70a5cba470607f>>
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
setOverrides,
|
||||
} from './ReactNativeFeatureFlagsBase';
|
||||
|
||||
export type ReactNativeFeatureFlagsJsOnly = {
|
||||
export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{
|
||||
jsOnlyTestFlag: Getter<boolean>,
|
||||
animatedShouldDebounceQueueFlush: Getter<boolean>,
|
||||
animatedShouldUseSingleOp: Getter<boolean>,
|
||||
@@ -44,11 +44,11 @@ export type ReactNativeFeatureFlagsJsOnly = {
|
||||
shouldUseSetNativePropsInFabric: Getter<boolean>,
|
||||
useInsertionEffectsForAnimations: Getter<boolean>,
|
||||
useRefsForTextInputState: Getter<boolean>,
|
||||
};
|
||||
}>;
|
||||
|
||||
export type ReactNativeFeatureFlagsJsOnlyOverrides = OverridesFor<ReactNativeFeatureFlagsJsOnly>;
|
||||
|
||||
export type ReactNativeFeatureFlags = {
|
||||
export type ReactNativeFeatureFlags = $ReadOnly<{
|
||||
...ReactNativeFeatureFlagsJsOnly,
|
||||
commonTestFlag: Getter<boolean>,
|
||||
commonTestFlagWithoutNativeImplementation: Getter<boolean>,
|
||||
@@ -98,7 +98,7 @@ export type ReactNativeFeatureFlags = {
|
||||
useRuntimeShadowNodeReferenceUpdate: Getter<boolean>,
|
||||
useTurboModuleInterop: Getter<boolean>,
|
||||
useTurboModules: Getter<boolean>,
|
||||
}
|
||||
}>;
|
||||
|
||||
/**
|
||||
* JS-only flag for testing. Do NOT modify.
|
||||
|
||||
Reference in New Issue
Block a user