mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Small improvement in types for feature flags definitions in JS (#47239)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47239 Changelog: [internal] Small refactor of the types for feature flags in JS to make objects read-only. Reviewed By: mdvacca Differential Revision: D65058612 fbshipit-source-id: 0d72df2f4afebf0426b9ac76a8f8b195c74fea52
This commit is contained in:
committed by
Facebook GitHub Bot
parent
66df63d3b5
commit
66ffa5ee4d
+21
-21
@@ -10,30 +10,30 @@
|
||||
|
||||
export type FeatureFlagValue = boolean | number | string;
|
||||
|
||||
export type FeatureFlagDefinitions = {
|
||||
export type FeatureFlagDefinitions = $ReadOnly<{
|
||||
common: CommonFeatureFlagList,
|
||||
jsOnly: JsOnlyFeatureFlagList,
|
||||
};
|
||||
}>;
|
||||
|
||||
type CommonFeatureFlagList = {
|
||||
[flagName: string]: {
|
||||
export type CommonFeatureFlagList = $ReadOnly<{
|
||||
[flagName: string]: $ReadOnly<{
|
||||
defaultValue: FeatureFlagValue,
|
||||
metadata: FeatureFlagMetadata,
|
||||
// Indicates if this API should only be defined in JavaScript, only to
|
||||
// preserve backwards compatibility with existing native code temporarily.
|
||||
skipNativeAPI?: true,
|
||||
},
|
||||
};
|
||||
}>,
|
||||
}>;
|
||||
|
||||
type JsOnlyFeatureFlagList = {
|
||||
[flagName: string]: {
|
||||
export type JsOnlyFeatureFlagList = $ReadOnly<{
|
||||
[flagName: string]: $ReadOnly<{
|
||||
defaultValue: FeatureFlagValue,
|
||||
metadata: FeatureFlagMetadata,
|
||||
},
|
||||
};
|
||||
}>,
|
||||
}>;
|
||||
|
||||
type FeatureFlagMetadata =
|
||||
| {
|
||||
export type FeatureFlagMetadata =
|
||||
| $ReadOnly<{
|
||||
purpose: 'experimentation',
|
||||
/**
|
||||
* Aproximate date when the flag was added.
|
||||
@@ -41,25 +41,25 @@ type FeatureFlagMetadata =
|
||||
*/
|
||||
dateAdded: string,
|
||||
description: string,
|
||||
}
|
||||
| {
|
||||
}>
|
||||
| $ReadOnly<{
|
||||
purpose: 'operational' | 'release',
|
||||
description: string,
|
||||
};
|
||||
}>;
|
||||
|
||||
export type GeneratorConfig = {
|
||||
export type GeneratorConfig = $ReadOnly<{
|
||||
featureFlagDefinitions: FeatureFlagDefinitions,
|
||||
jsPath: string,
|
||||
commonCxxPath: string,
|
||||
commonNativeModuleCxxPath: string,
|
||||
androidPath: string,
|
||||
androidJniPath: string,
|
||||
};
|
||||
}>;
|
||||
|
||||
export type GeneratorOptions = {
|
||||
export type GeneratorOptions = $ReadOnly<{
|
||||
verifyUnchanged: boolean,
|
||||
};
|
||||
}>;
|
||||
|
||||
export type GeneratorResult = {
|
||||
export type GeneratorResult = $ReadOnly<{
|
||||
[path: string]: string /* content */,
|
||||
};
|
||||
}>;
|
||||
|
||||
Reference in New Issue
Block a user