From 41efc3b5886e285b9b660fa4504f759eeac796c4 Mon Sep 17 00:00:00 2001 From: Marco Wang Date: Tue, 6 Jan 2026 20:23:03 -0800 Subject: [PATCH] Transform $ReadOnly to Readonly 38/n (#55067) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55067 Differential Revision: D90146229 fbshipit-source-id: 62733ba51fd0c318140b7a76b499b1a7ac1f7853 --- .../react-native-codegen/src/CodegenSchema.js | 94 +++++++++---------- .../src/generators/RNCodegen.js | 10 +- .../components/GenerateEventEmitterCpp.js | 2 +- .../components/GenerateEventEmitterH.js | 2 +- .../GeneratePropsJavaPojo/PojoCollector.js | 20 ++-- .../generators/components/GenerateTests.js | 2 +- .../src/generators/modules/GenerateModuleH.js | 6 +- .../modules/GenerateModuleJavaSpec.js | 4 +- .../modules/GenerateModuleJniCpp.js | 8 +- .../generators/modules/GenerateModuleJniH.js | 6 +- .../GenerateModuleObjCpp/StructCollector.js | 8 +- .../header/serializeConstantsStruct.js | 4 +- .../header/serializeRegularStruct.js | 4 +- .../header/serializeStruct.js | 2 +- .../modules/GenerateModuleObjCpp/index.js | 6 +- .../GenerateModuleObjCpp/serializeMethod.js | 8 +- .../source/serializeModule.js | 8 +- .../src/generators/modules/Utils.js | 2 +- .../src/parsers/flow/components/commands.js | 2 +- .../__tests__/module-parser-e2e-test.js | 4 +- .../parsers/flow/parseFlowAndThrowErrors.js | 2 +- .../src/parsers/parsers-commons.js | 2 +- .../src/parsers/schema.js | 2 +- .../typescript-module-parser-e2e-test.js | 4 +- .../react-native-codegen/src/parsers/utils.js | 6 +- .../NativeComponent.js.flow | 10 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 4 +- .../NativeComponent.js.flow | 4 +- .../NativeComponent.js.flow | 4 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../native-component/NativeComponent.js.flow | 2 +- .../NativeModule.js.flow | 2 +- .../NativeModule.js.flow | 2 +- .../NativeModule.js.flow | 2 +- .../js/PopupMenuAndroid.android.js | 4 +- ...PopupMenuAndroidNativeComponent.android.js | 6 +- .../components/SwitchNativeComponent.js | 4 +- .../UnimplementedNativeViewNativeComponent.js | 2 +- .../testing/fantom/specs/NativeFantom.js | 4 +- .../dom/events/EventHandlerAttributes.js | 2 +- .../private/webapis/dom/events/EventTarget.js | 4 +- .../webapis/dom/nodes/specs/NativeDOM.js | 12 +-- .../__tests__/IntersectionObserver-itest.js | 2 +- .../internals/MutationObserverManager.js | 2 +- .../webapis/performance/Performance.js | 6 +- .../IntegrationTestHarnessTest.js | 2 +- .../IntegrationTests/LayoutEventsTest.js | 2 +- .../rn-tester/IntegrationTests/TimersTest.js | 2 +- .../js/MyLegacyViewNativeComponent.js | 2 +- .../js/MyNativeViewNativeComponent.js | 6 +- .../RCTTest/RCTSnapshotNativeComponent.js | 4 +- .../ReportFullyDrawnViewNativeComponent.js | 2 +- .../js/components/RNTConfigurationBlock.js | 2 +- packages/rn-tester/js/components/RNTOption.js | 2 +- .../rn-tester/js/components/RNTesterBlock.js | 2 +- .../rn-tester/js/components/RNTesterButton.js | 2 +- .../js/components/RNTesterComponentTitle.js | 2 +- .../js/components/RNTesterDocumentationURL.js | 2 +- .../rn-tester/js/components/RNTesterNavbar.js | 8 +- .../rn-tester/js/components/RNTesterPage.js | 2 +- .../rn-tester/js/components/RNTesterText.js | 2 +- .../rn-tester/js/components/RNTesterTheme.js | 2 +- .../rn-tester/js/components/RNTesterTitle.js | 2 +- packages/rn-tester/js/components/UseCase.js | 2 +- .../Accessibility/AccessibilityIOSExample.js | 2 +- .../ActionSheetIOS/ActionSheetIOSExample.js | 2 +- .../js/examples/Animated/ComposingExample.js | 2 +- .../js/examples/Animated/EasingExample.js | 2 +- .../js/examples/Animated/MovingBoxExample.js | 2 +- .../js/examples/Animated/PanGestureExample.js | 8 +- .../examples/AnimatedGratuitousApp/AnExSet.js | 2 +- .../PlatformTest/RNTesterPlatformTest.js | 2 +- .../RNTesterPlatformTestEventRecorder.js | 6 +- .../RNTesterPlatformTestInstructions.js | 2 +- ...RNTesterPlatformTestMinimizedResultView.js | 2 +- .../RNTesterPlatformTestResultView.js | 4 +- .../RNTesterPlatformTestResultsText.js | 2 +- .../PlatformTest/RNTesterPlatformTestTypes.js | 16 ++-- .../PlatformTest/usePlatformTestHarness.js | 8 +- ...PointerEventAttributesHoverablePointers.js | 2 +- .../PointerEventAttributesNoHoverPointers.js | 2 +- .../PointerEventCaptureMouse.js | 2 +- .../PointerEventClickTouch.js | 2 +- .../PointerEventClickTouchHierarchy.js | 2 +- ...erEventClickTouchHierarchyPointerEvents.js | 2 +- ...rEventLayoutChangeShouldFirePointerOver.js | 2 +- .../PointerEventPointerCancelTouch.js | 2 +- .../PointerEventPointerMove.js | 2 +- .../PointerEventPointerMoveAcross.js | 2 +- .../PointerEventPointerMoveBetween.js | 2 +- .../PointerEventPointerMoveEventOrder.js | 2 +- ...terEventPointerMoveOnChordedMouseButton.js | 2 +- .../PointerEventPointerOverOut.js | 2 +- .../PointerEventPrimaryTouchPointer.js | 2 +- .../PointerEventSupport.js | 2 +- .../js/examples/Filter/FilterExample.js | 2 +- .../examples/FlatList/BaseFlatListExample.js | 2 +- .../js/examples/FlatList/FlatList-basic.js | 2 +- .../examples/Image/ImageCapInsetsExample.js | 2 +- .../js/examples/Image/ImageExample.js | 20 ++-- .../js/examples/Layout/LayoutEventsExample.js | 2 +- .../js/examples/Layout/LayoutExample.js | 4 +- .../LayoutConformanceExample.js | 2 +- .../LinearGradient/LinearGradientExample.js | 2 +- .../js/examples/Linking/LinkingExample.js | 8 +- .../MixBlendMode/MixBlendModeExample.js | 2 +- .../Performance/components/ItemList.js | 2 +- .../PointerEvents/PointerEventsExample.js | 8 +- .../RadialGradient/RadialGradientExample.js | 2 +- .../RefreshControl/RefreshControlExample.js | 8 +- .../ScrollViewKeyboardInsetsIOSExample.js | 2 +- .../SectionList/SectionListBaseExample.js | 2 +- .../examples/Snapshot/SnapshotViewIOS.ios.js | 4 +- .../js/examples/Switch/SwitchExample.js | 6 +- .../js/examples/Text/TextExample.android.js | 2 +- .../js/examples/Text/TextExample.ios.js | 10 +- .../js/examples/Text/TextSharedExamples.js | 2 +- .../TextInput/TextInputExample.ios.js | 4 +- .../TextInput/TextInputSharedExamples.js | 2 +- .../js/examples/Timer/TimerExample.js | 6 +- .../rn-tester/js/examples/View/ViewExample.js | 10 +- .../js/examples/WebSocket/WebSocketExample.js | 10 +- packages/rn-tester/js/types/RNTesterTypes.js | 8 +- .../Lists/ListMetricsAggregator.js | 6 +- .../Lists/ViewabilityHelper.js | 2 +- .../Lists/VirtualizedList.js | 4 +- .../Lists/VirtualizedListCellRenderer.js | 2 +- .../Lists/VirtualizedListContext.js | 2 +- .../Lists/VirtualizedListProps.js | 2 +- .../Lists/VirtualizedSectionList.js | 6 +- .../Lists/__tests__/FillRateHelper-test.js | 8 +- .../Lists/__tests__/ViewabilityHelper-test.js | 2 +- .../runner/executables/hermesc.js | 2 +- .../runner/executables/tester.js | 2 +- private/react-native-fantom/src/Benchmark.js | 6 +- private/react-native-fantom/src/Constants.js | 2 +- private/react-native-fantom/src/index.js | 16 ++-- scripts/build/config.js | 6 +- .../js-api/build-types/buildApiSnapshot.js | 2 +- .../build-types/resolution/simpleResolve.js | 2 +- scripts/releases/utils/octokit-utils.js | 8 +- 156 files changed, 344 insertions(+), 344 deletions(-) diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 472d9d3084a..7013735b3dc 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -12,9 +12,9 @@ export type PlatformType = 'iOS' | 'android'; -export type SchemaType = $ReadOnly<{ +export type SchemaType = Readonly<{ libraryName?: string, - modules: $ReadOnly<{ + modules: Readonly<{ [hasteModuleName: string]: ComponentSchema | NativeModuleSchema, }>, }>; @@ -22,41 +22,41 @@ export type SchemaType = $ReadOnly<{ /** * Component Type Annotations */ -export type DoubleTypeAnnotation = $ReadOnly<{ +export type DoubleTypeAnnotation = Readonly<{ type: 'DoubleTypeAnnotation', }>; -export type FloatTypeAnnotation = $ReadOnly<{ +export type FloatTypeAnnotation = Readonly<{ type: 'FloatTypeAnnotation', }>; -export type NumberTypeAnnotation = $ReadOnly<{ +export type NumberTypeAnnotation = Readonly<{ type: 'NumberTypeAnnotation', }>; -export type BooleanTypeAnnotation = $ReadOnly<{ +export type BooleanTypeAnnotation = Readonly<{ type: 'BooleanTypeAnnotation', }>; -export type Int32TypeAnnotation = $ReadOnly<{ +export type Int32TypeAnnotation = Readonly<{ type: 'Int32TypeAnnotation', }>; -export type NumberLiteralTypeAnnotation = $ReadOnly<{ +export type NumberLiteralTypeAnnotation = Readonly<{ type: 'NumberLiteralTypeAnnotation', value: number, }>; -export type StringTypeAnnotation = $ReadOnly<{ +export type StringTypeAnnotation = Readonly<{ type: 'StringTypeAnnotation', }>; -export type StringLiteralTypeAnnotation = $ReadOnly<{ +export type StringLiteralTypeAnnotation = Readonly<{ type: 'StringLiteralTypeAnnotation', value: string, }>; -export type BooleanLiteralTypeAnnotation = $ReadOnly<{ +export type BooleanLiteralTypeAnnotation = Readonly<{ type: 'BooleanLiteralTypeAnnotation', value: boolean, }>; @@ -64,51 +64,51 @@ export type BooleanLiteralTypeAnnotation = $ReadOnly<{ export type StringLiteralUnionTypeAnnotation = UnionTypeAnnotation; -export type VoidTypeAnnotation = $ReadOnly<{ +export type VoidTypeAnnotation = Readonly<{ type: 'VoidTypeAnnotation', }>; -export type ObjectTypeAnnotation<+T> = $ReadOnly<{ +export type ObjectTypeAnnotation<+T> = Readonly<{ type: 'ObjectTypeAnnotation', properties: $ReadOnlyArray>, // metadata for objects that generated from interfaces baseTypes?: $ReadOnlyArray, }>; -export type UnionTypeAnnotation<+T> = $ReadOnly<{ +export type UnionTypeAnnotation<+T> = Readonly<{ type: 'UnionTypeAnnotation', types: $ReadOnlyArray, }>; -export type MixedTypeAnnotation = $ReadOnly<{ +export type MixedTypeAnnotation = Readonly<{ type: 'MixedTypeAnnotation', }>; -export type EventEmitterTypeAnnotation = $ReadOnly<{ +export type EventEmitterTypeAnnotation = Readonly<{ type: 'EventEmitterTypeAnnotation', typeAnnotation: NativeModuleEventEmitterTypeAnnotation | $FlowFixMe, }>; -type FunctionTypeAnnotation<+P, +R> = $ReadOnly<{ +type FunctionTypeAnnotation<+P, +R> = Readonly<{ type: 'FunctionTypeAnnotation', params: $ReadOnlyArray>, returnTypeAnnotation: R, }>; -export type NamedShape<+T> = $ReadOnly<{ +export type NamedShape<+T> = Readonly<{ name: string, optional: boolean, typeAnnotation: T, }>; -export type ComponentSchema = $ReadOnly<{ +export type ComponentSchema = Readonly<{ type: 'Component', - components: $ReadOnly<{ + components: Readonly<{ [componentName: string]: ComponentShape, }>, }>; -export type ComponentShape = $ReadOnly<{ +export type ComponentShape = Readonly<{ ...OptionsShape, extendsProps: $ReadOnlyArray, events: $ReadOnlyArray, @@ -116,7 +116,7 @@ export type ComponentShape = $ReadOnly<{ commands: $ReadOnlyArray>, }>; -export type OptionsShape = $ReadOnly<{ +export type OptionsShape = Readonly<{ // Use to generate only interfaces of components (C++ Props, C++ EventEmitters, JVM interfaces) and not their implementation. // This is useful for components that have a custom implementation of ShadowNode, ComponentDescriptor, State. interfaceOnly?: boolean, @@ -134,17 +134,17 @@ export type OptionsShape = $ReadOnly<{ generateOptionalObjectProperties?: boolean, }>; -export type ExtendsPropsShape = $ReadOnly<{ +export type ExtendsPropsShape = Readonly<{ type: 'ReactNativeBuiltInType', knownTypeName: 'ReactNativeCoreViewProps', }>; -export type EventTypeShape = $ReadOnly<{ +export type EventTypeShape = Readonly<{ name: string, bubblingType: 'direct' | 'bubble', optional: boolean, paperTopLevelNameDeprecated?: string, - typeAnnotation: $ReadOnly<{ + typeAnnotation: Readonly<{ type: 'EventTypeAnnotation', argument?: ObjectTypeAnnotation, }>, @@ -168,7 +168,7 @@ export type ComponentArrayTypeAnnotation = ArrayTypeAnnotation< | FloatTypeAnnotation | Int32TypeAnnotation | MixedTypeAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, @@ -191,38 +191,38 @@ export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation< | MixedTypeAnnotation, >; -export type ArrayTypeAnnotation<+T> = $ReadOnly<{ +export type ArrayTypeAnnotation<+T> = Readonly<{ type: 'ArrayTypeAnnotation', elementType: T, }>; export type PropTypeAnnotation = - | $ReadOnly<{ + | Readonly<{ type: 'BooleanTypeAnnotation', default: boolean | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringTypeAnnotation', default: string | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'DoubleTypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'FloatTypeAnnotation', default: number | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32TypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32EnumTypeAnnotation', default: number, options: $ReadOnlyArray, @@ -232,7 +232,7 @@ export type PropTypeAnnotation = | ComponentArrayTypeAnnotation | MixedTypeAnnotation; -export type ReservedPropTypeAnnotation = $ReadOnly<{ +export type ReservedPropTypeAnnotation = Readonly<{ type: 'ReservedPropTypeAnnotation', name: | 'ColorPrimitive' @@ -257,7 +257,7 @@ export type CommandParamTypeAnnotation = | StringTypeAnnotation | ComponentCommandArrayTypeAnnotation; -export type ReservedTypeAnnotation = $ReadOnly<{ +export type ReservedTypeAnnotation = Readonly<{ type: 'ReservedTypeAnnotation', name: 'RootTag', // Union with more custom types. }>; @@ -269,12 +269,12 @@ export type Nullable<+T: NativeModuleTypeAnnotation> = | NullableTypeAnnotation | T; -export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = $ReadOnly<{ +export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = Readonly<{ type: 'NullableTypeAnnotation', typeAnnotation: T, }>; -export type NativeModuleSchema = $ReadOnly<{ +export type NativeModuleSchema = Readonly<{ type: 'NativeModule', aliasMap: NativeModuleAliasMap, enumMap: NativeModuleEnumMap, @@ -286,7 +286,7 @@ export type NativeModuleSchema = $ReadOnly<{ excludedPlatforms?: $ReadOnlyArray, }>; -type NativeModuleSpec = $ReadOnly<{ +type NativeModuleSpec = Readonly<{ eventEmitters: $ReadOnlyArray, methods: $ReadOnlyArray, }>; @@ -298,11 +298,11 @@ export type NativeModulePropertyShape = NamedShape< Nullable, >; -export type NativeModuleEnumMap = $ReadOnly<{ +export type NativeModuleEnumMap = Readonly<{ [enumName: string]: NativeModuleEnumDeclarationWithMembers, }>; -export type NativeModuleAliasMap = $ReadOnly<{ +export type NativeModuleAliasMap = Readonly<{ [aliasName: string]: NativeModuleObjectTypeAnnotation, }>; @@ -330,7 +330,7 @@ export type UnsafeAnyTypeAnnotation = { type: 'AnyTypeAnnotation', }; -export type NativeModuleNumberTypeAnnotation = $ReadOnly<{ +export type NativeModuleNumberTypeAnnotation = Readonly<{ type: 'NumberTypeAnnotation', }>; @@ -343,7 +343,7 @@ export type NativeModuleEnumMemberType = | 'NumberTypeAnnotation' | 'StringTypeAnnotation'; -export type NativeModuleEnumDeclaration = $ReadOnly<{ +export type NativeModuleEnumDeclaration = Readonly<{ name: string, type: 'EnumDeclaration', memberType: NativeModuleEnumMemberType, @@ -356,7 +356,7 @@ export type NativeModuleEnumDeclarationWithMembers = { members: $ReadOnlyArray, }; -export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{ +export type NativeModuleGenericObjectTypeAnnotation = Readonly<{ type: 'GenericObjectTypeAnnotation', // a dictionary type is codegen as "Object" // but we know all its members are in the same type @@ -364,12 +364,12 @@ export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{ dictionaryValueType?: Nullable, }>; -export type NativeModuleTypeAliasTypeAnnotation = $ReadOnly<{ +export type NativeModuleTypeAliasTypeAnnotation = Readonly<{ type: 'TypeAliasTypeAnnotation', name: string, }>; -export type NativeModulePromiseTypeAnnotation = $ReadOnly<{ +export type NativeModulePromiseTypeAnnotation = Readonly<{ type: 'PromiseTypeAnnotation', elementType: VoidTypeAnnotation | Nullable, }>; @@ -386,7 +386,7 @@ export type NativeModuleUnionTypeAnnotationMemberType = export type NativeModuleUnionTypeAnnotation = UnionTypeAnnotation; -export type NativeModuleMixedTypeAnnotation = $ReadOnly<{ +export type NativeModuleMixedTypeAnnotation = Readonly<{ type: 'MixedTypeAnnotation', }>; diff --git a/packages/react-native-codegen/src/generators/RNCodegen.js b/packages/react-native-codegen/src/generators/RNCodegen.js index 33f86c7f80e..5e439abd8f4 100644 --- a/packages/react-native-codegen/src/generators/RNCodegen.js +++ b/packages/react-native-codegen/src/generators/RNCodegen.js @@ -82,11 +82,11 @@ export type GenerateFunction = ( includeGetDebugPropsImplementation?: boolean, ) => FilesOutput; -export type LibraryGeneratorsFunctions = $ReadOnly<{ +export type LibraryGeneratorsFunctions = Readonly<{ [string]: Array, }>; -export type LibraryOptions = $ReadOnly<{ +export type LibraryOptions = Readonly<{ libraryName: string, schema: SchemaType, outputDirectory: string, @@ -97,7 +97,7 @@ export type LibraryOptions = $ReadOnly<{ libraryGenerators?: LibraryGeneratorsFunctions, }>; -export type SchemasOptions = $ReadOnly<{ +export type SchemasOptions = Readonly<{ schemas: {[string]: SchemaType}, outputDirectory: string, supportedApplePlatforms?: {[string]: {[string]: boolean}}, @@ -118,12 +118,12 @@ export type LibraryGenerators = export type SchemasGenerators = 'providerIOS'; -export type LibraryConfig = $ReadOnly<{ +export type LibraryConfig = Readonly<{ generators: Array, test?: boolean, }>; -export type SchemasConfig = $ReadOnly<{ +export type SchemasConfig = Readonly<{ generators: Array, test?: boolean, }>; diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js index 7ebe0e337a7..75f1d8cc9ed 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js @@ -25,7 +25,7 @@ const {IncludeTemplate, generateEventStructName} = require('./CppHelpers'); // File path -> contents type FilesOutput = Map; -type ComponentCollection = $ReadOnly<{ +type ComponentCollection = Readonly<{ [component: string]: ComponentShape, ... }>; diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index b947b727f5a..3f1ec849071 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -31,7 +31,7 @@ const nullthrows = require('nullthrows'); type FilesOutput = Map; type StructsMap = Map; -type ComponentCollection = $ReadOnly<{ +type ComponentCollection = Readonly<{ [component: string]: ComponentShape, ... }>; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js index c9669a0c311..39bca081570 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js @@ -40,39 +40,39 @@ export type PojoTypeAliasAnnotation = { }; export type PojoTypeAnnotation = - | $ReadOnly<{ + | Readonly<{ type: 'BooleanTypeAnnotation', default: boolean | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringTypeAnnotation', default: string | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'DoubleTypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'FloatTypeAnnotation', default: number | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32TypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32EnumTypeAnnotation', default: number, options: $ReadOnlyArray, }> | ReservedPropTypeAnnotation | PojoTypeAliasAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'ArrayTypeAnnotation', elementType: | BooleanTypeAnnotation @@ -81,14 +81,14 @@ export type PojoTypeAnnotation = | FloatTypeAnnotation | Int32TypeAnnotation | MixedTypeAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, }> | PojoTypeAliasAnnotation | ReservedPropTypeAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'ArrayTypeAnnotation', elementType: PojoTypeAliasAnnotation, }>, diff --git a/packages/react-native-codegen/src/generators/components/GenerateTests.js b/packages/react-native-codegen/src/generators/components/GenerateTests.js index 2a00f4b1304..668f05c43cc 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateTests.js +++ b/packages/react-native-codegen/src/generators/components/GenerateTests.js @@ -18,7 +18,7 @@ const {getImports} = require('./CppHelpers'); type FilesOutput = Map; type PropValueType = string | number | boolean; -type TestCase = $ReadOnly<{ +type TestCase = Readonly<{ propName: string, propValue: ?PropValueType, testName?: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js index 9c85b82a59c..b92240bd9c7 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js @@ -163,14 +163,14 @@ const ModuleSpecClassDeclarationTemplate = ({ moduleEventEmitters, moduleFunctions, methods, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, moduleName: string, structs: string, enums: string, moduleEventEmitters: EventEmitterCpp[], moduleFunctions: string[], - methods: $ReadOnlyArray<$ReadOnly<{methodName: string, paramCount: number}>>, + methods: $ReadOnlyArray>, }>) => { return `${enums}${structs} template @@ -196,7 +196,7 @@ ${moduleFunctions.join('\n\n')} const FileTemplate = ({ modules, -}: $ReadOnly<{ +}: Readonly<{ modules: string[], }>) => { return `/** diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index 1093787a153..55e14262fa0 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -30,7 +30,7 @@ const {createAliasResolver, getModules} = require('./Utils'); type FilesOutput = Map; function FileTemplate( - config: $ReadOnly<{ + config: Readonly<{ packageName: string, className: string, jsName: string, @@ -92,7 +92,7 @@ function EventEmitterTemplate( } function MethodTemplate( - config: $ReadOnly<{ + config: Readonly<{ abstract: boolean, methodBody: ?string, methodJavaAnnotation: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js index 691c5a30c2e..65315adae2f 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js @@ -42,7 +42,7 @@ const HostFunctionTemplate = ({ propertyName, jniSignature, jsReturnType, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, propertyName: string, jniSignature: string, @@ -58,7 +58,7 @@ const ModuleClassConstructorTemplate = ({ hasteModuleName, eventEmitters, methods, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, eventEmitters: $ReadOnlyArray, methods: $ReadOnlyArray<{ @@ -94,7 +94,7 @@ ${methods const ModuleLookupTemplate = ({ moduleName, hasteModuleName, -}: $ReadOnly<{moduleName: string, hasteModuleName: string}>) => { +}: Readonly<{moduleName: string, hasteModuleName: string}>) => { return ` if (moduleName == "${moduleName}") { return std::make_shared<${hasteModuleName}SpecJSI>(params); }`; @@ -105,7 +105,7 @@ const FileTemplate = ({ include, modules, moduleLookups, -}: $ReadOnly<{ +}: Readonly<{ libraryName: string, include: string, modules: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js index 0d0ee29bcff..92a4c0dac76 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js @@ -18,7 +18,7 @@ type FilesOutput = Map; const ModuleClassDeclarationTemplate = ({ hasteModuleName, -}: $ReadOnly<{hasteModuleName: string}>) => { +}: Readonly<{hasteModuleName: string}>) => { return `/** * JNI C++ class for module '${hasteModuleName}' */ @@ -32,7 +32,7 @@ public: const HeaderFileTemplate = ({ modules, libraryName, -}: $ReadOnly<{modules: string, libraryName: string}>) => { +}: Readonly<{modules: string, libraryName: string}>) => { return ` /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -64,7 +64,7 @@ std::shared_ptr ${libraryName}_ModuleProvider(const std::string &mo const CMakeListsTemplate = ({ libraryName, targetName, -}: $ReadOnly<{libraryName: string, targetName: string}>) => { +}: Readonly<{libraryName: string, targetName: string}>) => { return `# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js index 646a283e55a..036d4203d16 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js @@ -44,13 +44,13 @@ const { type StructContext = 'CONSTANTS' | 'REGULAR'; -export type RegularStruct = $ReadOnly<{ +export type RegularStruct = Readonly<{ context: 'REGULAR', name: string, properties: $ReadOnlyArray, }>; -export type ConstantsStruct = $ReadOnly<{ +export type ConstantsStruct = Readonly<{ context: 'CONSTANTS', name: string, properties: $ReadOnlyArray, @@ -58,7 +58,7 @@ export type ConstantsStruct = $ReadOnly<{ export type Struct = RegularStruct | ConstantsStruct; -export type StructProperty = $ReadOnly<{ +export type StructProperty = Readonly<{ name: string, optional: boolean, typeAnnotation: Nullable, @@ -200,7 +200,7 @@ class StructCollector { ): void { // $FlowFixMe[missing-type-arg] const properties = objectTypeAnnotation.properties.map< - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: Nullable, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js index d281e5c7501..dcf0cf50f01 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js @@ -26,7 +26,7 @@ const StructTemplate = ({ hasteModuleName, structName, builderInputProps, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, builderInputProps: string, @@ -65,7 +65,7 @@ const MethodTemplate = ({ hasteModuleName, structName, properties, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, properties: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js index 69565672d46..37b7ae4a515 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js @@ -26,7 +26,7 @@ const StructTemplate = ({ hasteModuleName, structName, structProperties, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, structProperties: string, @@ -53,7 +53,7 @@ const MethodTemplate = ({ structName, propertyName, safePropertyName, -}: $ReadOnly<{ +}: Readonly<{ returnType: string, returnValue: string, hasteModuleName: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js index d5b38f45357..3656fcef740 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js @@ -15,7 +15,7 @@ import type {Struct} from '../StructCollector'; const {serializeConstantsStruct} = require('./serializeConstantsStruct'); const {serializeRegularStruct} = require('./serializeRegularStruct'); -export type StructSerilizationOutput = $ReadOnly<{ +export type StructSerilizationOutput = Readonly<{ methods: string, declaration: string, }>; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js index defe5722f29..8d93d9ad29c 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js @@ -27,7 +27,7 @@ const ModuleDeclarationTemplate = ({ structDeclarations, eventEmitters, protocolMethods, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structDeclarations: string, eventEmitters: string, @@ -63,7 +63,7 @@ const HeaderFileTemplate = ({ moduleDeclarations, structInlineMethods, assumeNonnull, -}: $ReadOnly<{ +}: Readonly<{ headerFileName: string, moduleDeclarations: string, structInlineMethods: string, @@ -118,7 +118,7 @@ const HeaderFileTemplate = ({ const SourceFileTemplate = ({ headerFileName, moduleImplementations, -}: $ReadOnly<{ +}: Readonly<{ headerFileName: string, moduleImplementations: string, }>) => `/** diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js index c48a8b20e95..6abb2686960 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js @@ -33,13 +33,13 @@ const ProtocolMethodTemplate = ({ returnObjCType, methodName, params, -}: $ReadOnly<{ +}: Readonly<{ returnObjCType: string, methodName: string, params: string, }>) => `- (${returnObjCType})${methodName}${params};`; -export type StructParameterRecord = $ReadOnly<{ +export type StructParameterRecord = Readonly<{ paramIndex: number, structName: string, }>; @@ -53,7 +53,7 @@ type ReturnJSType = | 'NumberKind' | 'StringKind'; -export type MethodSerializationOutput = $ReadOnly<{ +export type MethodSerializationOutput = Readonly<{ methodName: string, protocolMethod: string, selector: string, @@ -186,7 +186,7 @@ function getParamObjCType( structName: string, structCollector: StructCollector, resolveAlias: AliasResolver, -): $ReadOnly<{objCType: string, isStruct: boolean}> { +): Readonly<{objCType: string, isStruct: boolean}> { const {name: paramName, typeAnnotation: nullableTypeAnnotation} = param; const [typeAnnotation, nullable] = unwrapNullable(nullableTypeAnnotation); const isRequired = !param.optional && !nullable; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js index d4b80dcb054..bc24adee3ac 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js @@ -27,7 +27,7 @@ const ModuleTemplate = ({ moduleName, eventEmitters, methodSerializationOutputs, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structs: $ReadOnlyArray, moduleName: string, @@ -96,7 +96,7 @@ namespace facebook::react { const RCTCxxConvertCategoryTemplate = ({ hasteModuleName, structName, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, }>) => `@implementation RCTCxxConvert (${hasteModuleName}_${structName}) @@ -111,7 +111,7 @@ const InlineHostFunctionTemplate = ({ methodName, returnJSType, selector, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, methodName: string, returnJSType: string, @@ -126,7 +126,7 @@ const MethodMapEntryTemplate = ({ methodName, structParamRecords, argCount, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, methodName: string, structParamRecords: $ReadOnlyArray, diff --git a/packages/react-native-codegen/src/generators/modules/Utils.js b/packages/react-native-codegen/src/generators/modules/Utils.js index efb39462a27..ce6b6339841 100644 --- a/packages/react-native-codegen/src/generators/modules/Utils.js +++ b/packages/react-native-codegen/src/generators/modules/Utils.js @@ -36,7 +36,7 @@ function createAliasResolver(aliasMap: NativeModuleAliasMap): AliasResolver { function getModules( schema: SchemaType, -): $ReadOnly<{[hasteModuleName: string]: NativeModuleSchema}> { +): Readonly<{[hasteModuleName: string]: NativeModuleSchema}> { return Object.keys(schema.modules).reduce<{[string]: NativeModuleSchema}>( (modules, hasteModuleName: string) => { const module = schema.modules[hasteModuleName]; diff --git a/packages/react-native-codegen/src/parsers/flow/components/commands.js b/packages/react-native-codegen/src/parsers/flow/components/commands.js index df8f54d901d..72468977218 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -28,7 +28,7 @@ function buildCommandSchema( property: EventTypeAST, types: TypeDeclarationMap, parser: Parser, -): $ReadOnly<{ +): Readonly<{ name: string, optional: boolean, typeAnnotation: { diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js index edfb10de5b0..952d65b300c 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js @@ -419,7 +419,7 @@ describe('Flow Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, @@ -954,7 +954,7 @@ describe('Flow Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, diff --git a/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js b/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js index 7a1207841de..7e0f61bd3e0 100644 --- a/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js +++ b/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js @@ -16,7 +16,7 @@ const hermesParser = require('hermes-parser'); function parseFlowAndThrowErrors( code: string, - options: $ReadOnly<{filename?: ?string}> = {}, + options: Readonly<{filename?: ?string}> = {}, ): ESTreeProgram { let ast; try { diff --git a/packages/react-native-codegen/src/parsers/parsers-commons.js b/packages/react-native-codegen/src/parsers/parsers-commons.js index b72c9a2c158..1d4f2cf4257 100644 --- a/packages/react-native-codegen/src/parsers/parsers-commons.js +++ b/packages/react-native-codegen/src/parsers/parsers-commons.js @@ -77,7 +77,7 @@ const { } = require('./utils'); const invariant = require('invariant'); -export type CommandOptions = $ReadOnly<{ +export type CommandOptions = Readonly<{ supportedCommands: $ReadOnlyArray, }>; diff --git a/packages/react-native-codegen/src/parsers/schema.js b/packages/react-native-codegen/src/parsers/schema.js index 08ab1ceb6c9..fab007d762a 100644 --- a/packages/react-native-codegen/src/parsers/schema.js +++ b/packages/react-native-codegen/src/parsers/schema.js @@ -20,7 +20,7 @@ import type { SchemaType, } from '../CodegenSchema.js'; -export type ComponentSchemaBuilderConfig = $ReadOnly<{ +export type ComponentSchemaBuilderConfig = Readonly<{ filename: string, componentName: string, extendsProps: $ReadOnlyArray, diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js index 6f0eeeb6b55..f454e4a8bdd 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js @@ -495,7 +495,7 @@ describe('TypeScript Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, @@ -1029,7 +1029,7 @@ describe('TypeScript Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, diff --git a/packages/react-native-codegen/src/parsers/utils.js b/packages/react-native-codegen/src/parsers/utils.js index c96b7eee825..851450b0b18 100644 --- a/packages/react-native-codegen/src/parsers/utils.js +++ b/packages/react-native-codegen/src/parsers/utils.js @@ -16,12 +16,12 @@ const path = require('path'); export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe}; export type TypeResolutionStatus = - | $ReadOnly<{ + | Readonly<{ type: 'alias' | 'enum', successful: true, name: string, }> - | $ReadOnly<{ + | Readonly<{ successful: false, }>; @@ -66,7 +66,7 @@ function createParserErrorCapturer(): [ function verifyPlatforms( hasteModuleName: string, moduleName: string, -): $ReadOnly<{ +): Readonly<{ cxxOnly: boolean, excludedPlatforms: Array<'iOS' | 'android'>, }> { diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow index ad22b238464..f683d900a60 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow @@ -27,7 +27,7 @@ import type { import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, bool: boolean, string: string, @@ -49,12 +49,12 @@ type NativeProps = $ReadOnly<{ stringUnion?: WithDefault<'foo' | 'bar', 'bar'>, intUnion?: WithDefault<1 | 2, 1>, - nestedObject: $ReadOnly<{ + nestedObject: Readonly<{ string: string, color: ColorValue, }>, - nestedObjectChanged: $ReadOnly<{ + nestedObjectChanged: Readonly<{ string: boolean, color: ColorValue, }>, @@ -66,14 +66,14 @@ type NativeProps = $ReadOnly<{ >, arrayNestedObject: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ string: string, color: ColorValue, }>, >, arrayNestedObjectChange: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ string: boolean, color: ColorValue, }>, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow index 1c55d96e879..6aab7e7baa5 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow @@ -19,7 +19,7 @@ import type { import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow index eac4e790272..cc0c2cd9857 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow @@ -19,7 +19,7 @@ import type { import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow index a0c2bf47be8..f3eac473837 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow index 4a52639b60d..7006bb98332 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow @@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow index 8159b7a528f..a96a01407cb 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow @@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow index 38e623fb18d..a50fa6d6d8c 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow @@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow index f959d0f8642..25c2367b726 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow index 96804c612ac..e12e8910ac5 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow index 75b5c137270..9176e3dac70 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow @@ -19,7 +19,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, bool: boolean, string: string, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow index 39500471106..3db5c80ccf8 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, sizes?: WithDefault<$ReadOnlyArray<'small' | 'large' | 'huge'>, 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow index be895fab47d..571f3ea77a7 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow index 6d0eca01b9b..640e75ec0f0 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: Int32, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow index becf8076edc..603796543b7 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow index 6420c82668c..f984ef5f3e1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow @@ -18,12 +18,12 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, height?: WithDefault, - pins: $ReadOnly<{ + pins: Readonly<{ x: Float, y: Float, color?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow index 31cd0865d83..9f4eb4de26e 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow @@ -18,12 +18,12 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, height?: WithDefault, - pins: $ReadOnly<{ + pins: Readonly<{ x: Float, y: Float, color: string, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow index 085a98f9e27..e6a54c4f22a 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow @@ -18,12 +18,12 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, height?: WithDefault, - pins: $ReadOnly<{ + pins: Readonly<{ x: Float, y: Float, }>, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow index 17748d1f58d..7d251a90236 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, size?: WithDefault<'small' | 'huge' | 'large', 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow index 6127034224d..bb82078775e 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, size?: WithDefault<'small' | 'large', 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow index 3c95a27944e..4615e09adc1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow index cccaf9a22f2..1695477144d 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow @@ -13,7 +13,7 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow index 32b27c558c5..29342b33c5f 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo export interface Spec extends TurboModule { +exampleFunction: (a: string, b: number) => void; - +getConstants: () => $ReadOnly<{ + +getConstants: () => Readonly<{ constant?: string, }>; } diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow index a1ae7696fe1..603030e24bb 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo export interface Spec extends TurboModule { +exampleFunction: (a: string, b: number) => void; - +getConstants: () => $ReadOnly<{ + +getConstants: () => Readonly<{ constant: string, }>; } diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow index 878d2267f2d..fb537117b54 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo export interface Spec extends TurboModule { +exampleFunction: (a: string, b: number) => void; - +getConstants: () => $ReadOnly<{}>; + +getConstants: () => Readonly<{}>; } export default (TurboModuleRegistry.getEnforcing( diff --git a/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js b/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js index 312c726d907..464b632c78e 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js @@ -20,12 +20,12 @@ import * as React from 'react'; import {useCallback, useImperativeHandle, useRef} from 'react'; type PopupMenuSelectionEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ item: number, }>, >; -type PopupMenuDismissEvent = NativeSyntheticEvent<$ReadOnly<{}>>; +type PopupMenuDismissEvent = NativeSyntheticEvent>; export type PopupMenuAndroidInstance = { +show: () => void, diff --git a/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js b/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js index 2961eb8f361..67b642eda15 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js @@ -19,13 +19,13 @@ import * as React from 'react'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type PopupMenuSelectionEvent = $ReadOnly<{ +type PopupMenuSelectionEvent = Readonly<{ item: Int32, }>; -type PopupMenuDismissEvent = $ReadOnly<{}>; +type PopupMenuDismissEvent = Readonly<{}>; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, //Props diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js index 1f9f75a3bb4..3d6feb97cb7 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js @@ -21,12 +21,12 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; import * as React from 'react'; -type NativeSwitchChangeEvent = $ReadOnly<{ +type NativeSwitchChangeEvent = Readonly<{ value: boolean, target: Int32, }>; -type SwitchNativeProps = $ReadOnly<{ +type SwitchNativeProps = Readonly<{ ...ViewProps, // Props diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js index 00415eb5f31..f7c79c3a4ee 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js @@ -14,7 +14,7 @@ import type {HostComponent} from '../../types/HostComponent'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type UnimplementedNativeViewNativeProps = $ReadOnly<{ +type UnimplementedNativeViewNativeProps = Readonly<{ ...ViewProps, name?: WithDefault, }>; diff --git a/packages/react-native/src/private/testing/fantom/specs/NativeFantom.js b/packages/react-native/src/private/testing/fantom/specs/NativeFantom.js index 0df1c6467fc..a47d97b9aac 100644 --- a/packages/react-native/src/private/testing/fantom/specs/NativeFantom.js +++ b/packages/react-native/src/private/testing/fantom/specs/NativeFantom.js @@ -101,10 +101,10 @@ interface Spec extends TurboModule { takeMountingManagerLogs: (surfaceId: RootTag) => Array; getDirectManipulationProps: ( shadowNode: unknown /* ShadowNode */, - ) => $ReadOnly<{ + ) => Readonly<{ [string]: unknown, }>; - getFabricUpdateProps: (shadowNode: unknown /* ShadowNode */) => $ReadOnly<{ + getFabricUpdateProps: (shadowNode: unknown /* ShadowNode */) => Readonly<{ [string]: unknown, }>; flushMessageQueue: () => void; diff --git a/packages/react-native/src/private/webapis/dom/events/EventHandlerAttributes.js b/packages/react-native/src/private/webapis/dom/events/EventHandlerAttributes.js index 6b56bfaf05e..c046d996dd2 100644 --- a/packages/react-native/src/private/webapis/dom/events/EventHandlerAttributes.js +++ b/packages/react-native/src/private/webapis/dom/events/EventHandlerAttributes.js @@ -43,7 +43,7 @@ import type EventTarget from './EventTarget'; import type {EventCallback} from './EventTarget'; -type EventHandler = $ReadOnly<{ +type EventHandler = Readonly<{ handleEvent: EventCallback, }>; type EventHandlerAttributeMap = Map; diff --git a/packages/react-native/src/private/webapis/dom/events/EventTarget.js b/packages/react-native/src/private/webapis/dom/events/EventTarget.js index 5d0e2887972..08ff4fa07c5 100644 --- a/packages/react-native/src/private/webapis/dom/events/EventTarget.js +++ b/packages/react-native/src/private/webapis/dom/events/EventTarget.js @@ -40,11 +40,11 @@ export type EventHandler = interface { }; export type EventListener = EventCallback | EventHandler; -export type EventListenerOptions = $ReadOnly<{ +export type EventListenerOptions = Readonly<{ capture?: boolean, }>; -export type AddEventListenerOptions = $ReadOnly<{ +export type AddEventListenerOptions = Readonly<{ ...EventListenerOptions, passive?: boolean, once?: boolean, diff --git a/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js b/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js index 5709b1a7c89..22c88974885 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js +++ b/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js @@ -247,7 +247,7 @@ export interface RefinedSpec { */ +getBorderWidth: ( nativeElementReference: NativeElementReference, - ) => $ReadOnly< + ) => Readonly< [ /* topWidth: */ number, /* rightWidth: */ number, @@ -270,7 +270,7 @@ export interface RefinedSpec { +getBoundingClientRect: ( nativeElementReference: NativeElementReference, includeTransform: boolean, - ) => $ReadOnly< + ) => Readonly< [ /* x: */ number, /* y: */ number, @@ -293,7 +293,7 @@ export interface RefinedSpec { */ +getInnerSize: ( nativeElementReference: NativeElementReference, - ) => $ReadOnly<[/* width: */ number, /* height: */ number]>; + ) => Readonly<[/* width: */ number, /* height: */ number]>; /** * This is a method to access scroll information for a shadow node, to @@ -308,7 +308,7 @@ export interface RefinedSpec { */ +getScrollPosition: ( nativeElementReference: NativeElementReference, - ) => $ReadOnly<[/* scrollLeft: */ number, /* scrollTop: */ number]>; + ) => Readonly<[/* scrollLeft: */ number, /* scrollTop: */ number]>; /** * @@ -324,7 +324,7 @@ export interface RefinedSpec { */ +getScrollSize: ( nativeElementReference: NativeElementReference, - ) => $ReadOnly<[/* scrollWidth: */ number, /* scrollHeight: */ number]>; + ) => Readonly<[/* scrollWidth: */ number, /* scrollHeight: */ number]>; /** * This is a method to access the normalized tag name of a shadow node, to @@ -377,7 +377,7 @@ export interface RefinedSpec { */ +getOffset: ( nativeElementReference: NativeElementReference, - ) => $ReadOnly< + ) => Readonly< [ /* offsetParent: */ ?InstanceHandle, /* top: */ number, diff --git a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js index 68323fd7793..9799c589aff 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js @@ -2978,7 +2978,7 @@ describe('IntersectionObserver', () => { }; }; - function Observe({children}: $ReadOnly<{children?: React.Node}>) { + function Observe({children}: Readonly<{children?: React.Node}>) { return {children}; } diff --git a/packages/react-native/src/private/webapis/mutationobserver/internals/MutationObserverManager.js b/packages/react-native/src/private/webapis/mutationobserver/internals/MutationObserverManager.js index a929b5d07c6..21c7698db84 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +++ b/packages/react-native/src/private/webapis/mutationobserver/internals/MutationObserverManager.js @@ -38,7 +38,7 @@ let isConnected: boolean = false; const registeredMutationObservers: Map< MutationObserverId, - $ReadOnly<{observer: MutationObserver, callback: MutationObserverCallback}>, + Readonly<{observer: MutationObserver, callback: MutationObserverCallback}>, > = new Map(); /** diff --git a/packages/react-native/src/private/webapis/performance/Performance.js b/packages/react-native/src/private/webapis/performance/Performance.js index fa03971ac0b..af1d3efb981 100644 --- a/packages/react-native/src/private/webapis/performance/Performance.js +++ b/packages/react-native/src/private/webapis/performance/Performance.js @@ -37,17 +37,17 @@ import {PerformanceMark, PerformanceMeasure} from './UserTiming'; import nullthrows from 'nullthrows'; export type PerformanceMeasureOptions = - | $ReadOnly<{ + | Readonly<{ detail?: DetailType, start?: DOMHighResTimeStamp | string, duration?: DOMHighResTimeStamp, }> - | $ReadOnly<{ + | Readonly<{ detail?: DetailType, start?: DOMHighResTimeStamp | string, end?: DOMHighResTimeStamp | string, }> - | $ReadOnly<{ + | Readonly<{ detail?: DetailType, duration?: DOMHighResTimeStamp | string, end?: DOMHighResTimeStamp | string, diff --git a/packages/rn-tester/IntegrationTests/IntegrationTestHarnessTest.js b/packages/rn-tester/IntegrationTests/IntegrationTestHarnessTest.js index 831b640ddfa..fdf95ceced4 100644 --- a/packages/rn-tester/IntegrationTests/IntegrationTestHarnessTest.js +++ b/packages/rn-tester/IntegrationTests/IntegrationTestHarnessTest.js @@ -16,7 +16,7 @@ import {NativeModules, StyleSheet, Text, View} from 'react-native'; const {TestModule} = NativeModules; -type Props = $ReadOnly<{ +type Props = Readonly<{ shouldThrow?: boolean, waitOneFrame?: boolean, }>; diff --git a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js index 57eb5855c8c..dcb2f53ee6b 100644 --- a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js +++ b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js @@ -24,7 +24,7 @@ function debug(...args: Array) { // console.log.apply(null, arguments); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; type State = { didAnimation: boolean, diff --git a/packages/rn-tester/IntegrationTests/TimersTest.js b/packages/rn-tester/IntegrationTests/TimersTest.js index c7c055cb601..1e8b608821e 100644 --- a/packages/rn-tester/IntegrationTests/TimersTest.js +++ b/packages/rn-tester/IntegrationTests/TimersTest.js @@ -16,7 +16,7 @@ const ReactNative = require('react-native'); const {StyleSheet, Text, View} = ReactNative; const {TestModule} = ReactNative.NativeModules; -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; type State = { count: number, diff --git a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js index d7b7e832fae..f75ccb355b0 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js @@ -25,7 +25,7 @@ type ColorChangedEvent = { }, }; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, opacity?: number, color?: string, diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js index ea136a67b8d..8487b4e2bc0 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js @@ -13,7 +13,7 @@ import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; import * as React from 'react'; import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; -type Event = $ReadOnly<{ +type Event = Readonly<{ values: $ReadOnlyArray, boolValues: $ReadOnlyArray, floats: $ReadOnlyArray, @@ -24,11 +24,11 @@ type Event = $ReadOnly<{ multiArrays: $ReadOnlyArray<$ReadOnlyArray>, }>; -type LegacyStyleEvent = $ReadOnly<{ +type LegacyStyleEvent = Readonly<{ string: string, }>; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, opacity?: CodegenTypes.Float, values: $ReadOnlyArray, diff --git a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js b/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js index 3a445616698..b43ac61f079 100644 --- a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js +++ b/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js @@ -19,10 +19,10 @@ import type { const {requireNativeComponent} = require('react-native'); type SnapshotReadyEvent = NativeSyntheticEvent< - $ReadOnly<{testIdentifier: string, ...}>, + Readonly<{testIdentifier: string, ...}>, >; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, onSnapshotReady?: ?(event: SnapshotReadyEvent) => unknown, testIdentifier?: ?string, diff --git a/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js b/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js index fe778e11158..05069d6089c 100644 --- a/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js +++ b/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js @@ -13,7 +13,7 @@ import type {ViewProps} from 'react-native'; import {codegenNativeComponent} from 'react-native'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/rn-tester/js/components/RNTConfigurationBlock.js b/packages/rn-tester/js/components/RNTConfigurationBlock.js index d78f87abd47..53523a296d5 100644 --- a/packages/rn-tester/js/components/RNTConfigurationBlock.js +++ b/packages/rn-tester/js/components/RNTConfigurationBlock.js @@ -15,7 +15,7 @@ import * as React from 'react'; import {useContext} from 'react'; import {StyleSheet, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ children?: ?React.Node, testID?: string, }>; diff --git a/packages/rn-tester/js/components/RNTOption.js b/packages/rn-tester/js/components/RNTOption.js index 12de74bf477..b65efb9d754 100644 --- a/packages/rn-tester/js/components/RNTOption.js +++ b/packages/rn-tester/js/components/RNTOption.js @@ -18,7 +18,7 @@ import * as React from 'react'; import {useContext, useState} from 'react'; import {Pressable, StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ testID?: ?string, label: string, onPress?: ?(event: GestureResponderEvent) => unknown, diff --git a/packages/rn-tester/js/components/RNTesterBlock.js b/packages/rn-tester/js/components/RNTesterBlock.js index c7472b46041..bf120249d29 100644 --- a/packages/rn-tester/js/components/RNTesterBlock.js +++ b/packages/rn-tester/js/components/RNTesterBlock.js @@ -13,7 +13,7 @@ import * as React from 'react'; import {useContext} from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ children?: React.Node, title?: ?string, description?: ?string, diff --git a/packages/rn-tester/js/components/RNTesterButton.js b/packages/rn-tester/js/components/RNTesterButton.js index a3facd92b5c..92eaebe40d4 100644 --- a/packages/rn-tester/js/components/RNTesterButton.js +++ b/packages/rn-tester/js/components/RNTesterButton.js @@ -15,7 +15,7 @@ import type {GestureResponderEvent} from 'react-native'; import React from 'react'; import {Pressable, StyleSheet, Text} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ testID?: string, textTestID?: string, children?: React.Node, diff --git a/packages/rn-tester/js/components/RNTesterComponentTitle.js b/packages/rn-tester/js/components/RNTesterComponentTitle.js index b13e2badfb5..ca540154aa4 100644 --- a/packages/rn-tester/js/components/RNTesterComponentTitle.js +++ b/packages/rn-tester/js/components/RNTesterComponentTitle.js @@ -13,7 +13,7 @@ import {RNTesterThemeContext} from './RNTesterTheme'; const React = require('react'); const {StyleSheet, Text} = require('react-native'); -type Props = $ReadOnly<{ +type Props = Readonly<{ children: string, }>; diff --git a/packages/rn-tester/js/components/RNTesterDocumentationURL.js b/packages/rn-tester/js/components/RNTesterDocumentationURL.js index bbaf1eb2500..e68f070173c 100644 --- a/packages/rn-tester/js/components/RNTesterDocumentationURL.js +++ b/packages/rn-tester/js/components/RNTesterDocumentationURL.js @@ -12,7 +12,7 @@ import * as React from 'react'; import {Image, StyleSheet, TouchableOpacity} from 'react-native'; import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser'; -type Props = $ReadOnly<{ +type Props = Readonly<{ documentationURL: string, }>; diff --git a/packages/rn-tester/js/components/RNTesterNavbar.js b/packages/rn-tester/js/components/RNTesterNavbar.js index 5e65e1bd8c3..67d95b265b8 100644 --- a/packages/rn-tester/js/components/RNTesterNavbar.js +++ b/packages/rn-tester/js/components/RNTesterNavbar.js @@ -57,7 +57,7 @@ const ComponentTab = ({ isComponentActive, handleNavBarPress, theme, -}: $ReadOnly<{ +}: Readonly<{ handleNavBarPress: NavBarOnPressHandler, isComponentActive: boolean, theme: RNTesterTheme, @@ -78,7 +78,7 @@ const PlaygroundTab = ({ isComponentActive, handleNavBarPress, theme, -}: $ReadOnly<{ +}: Readonly<{ handleNavBarPress: NavBarOnPressHandler, isComponentActive: boolean, theme: RNTesterTheme, @@ -99,7 +99,7 @@ const APITab = ({ isAPIActive, handleNavBarPress, theme, -}: $ReadOnly<{ +}: Readonly<{ handleNavBarPress: NavBarOnPressHandler, isAPIActive: boolean, theme: RNTesterTheme, @@ -116,7 +116,7 @@ const APITab = ({ /> ); -type Props = $ReadOnly<{ +type Props = Readonly<{ handleNavBarPress: NavBarOnPressHandler, screen: string, isExamplePageOpen: boolean, diff --git a/packages/rn-tester/js/components/RNTesterPage.js b/packages/rn-tester/js/components/RNTesterPage.js index 27055491bb1..9c0e4558df2 100644 --- a/packages/rn-tester/js/components/RNTesterPage.js +++ b/packages/rn-tester/js/components/RNTesterPage.js @@ -15,7 +15,7 @@ import {useContext} from 'react'; const React = require('react'); const {Platform, ScrollView, StyleSheet, View} = require('react-native'); -type Props = $ReadOnly<{ +type Props = Readonly<{ children?: React.Node, title?: ?string, noScroll?: ?boolean, diff --git a/packages/rn-tester/js/components/RNTesterText.js b/packages/rn-tester/js/components/RNTesterText.js index 51bd4f4ea05..caa732f9ec5 100644 --- a/packages/rn-tester/js/components/RNTesterText.js +++ b/packages/rn-tester/js/components/RNTesterText.js @@ -14,7 +14,7 @@ import {RNTesterThemeContext} from './RNTesterTheme'; import React, {useContext, useMemo} from 'react'; import {Text} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ ...TextProps, variant?: 'body' | 'label' | 'caption', }>; diff --git a/packages/rn-tester/js/components/RNTesterTheme.js b/packages/rn-tester/js/components/RNTesterTheme.js index 8eb0d96b5f2..e717e33cb5b 100644 --- a/packages/rn-tester/js/components/RNTesterTheme.js +++ b/packages/rn-tester/js/components/RNTesterTheme.js @@ -15,7 +15,7 @@ import {createContext} from 'react'; import {use} from 'react'; import {Appearance} from 'react-native'; -export type RNTesterTheme = $ReadOnly<{ +export type RNTesterTheme = Readonly<{ LabelColor: ColorValue, SecondaryLabelColor: ColorValue, TertiaryLabelColor: ColorValue, diff --git a/packages/rn-tester/js/components/RNTesterTitle.js b/packages/rn-tester/js/components/RNTesterTitle.js index 88cdcb26788..f8c110e6df7 100644 --- a/packages/rn-tester/js/components/RNTesterTitle.js +++ b/packages/rn-tester/js/components/RNTesterTitle.js @@ -12,7 +12,7 @@ import {RNTesterThemeContext} from './RNTesterTheme'; import React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ title: string, }>; diff --git a/packages/rn-tester/js/components/UseCase.js b/packages/rn-tester/js/components/UseCase.js index 2285b325400..828647dca01 100644 --- a/packages/rn-tester/js/components/UseCase.js +++ b/packages/rn-tester/js/components/UseCase.js @@ -11,7 +11,7 @@ import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ children?: React.Node, title?: ?string, note?: ?string, diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js index 0c96afb4afb..d85dbf2ecb1 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js @@ -16,7 +16,7 @@ const {RNTesterThemeContext} = require('../../components/RNTesterTheme'); const React = require('react'); const {Alert, Text, View} = require('react-native'); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; class AccessibilityIOSExample extends React.Component { render(): React.Node { return ( diff --git a/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js b/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js index cef545069fd..b1d7a7eaae7 100644 --- a/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js +++ b/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js @@ -32,7 +32,7 @@ const DESTRUCTIVE_INDEX = 3; const CANCEL_INDEX = 4; const DISABLED_BUTTON_INDICES = [1, 2]; -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; type State = {clicked: string}; class ActionSheetExample extends React.Component { state: State = { diff --git a/packages/rn-tester/js/examples/Animated/ComposingExample.js b/packages/rn-tester/js/examples/Animated/ComposingExample.js index c05a916a135..ecb6b3093fd 100644 --- a/packages/rn-tester/js/examples/Animated/ComposingExample.js +++ b/packages/rn-tester/js/examples/Animated/ComposingExample.js @@ -27,7 +27,7 @@ import { useWindowDimensions, } from 'react-native'; -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; const boxSize = 12; const padding = 8; const leftToRightTimingConfig = (useNativeDriver: boolean) => ({ diff --git a/packages/rn-tester/js/examples/Animated/EasingExample.js b/packages/rn-tester/js/examples/Animated/EasingExample.js index af9612ffded..46db230695c 100644 --- a/packages/rn-tester/js/examples/Animated/EasingExample.js +++ b/packages/rn-tester/js/examples/Animated/EasingExample.js @@ -25,7 +25,7 @@ import { View, } from 'react-native'; -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; type EasingListItem = { title: string, diff --git a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js index 12694ca92c4..56e9fc88925 100644 --- a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js +++ b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js @@ -56,7 +56,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; function MovingBoxView({useNativeDriver}: {useNativeDriver: boolean}) { const x = useRef(new Animated.Value(0)); diff --git a/packages/rn-tester/js/examples/Animated/PanGestureExample.js b/packages/rn-tester/js/examples/Animated/PanGestureExample.js index e294afb7565..d9745ad7677 100644 --- a/packages/rn-tester/js/examples/Animated/PanGestureExample.js +++ b/packages/rn-tester/js/examples/Animated/PanGestureExample.js @@ -22,7 +22,7 @@ import { View, } from 'react-native'; -function TextBox({children}: $ReadOnly<{children: React.Node}>): React.Node { +function TextBox({children}: Readonly<{children: React.Node}>): React.Node { // Prevent touch from being hijacked by Text return ( @@ -34,8 +34,8 @@ function TextBox({children}: $ReadOnly<{children: React.Node}>): React.Node { function AnimatedEventExample({ containerPageXY, useNativeDriver, -}: $ReadOnly<{ - containerPageXY: $ReadOnly<{x: number, y: number}>, +}: Readonly<{ + containerPageXY: Readonly<{x: number, y: number}>, useNativeDriver: boolean, }>): React.Node { const boxRef = useRef>(); @@ -128,7 +128,7 @@ function AnimatedEventExample({ function PanResponderExample({ useNativeDriver, -}: $ReadOnly<{useNativeDriver: boolean}>): React.Node { +}: Readonly<{useNativeDriver: boolean}>): React.Node { const finalOffsetXY = useRef( new Animated.ValueXY({x: 0, y: 0}, {useNativeDriver}), ).current; diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js index 3f4a9f0021e..4df8cfb6914 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js @@ -22,7 +22,7 @@ const randColor = () => { return `rgb(${colors.join(',')})`; }; -type AnExSetProps = $ReadOnly<{ +type AnExSetProps = Readonly<{ openVal: Animated.Value, containerLayout: {width: number, height: number}, id: string, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js index 14fda02e7b9..fa81bc61873 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js @@ -16,7 +16,7 @@ import usePlatformTestHarness from './usePlatformTestHarness'; import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ title: string, description: string, instructions?: $ReadOnlyArray, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js index c6a1497f712..a704a67212d 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js @@ -12,7 +12,7 @@ import type {ViewProps} from 'react-native'; import {useMemo} from 'react'; -type EventRecorderOptions = $ReadOnly<{ +type EventRecorderOptions = Readonly<{ mergeEventTypes: Array, relevantEvents: Array, }>; @@ -104,7 +104,7 @@ export default class RNTesterPlatformTestEventRecorder { createRecorderTestEventHandlers( targetNames: $ReadOnlyArray, callback?: (event: Object, eventType: string, targetName: string) => void, - ): $ReadOnly<{[targetName: string]: ViewProps}> { + ): Readonly<{[targetName: string]: ViewProps}> { const result: {[targetName: string]: ViewProps} = {}; for (const targetName of targetNames) { const recordedEventHandler = @@ -173,7 +173,7 @@ export function useRecorderTestEventHandlers( eventRecorder: RNTesterPlatformTestEventRecorder, targetNames: $ReadOnlyArray, callback?: (event: Object, eventType: string, targetName: string) => void, -): $ReadOnly<{[targetName: string]: ViewProps}> { +): Readonly<{[targetName: string]: ViewProps}> { return useMemo( () => eventRecorder.createRecorderTestEventHandlers(targetNames, callback), [eventRecorder, targetNames, callback], diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js index d29e688b721..98bd0726bba 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js @@ -13,7 +13,7 @@ import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ instructions?: $ReadOnlyArray, style?: ?ViewStyleProp, }>; diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js index d9602b4c745..e09b24d33e8 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js @@ -14,7 +14,7 @@ import RNTesterPlatformTestResultsText from './RNTesterPlatformTestResultsText'; import * as React from 'react'; import {StyleSheet, Text, TouchableHighlight, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ numFail: number, numError: number, numPass: number, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js index 01988eefa59..b4716abc957 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js @@ -41,7 +41,7 @@ const DISPLAY_STATUS_MAPPING: {[PlatformTestResultStatus]: string} = { SKIPPED: 'Skipped', }; -type FilterModalProps = $ReadOnly<{ +type FilterModalProps = Readonly<{ filterText: string, setFilterText: (newFilterText: string) => void, filterFail: boolean, @@ -176,7 +176,7 @@ function renderTableRow({item}: ListRenderItemInfo) { return ; } -type Props = $ReadOnly<{ +type Props = Readonly<{ numPending: number, reset: () => void, results: $ReadOnlyArray, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js index db58b8eee22..1a2c6c6bcd8 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js @@ -11,7 +11,7 @@ import * as React from 'react'; import {StyleSheet, Text} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ numPass: number, numFail: number, numError: number, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js index a3b3a5685f6..0ecba3d2487 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js @@ -8,17 +8,17 @@ * @format */ -type BasePlatformTestAssertionResult = $ReadOnly<{ +type BasePlatformTestAssertionResult = Readonly<{ name: string, description: string, }>; -export type PassingPlatformTestAssertionResult = $ReadOnly<{ +export type PassingPlatformTestAssertionResult = Readonly<{ ...BasePlatformTestAssertionResult, passing: true, }>; -export type FailingPlatformTestAssertionResult = $ReadOnly<{ +export type FailingPlatformTestAssertionResult = Readonly<{ ...BasePlatformTestAssertionResult, passing: false, failureMessage: string, @@ -30,14 +30,14 @@ export type PlatformTestAssertionResult = export type PlatformTestResultStatus = 'PASS' | 'FAIL' | 'ERROR' | 'SKIPPED'; -export type PlatformTestResult = $ReadOnly<{ +export type PlatformTestResult = Readonly<{ name: string, status: PlatformTestResultStatus, assertions: $ReadOnlyArray, error: unknown | null, // null is technically unnecessary but is kept to ensure the error is described as nullable }>; -export type PlatformTestContext = $ReadOnly<{ +export type PlatformTestContext = Readonly<{ assert_true(a: boolean, description: string): void, assert_equals(a: any, b: any, description: string): void, assert_not_equals(a: any, b: any, description: string): void, @@ -47,16 +47,16 @@ export type PlatformTestContext = $ReadOnly<{ export type PlatformTestCase = (context: PlatformTestContext) => void; -export type AsyncPlatformTest = $ReadOnly<{ +export type AsyncPlatformTest = Readonly<{ done(): void, step(testcase: PlatformTestCase): void, }>; -export type SyncTestOptions = $ReadOnly<{ +export type SyncTestOptions = Readonly<{ skip?: boolean, }>; -export type PlatformTestHarness = $ReadOnly<{ +export type PlatformTestHarness = Readonly<{ test( testcase: PlatformTestCase, name: string, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js index 619b3b17251..0f8c88ddc67 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js @@ -32,8 +32,8 @@ function constructAsyncTestHook( addTestResult: (newResult: PlatformTestResult) => void, updateAsyncTestStatuses: ( ( - $ReadOnly<{[string]: AsyncTestStatus}>, - ) => $ReadOnly<{[string]: AsyncTestStatus}>, + Readonly<{[string]: AsyncTestStatus}>, + ) => Readonly<{[string]: AsyncTestStatus}>, ) => void, runTestCase: ( testCase: PlatformTestCase, @@ -131,7 +131,7 @@ function constructAsyncTestHook( }; } -export type PlatformTestHarnessHookResult = $ReadOnly<{ +export type PlatformTestHarnessHookResult = Readonly<{ testKey: number, harness: PlatformTestHarness, numPending: number, @@ -180,7 +180,7 @@ export default function usePlatformTestHarness(): PlatformTestHarnessHookResult const [testElementKey, setTestElementKey] = useState(0); const [asyncTestStatuses, updateAsyncTestStatuses] = useState< - $ReadOnly<{[string]: AsyncTestStatus}>, + Readonly<{[string]: AsyncTestStatus}>, >({}); const reset = useCallback(() => { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js index 320c488583e..b8ba306ff90 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js @@ -258,7 +258,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventAttributesHoverablePointers( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js index b2aef5bfe3e..4aec343c301 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js @@ -226,7 +226,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventAttributesNoHoverPointers( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js index e67bded96cc..df94aae7df2 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js @@ -190,7 +190,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventCaptureMouse( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js index 8d33203aa19..add9f2d3cc2 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js @@ -120,7 +120,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventClickTouch( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js index 17a188585ee..808f987c479 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js @@ -119,7 +119,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventClickTouchHierarchy( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js index ef986ccb682..35256480d04 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js @@ -180,7 +180,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventClickTouchHierarchyPointerEvents( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js index d95acb544b5..96da6c29052 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js @@ -105,7 +105,7 @@ function PointerEventLayoutShouldFirePointerOverTestCase( ); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventLayoutShouldFirePointerOver( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js index 4d97b81e871..d2bdd622ee3 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js @@ -165,7 +165,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PoitnerEventPointerCancelTouch( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js index f2599701541..e45a7defda7 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js @@ -46,7 +46,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventPointerMove( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js index 8be2425d63b..29f28b8f0ad 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js @@ -150,7 +150,7 @@ function PointerEventPointerMoveAcrossTestCase( ); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventPointerMoveAcross( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js index 6aeeed63a2f..bdefa282fc7 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js @@ -120,7 +120,7 @@ function PointerEventPointerMoveBetweenTestCase( ); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventPointerMoveBetween( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js index 02bea4940c9..3b23735f9aa 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js @@ -133,7 +133,7 @@ function PointerEventPointerMoveEventOrderTestCase( ); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventPointerMoveEventOrder( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js index 522190c844d..88c9c857c5a 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js @@ -117,7 +117,7 @@ function PointerEventPointerMoveOnChordedMouseButtonTestCase( ); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventPointerMoveOnChordedMouseButton( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js index 07cde4b5992..340cca78482 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js @@ -206,7 +206,7 @@ function PointerEventPointerOverOutTestCase( ); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventPointerOverOut( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js index 977e54ecb73..6e7448a3643 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js @@ -128,7 +128,7 @@ function PointerEventPrimaryTouchPointerTestCase( ); } -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; export default function PointerEventPrimaryTouchPointer( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js index 4481baf9e9d..419cda04fc3 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js @@ -243,7 +243,7 @@ export function mkEvent(id: string, eventName: EventName): EventOccurrence { }; } -export type EventTrackerProps = $ReadOnly<{ +export type EventTrackerProps = Readonly<{ eventsRef?: {current: Array}, onAnyEvent?: (EventOccurrence, PointerEvent) => void, eventsToTrack: Array, diff --git a/packages/rn-tester/js/examples/Filter/FilterExample.js b/packages/rn-tester/js/examples/Filter/FilterExample.js index 7a24f30b25e..d1d9b0a8307 100644 --- a/packages/rn-tester/js/examples/Filter/FilterExample.js +++ b/packages/rn-tester/js/examples/Filter/FilterExample.js @@ -20,7 +20,7 @@ import {Animated, Button, Image, StyleSheet, Text, View} from 'react-native'; const alphaHotdog = require('../../assets/alpha-hotdog.png'); const hotdog = require('../../assets/hotdog.jpg'); -type Props = $ReadOnly<{ +type Props = Readonly<{ style?: ViewStyleProp, testID?: string, imageSource?: number, diff --git a/packages/rn-tester/js/examples/FlatList/BaseFlatListExample.js b/packages/rn-tester/js/examples/FlatList/BaseFlatListExample.js index 5db6d231b75..11fffe822a9 100644 --- a/packages/rn-tester/js/examples/FlatList/BaseFlatListExample.js +++ b/packages/rn-tester/js/examples/FlatList/BaseFlatListExample.js @@ -59,7 +59,7 @@ const Item = ({item, separators}: ListRenderItemInfo) => { ); }; -type Props = $ReadOnly<{ +type Props = Readonly<{ exampleProps: Partial>, onTest?: ?() => void, testLabel?: ?string, diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js index 472502e120b..9ac07d70b63 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js @@ -53,7 +53,7 @@ const VIEWABILITY_CONFIG = { waitForInteraction: true, }; -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; type State = { data: Array, first: number, diff --git a/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js b/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js index a2e84272a60..8b702b04ac9 100644 --- a/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js +++ b/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js @@ -17,7 +17,7 @@ const nativeImageSource = const {Image, StyleSheet, Text, View} = ReactNative; -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; class ImageCapInsetsExample extends React.Component { render(): React.Node { return ( diff --git a/packages/rn-tester/js/examples/Image/ImageExample.js b/packages/rn-tester/js/examples/Image/ImageExample.js index d598c4ae3f0..a1da1e93132 100644 --- a/packages/rn-tester/js/examples/Image/ImageExample.js +++ b/packages/rn-tester/js/examples/Image/ImageExample.js @@ -30,11 +30,11 @@ const base64Icon = const IMAGE_PREFETCH_URL = `${IMAGE1}?r=1&t=${Date.now()}`; const prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL); -type ImageSource = $ReadOnly<{ +type ImageSource = Readonly<{ uri: string, }>; -type BlobImageProps = $ReadOnly<{ +type BlobImageProps = Readonly<{ url: string, }>; @@ -59,7 +59,7 @@ const BlobImage = ({url}: BlobImageProps): React.Node => { type BlobImageExampleState = {}; -type BlobImageExampleProps = $ReadOnly<{ +type BlobImageExampleProps = Readonly<{ urls: string[], }>; @@ -78,7 +78,7 @@ class BlobImageExample extends React.Component< } } -type NetworkImageCallbackExampleProps = $ReadOnly<{ +type NetworkImageCallbackExampleProps = Readonly<{ source: ImageSource, prefetchedSource: ImageSource, }>; @@ -247,7 +247,7 @@ type ImageSizeExampleState = { height: number, }; -type ImageSizeExampleProps = $ReadOnly<{ +type ImageSizeExampleProps = Readonly<{ source: ImageSource, }>; @@ -284,7 +284,7 @@ type MultipleSourcesExampleState = { height: number, }; -type MultipleSourcesExampleProps = $ReadOnly<{}>; +type MultipleSourcesExampleProps = Readonly<{}>; class MultipleSourcesExample extends React.Component< MultipleSourcesExampleProps, @@ -359,7 +359,7 @@ type LoadingIndicatorSourceExampleState = { imageHash: number, }; -type LoadingIndicatorSourceExampleProps = $ReadOnly<{}>; +type LoadingIndicatorSourceExampleProps = Readonly<{}>; class LoadingIndicatorSourceExample extends React.Component< LoadingIndicatorSourceExampleProps, @@ -407,7 +407,7 @@ type FadeDurationExampleState = { imageHash: number, }; -type FadeDurationExampleProps = $ReadOnly<{}>; +type FadeDurationExampleProps = Readonly<{}>; class FadeDurationExample extends React.Component< FadeDurationExampleProps, @@ -450,7 +450,7 @@ type OnLayoutExampleState = { layoutHandlerMessage: string, }; -type OnLayoutExampleProps = $ReadOnly<{}>; +type OnLayoutExampleProps = Readonly<{}>; class OnLayoutExample extends React.Component< OnLayoutExampleProps, @@ -543,7 +543,7 @@ type OnPartialLoadExampleState = { hasLoaded: boolean, }; -type OnPartialLoadExampleProps = $ReadOnly<{}>; +type OnPartialLoadExampleProps = Readonly<{}>; class OnPartialLoadExample extends React.Component< OnPartialLoadExampleProps, diff --git a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js index ee4e78ccefd..b07b8300636 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js @@ -20,7 +20,7 @@ import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {Image, LayoutAnimation, StyleSheet, View} from 'react-native'; -type Props = $ReadOnly<{}>; +type Props = Readonly<{}>; type State = { containerStyle?: {width: number}, extraText?: string, diff --git a/packages/rn-tester/js/examples/Layout/LayoutExample.js b/packages/rn-tester/js/examples/Layout/LayoutExample.js index f0bd1d27aa6..0d6b4b8eda2 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutExample.js @@ -19,7 +19,7 @@ import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {StyleSheet, View} from 'react-native'; -type CicleProps = $ReadOnly<{ +type CicleProps = Readonly<{ backgroundColor?: string, size?: number, }>; @@ -41,7 +41,7 @@ function Circle({ ); } -type CircleBlockProps = $ReadOnly<{ +type CircleBlockProps = Readonly<{ children: React.Node, style: ViewStyleProp, }>; diff --git a/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js b/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js index 11a485e8287..f3d4c704453 100644 --- a/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js +++ b/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js @@ -21,7 +21,7 @@ import { function LayoutConformanceExample({ testID, -}: $ReadOnly<{testID: ?string}>): React.Node { +}: Readonly<{testID: ?string}>): React.Node { return ( diff --git a/packages/rn-tester/js/examples/LinearGradient/LinearGradientExample.js b/packages/rn-tester/js/examples/LinearGradient/LinearGradientExample.js index ed63414a933..ed99f2bf1b8 100644 --- a/packages/rn-tester/js/examples/LinearGradient/LinearGradientExample.js +++ b/packages/rn-tester/js/examples/LinearGradient/LinearGradientExample.js @@ -17,7 +17,7 @@ import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {Platform, PlatformColor, StyleSheet, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ style: ViewStyleProp, testID?: string, children?: React.Node, diff --git a/packages/rn-tester/js/examples/Linking/LinkingExample.js b/packages/rn-tester/js/examples/Linking/LinkingExample.js index 34a45fcbd8a..9e0b64418f8 100644 --- a/packages/rn-tester/js/examples/Linking/LinkingExample.js +++ b/packages/rn-tester/js/examples/Linking/LinkingExample.js @@ -25,7 +25,7 @@ import { } from 'react-native'; class OpenURLButton extends React.Component< - $ReadOnly<{ + Readonly<{ url: string, }>, > { @@ -55,7 +55,7 @@ class OpenURLButton extends React.Component< } } -class OpenSettingsExample extends React.Component<$ReadOnly<{}>> { +class OpenSettingsExample extends React.Component> { openSettings = () => { void Linking.openSettings(); }; @@ -68,7 +68,7 @@ class OpenSettingsExample extends React.Component<$ReadOnly<{}>> { const SendIntentButton = ({ action, extras, -}: $ReadOnly<{ +}: Readonly<{ action: string, extras?: Array<{ key: string, @@ -100,7 +100,7 @@ const SendIntentButton = ({ ); }; -class IntentAndroidExample extends React.Component<$ReadOnly<{}>> { +class IntentAndroidExample extends React.Component> { render(): React.Node { return ( diff --git a/packages/rn-tester/js/examples/MixBlendMode/MixBlendModeExample.js b/packages/rn-tester/js/examples/MixBlendMode/MixBlendModeExample.js index 6074da93305..e46fe8a9742 100644 --- a/packages/rn-tester/js/examples/MixBlendMode/MixBlendModeExample.js +++ b/packages/rn-tester/js/examples/MixBlendMode/MixBlendModeExample.js @@ -15,7 +15,7 @@ import React from 'react'; import {useState} from 'react'; import {Image, ImageBackground, StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ style: ViewStyleProp, testID?: string, }>; diff --git a/packages/rn-tester/js/examples/Performance/components/ItemList.js b/packages/rn-tester/js/examples/Performance/components/ItemList.js index df370f958eb..a15ebd85561 100644 --- a/packages/rn-tester/js/examples/Performance/components/ItemList.js +++ b/packages/rn-tester/js/examples/Performance/components/ItemList.js @@ -28,7 +28,7 @@ function Item(props: {data: ItemDataType}): React.Node { ); } -type ItemListProps = $ReadOnly<{ +type ItemListProps = Readonly<{ data: ItemDataType[], useFlatList?: boolean, onScroll?: (evt: ScrollEvent) => void, diff --git a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js index a9ce8b05d0f..a88dac42909 100644 --- a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js +++ b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js @@ -13,15 +13,15 @@ const React = require('react'); const {StyleSheet, Text, View} = require('react-native'); -type ExampleBoxComponentProps = $ReadOnly<{ +type ExampleBoxComponentProps = Readonly<{ onLog: (msg: string) => void, }>; -type ExampleBoxProps = $ReadOnly<{ +type ExampleBoxProps = Readonly<{ Component: React.ComponentType, }>; -type ExampleBoxState = $ReadOnly<{ +type ExampleBoxState = Readonly<{ log: string[], }>; @@ -278,7 +278,7 @@ class BoxOnlyStyleExample extends React.Component<$FlowFixMe> { } } -type OverflowExampleProps = $ReadOnly<{ +type OverflowExampleProps = Readonly<{ overflow: 'hidden' | 'visible', onLog: (msg: string) => void, }>; diff --git a/packages/rn-tester/js/examples/RadialGradient/RadialGradientExample.js b/packages/rn-tester/js/examples/RadialGradient/RadialGradientExample.js index b15453e8a31..19f31f98c10 100644 --- a/packages/rn-tester/js/examples/RadialGradient/RadialGradientExample.js +++ b/packages/rn-tester/js/examples/RadialGradient/RadialGradientExample.js @@ -17,7 +17,7 @@ import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {Platform, PlatformColor, StyleSheet, View} from 'react-native'; -type Props = $ReadOnly<{ +type Props = Readonly<{ style: ViewStyleProp, testID?: string, children?: React.Node, diff --git a/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js b/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js index 0e02f68e031..6926a8c9428 100644 --- a/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js +++ b/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js @@ -20,7 +20,7 @@ import { View, } from 'react-native'; -type Data = $ReadOnly<{ +type Data = Readonly<{ clicks: number, text: string, }>; @@ -43,7 +43,7 @@ const styles = StyleSheet.create({ }); class Row extends React.Component< - $ReadOnly<{ + Readonly<{ data: Data, onClick: Data => void, }>, @@ -65,14 +65,14 @@ class Row extends React.Component< } } -type RefreshControlExampleState = $ReadOnly<{ +type RefreshControlExampleState = Readonly<{ isRefreshing: boolean, loaded: number, rowData: $ReadOnlyArray, }>; class RefreshControlExample extends React.Component< - $ReadOnly<{}>, + Readonly<{}>, RefreshControlExampleState, > { state: RefreshControlExampleState = { diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js index a3dac7c5ddf..c2f8beae6e4 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js @@ -42,7 +42,7 @@ function ScrollViewKeyboardInsetsExample(): React.Node { const renderItem = ({ item, index, - }: $ReadOnly<{item: number, index: number, ...}>) => { + }: Readonly<{item: number, index: number, ...}>) => { const largeInput = index % 5 === 4; return ( diff --git a/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js b/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js index 218aae85762..d4de9daae6c 100644 --- a/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js +++ b/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js @@ -64,7 +64,7 @@ const Item = ({item, section, separators}) => { ); }; -type Props = $ReadOnly<{ +type Props = Readonly<{ // $FlowFixMe[unclear-type] exampleProps: Partial>>, onTest?: ?() => void, diff --git a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js index 32f419d10ce..c6631de7a75 100644 --- a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js +++ b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js @@ -25,10 +25,10 @@ const RCTSnapshot = UIManager.hasViewManagerConfig('RCTSnapshot') : View; type SnapshotReadyEvent = NativeSyntheticEvent< - $ReadOnly<{testIdentifier: string, ...}>, + Readonly<{testIdentifier: string, ...}>, >; -type Props = $ReadOnly<{ +type Props = Readonly<{ ...ViewProps, onSnapshotReady?: ?(event: SnapshotReadyEvent) => unknown, testIdentifier?: ?string, diff --git a/packages/rn-tester/js/examples/Switch/SwitchExample.js b/packages/rn-tester/js/examples/Switch/SwitchExample.js index c8692cfe61d..b520820cb5b 100644 --- a/packages/rn-tester/js/examples/Switch/SwitchExample.js +++ b/packages/rn-tester/js/examples/Switch/SwitchExample.js @@ -16,12 +16,12 @@ import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {Platform, Switch, View} from 'react-native'; -type OnOffIndicatorProps = $ReadOnly<{on: boolean, testID: string}>; +type OnOffIndicatorProps = Readonly<{on: boolean, testID: string}>; function OnOffIndicator({on, testID}: OnOffIndicatorProps) { return {on ? 'On' : 'Off'}; } -type ExampleRowProps = $ReadOnly<{children: React.Node}>; +type ExampleRowProps = Readonly<{children: React.Node}>; function ExampleRow({children}: ExampleRowProps) { return ( ; diff --git a/packages/rn-tester/js/examples/Text/TextExample.android.js b/packages/rn-tester/js/examples/Text/TextExample.android.js index 84443cf035e..04eb6f55e33 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.android.js +++ b/packages/rn-tester/js/examples/Text/TextExample.android.js @@ -87,7 +87,7 @@ class AttributeToggler extends React.Component<{...}, $FlowFixMe> { } } -type AdjustingFontSizeProps = $ReadOnly<{}>; +type AdjustingFontSizeProps = Readonly<{}>; type AdjustingFontSizeState = { dynamicText: string, diff --git a/packages/rn-tester/js/examples/Text/TextExample.ios.js b/packages/rn-tester/js/examples/Text/TextExample.ios.js index 1af9c830f13..784cc150934 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.ios.js +++ b/packages/rn-tester/js/examples/Text/TextExample.ios.js @@ -145,7 +145,7 @@ class AttributeToggler extends React.Component<{...}, $FlowFixMe> { } } -type AdjustingFontSizeProps = $ReadOnly<{}>; +type AdjustingFontSizeProps = Readonly<{}>; type AdjustingFontSizeState = { dynamicText: string, @@ -393,7 +393,7 @@ class TextRenderInfoExample extends React.Component< { fontSize: number, numberOfTextBlocks: number, - textMetrics: $ReadOnly<{ + textMetrics: Readonly<{ ascender: number, capHeight: number, descender: number, @@ -409,7 +409,7 @@ class TextRenderInfoExample extends React.Component< state: { fontSize: number, numberOfTextBlocks: number, - textMetrics: $ReadOnly<{ + textMetrics: Readonly<{ ascender: number, capHeight: number, descender: number, @@ -506,7 +506,7 @@ class TextRenderInfoExample extends React.Component< class TextWithCapBaseBox extends React.Component< {children: string, style?: any}, { - textMetrics: $ReadOnly<{ + textMetrics: Readonly<{ ascender: number, capHeight: number, descender: number, @@ -520,7 +520,7 @@ class TextWithCapBaseBox extends React.Component< }, > { state: { - textMetrics: $ReadOnly<{ + textMetrics: Readonly<{ ascender: number, capHeight: number, descender: number, diff --git a/packages/rn-tester/js/examples/Text/TextSharedExamples.js b/packages/rn-tester/js/examples/Text/TextSharedExamples.js index cdbb36d8955..8974df2892c 100644 --- a/packages/rn-tester/js/examples/Text/TextSharedExamples.js +++ b/packages/rn-tester/js/examples/Text/TextSharedExamples.js @@ -80,7 +80,7 @@ function EmptyTextExample(): React.Node { function TextAndLayoutLinesJSON({ testID, ellipsizeMode, -}: $ReadOnly<{ +}: Readonly<{ testID: string, ellipsizeMode: 'head' | 'tail' | 'middle' | 'clip', }>): React.Node { diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js index 5fc810c44f0..f90d8db69c4 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js @@ -124,12 +124,12 @@ class TextInputAccessoryViewChangeKeyboardExample extends React.Component< } class TextInputAccessoryViewDefaultDoneButtonExample extends React.Component< - $ReadOnly<{ + Readonly<{ keyboardType: KeyboardTypeOptions, }>, {text: string}, > { - constructor(props: void | $ReadOnly<{keyboardType: KeyboardTypeOptions}>) { + constructor(props: void | Readonly<{keyboardType: KeyboardTypeOptions}>) { // $FlowFixMe[incompatible-type] super(props); this.state = {text: ''}; diff --git a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js index 2de5275b9dd..5ebc81ad1e2 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js @@ -485,7 +485,7 @@ class TokenizedTextExample extends React.Component<$FlowFixMe, $FlowFixMe> { } type SelectionExampleState = { - selection: $ReadOnly<{ + selection: Readonly<{ start: number, end: number, }>, diff --git a/packages/rn-tester/js/examples/Timer/TimerExample.js b/packages/rn-tester/js/examples/Timer/TimerExample.js index 5a0965105ed..0e36bcd2bb7 100644 --- a/packages/rn-tester/js/examples/Timer/TimerExample.js +++ b/packages/rn-tester/js/examples/Timer/TimerExample.js @@ -22,7 +22,7 @@ function burnCPU(milliseconds: number) { while (global.performance.now() < start + milliseconds) {} } -type RequestIdleCallbackTesterProps = $ReadOnly<{}>; +type RequestIdleCallbackTesterProps = Readonly<{}>; type RequestIdleCallbackTesterState = {message: string}; class RequestIdleCallbackTester extends React.Component< @@ -146,7 +146,7 @@ class RequestIdleCallbackTester extends React.Component< }; } -type TimerTesterProps = $ReadOnly<{ +type TimerTesterProps = Readonly<{ dt?: any, type: string, }>; @@ -271,7 +271,7 @@ class TimerTester extends React.Component { } class IntervalExample extends React.Component< - $ReadOnly<{}>, + Readonly<{}>, { showTimer: boolean, }, diff --git a/packages/rn-tester/js/examples/View/ViewExample.js b/packages/rn-tester/js/examples/View/ViewExample.js index cbddb935dc3..773dda2440f 100644 --- a/packages/rn-tester/js/examples/View/ViewExample.js +++ b/packages/rn-tester/js/examples/View/ViewExample.js @@ -24,7 +24,7 @@ import { } from 'react-native'; class ViewBorderStyleExample extends React.Component< - $ReadOnly<{}>, + Readonly<{}>, {showBorder: boolean}, > { state: {showBorder: boolean} = { @@ -89,7 +89,7 @@ const offscreenAlphaCompositingStyles = StyleSheet.create({ }); class OffscreenAlphaCompositing extends React.Component< - $ReadOnly<{testID?: ?string}>, + Readonly<{testID?: ?string}>, { active: boolean, }, @@ -173,7 +173,7 @@ const ZIndexExampleStyles = StyleSheet.create({ }); class ZIndexExample extends React.Component< - $ReadOnly<{}>, + Readonly<{}>, { flipped: boolean, }, @@ -317,7 +317,7 @@ function PositionStaticZIndexExample(): React.Node { } class DisplayNoneStyle extends React.Component< - $ReadOnly<{}>, + Readonly<{}>, { index: number, }, @@ -383,7 +383,7 @@ class DisplayNoneStyle extends React.Component< }; } -class FlexGapExample extends React.Component<$ReadOnly<{testID?: ?string}>> { +class FlexGapExample extends React.Component> { render(): React.Node { return ( void, @@ -57,7 +57,7 @@ class Button extends React.Component< } class Row extends React.Component< - $ReadOnly<{ + Readonly<{ children?: React.Node, label: string, value?: ?string, @@ -76,12 +76,12 @@ class Row extends React.Component< } } -type WebSocketImageState = $ReadOnly<{ +type WebSocketImageState = Readonly<{ blob: ?Blob, }>; class WebSocketImage extends React.Component< - $ReadOnly<{url: string}>, + Readonly<{url: string}>, WebSocketImageState, > { ws: ?WebSocket = null; @@ -150,7 +150,7 @@ type WebSocketExampleState = { }; class WebSocketExample extends React.Component< - $ReadOnly<{}>, + Readonly<{}>, WebSocketExampleState, > { state: WebSocketExampleState = { diff --git a/packages/rn-tester/js/types/RNTesterTypes.js b/packages/rn-tester/js/types/RNTesterTypes.js index 646dd551493..08a9b4e8a9c 100644 --- a/packages/rn-tester/js/types/RNTesterTypes.js +++ b/packages/rn-tester/js/types/RNTesterTypes.js @@ -8,7 +8,7 @@ * @format */ -export type RNTesterModuleExample = $ReadOnly<{ +export type RNTesterModuleExample = Readonly<{ name?: string, title: string, platform?: 'ios' | 'android', @@ -19,7 +19,7 @@ export type RNTesterModuleExample = $ReadOnly<{ render: component(), }>; -export type RNTesterModule = $ReadOnly<{ +export type RNTesterModule = Readonly<{ title: string, testTitle?: ?string, description: string, @@ -33,7 +33,7 @@ export type RNTesterModule = $ReadOnly<{ showIndividualExamples?: boolean, }>; -export type RNTesterModuleInfo = $ReadOnly<{ +export type RNTesterModuleInfo = Readonly<{ key: string, module: RNTesterModule, category?: string, @@ -47,7 +47,7 @@ export type SectionData = { data: Array, }; -export type ExamplesList = $ReadOnly<{ +export type ExamplesList = Readonly<{ components: $ReadOnlyArray>, apis: $ReadOnlyArray>, }>; diff --git a/packages/virtualized-lists/Lists/ListMetricsAggregator.js b/packages/virtualized-lists/Lists/ListMetricsAggregator.js index 9cb243a0343..0fa5b419f5a 100644 --- a/packages/virtualized-lists/Lists/ListMetricsAggregator.js +++ b/packages/virtualized-lists/Lists/ListMetricsAggregator.js @@ -135,7 +135,7 @@ export default class ListMetricsAggregator { layout, }: { orientation: ListOrientation, - layout: $ReadOnly<{width: number, height: number}>, + layout: Readonly<{width: number, height: number}>, }): void { this._invalidateIfOrientationChanged(orientation); this._contentLength = this._selectLength(layout); @@ -320,11 +320,11 @@ export default class ListMetricsAggregator { _selectLength({ width, height, - }: $ReadOnly<{width: number, height: number, ...}>): number { + }: Readonly<{width: number, height: number, ...}>): number { return this._orientation.horizontal ? width : height; } - _selectOffset({x, y}: $ReadOnly<{x: number, y: number, ...}>): number { + _selectOffset({x, y}: Readonly<{x: number, y: number, ...}>): number { return this._orientation.horizontal ? x : y; } } diff --git a/packages/virtualized-lists/Lists/ViewabilityHelper.js b/packages/virtualized-lists/Lists/ViewabilityHelper.js index 4c3da7e3c7c..08c7ef8c80c 100644 --- a/packages/virtualized-lists/Lists/ViewabilityHelper.js +++ b/packages/virtualized-lists/Lists/ViewabilityHelper.js @@ -38,7 +38,7 @@ export type ViewabilityConfigCallbackPair = { export type ViewabilityConfigCallbackPairs = Array; -export type ViewabilityConfig = $ReadOnly<{ +export type ViewabilityConfig = Readonly<{ /** * Minimum amount of time (in milliseconds) that an item must be physically viewable before the * viewability callback will be fired. A high number means that scrolling through content without diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index 66e6fd5e1da..7ba53aaa075 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -1502,7 +1502,7 @@ class VirtualizedList extends StateSafePureComponent< } _selectLength( - metrics: $ReadOnly<{ + metrics: Readonly<{ height: number, width: number, ... @@ -1513,7 +1513,7 @@ class VirtualizedList extends StateSafePureComponent< : metrics.width; } - _selectOffset({x, y}: $ReadOnly<{x: number, y: number, ...}>): number { + _selectOffset({x, y}: Readonly<{x: number, y: number, ...}>): number { return this._orientation().horizontal ? x : y; } diff --git a/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js b/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js index f82cb17f0d8..35573a9d703 100644 --- a/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js +++ b/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js @@ -50,7 +50,7 @@ export type Props = { ... }; -type SeparatorProps = $ReadOnly<{ +type SeparatorProps = Readonly<{ highlighted: boolean, leadingItem: ?ItemT, }>; diff --git a/packages/virtualized-lists/Lists/VirtualizedListContext.js b/packages/virtualized-lists/Lists/VirtualizedListContext.js index f8065c3b5aa..77655687d3c 100644 --- a/packages/virtualized-lists/Lists/VirtualizedListContext.js +++ b/packages/virtualized-lists/Lists/VirtualizedListContext.js @@ -13,7 +13,7 @@ import type VirtualizedList from './VirtualizedList'; import * as React from 'react'; import {createContext, useContext, useMemo} from 'react'; -type Context = $ReadOnly<{ +type Context = Readonly<{ cellKey: ?string, getScrollMetrics: () => { contentLength: number, diff --git a/packages/virtualized-lists/Lists/VirtualizedListProps.js b/packages/virtualized-lists/Lists/VirtualizedListProps.js index 41b7d6ff7f3..f5675959f85 100644 --- a/packages/virtualized-lists/Lists/VirtualizedListProps.js +++ b/packages/virtualized-lists/Lists/VirtualizedListProps.js @@ -39,7 +39,7 @@ export type ListRenderItemInfo = { ... }; -export type CellRendererProps = $ReadOnly<{ +export type CellRendererProps = Readonly<{ cellKey: string, children: React.Node, index: number, diff --git a/packages/virtualized-lists/Lists/VirtualizedSectionList.js b/packages/virtualized-lists/Lists/VirtualizedSectionList.js index 8d8c74656ee..408e6491be4 100644 --- a/packages/virtualized-lists/Lists/VirtualizedSectionList.js +++ b/packages/virtualized-lists/Lists/VirtualizedSectionList.js @@ -23,7 +23,7 @@ type DefaultVirtualizedSectionT = { }; export type SectionData = - | ($ReadOnly> & SectionT) + | (Readonly> & SectionT) | (SectionBase & SectionT) | SectionT; @@ -478,7 +478,7 @@ class VirtualizedSectionList< }; } -type ItemWithSeparatorCommonProps = $ReadOnly<{ +type ItemWithSeparatorCommonProps = Readonly<{ leadingItem: ?ItemT, leadingSection: ?Object, section: Object, @@ -486,7 +486,7 @@ type ItemWithSeparatorCommonProps = $ReadOnly<{ trailingSection: ?Object, }>; -type ItemWithSeparatorProps = $ReadOnly<{ +type ItemWithSeparatorProps = Readonly<{ ...ItemWithSeparatorCommonProps, LeadingSeparatorComponent: ?(React.ComponentType | React.MixedElement), SeparatorComponent: ?(React.ComponentType | React.MixedElement), diff --git a/packages/virtualized-lists/Lists/__tests__/FillRateHelper-test.js b/packages/virtualized-lists/Lists/__tests__/FillRateHelper-test.js index 89cee09b636..0fa98770111 100644 --- a/packages/virtualized-lists/Lists/__tests__/FillRateHelper-test.js +++ b/packages/virtualized-lists/Lists/__tests__/FillRateHelper-test.js @@ -11,7 +11,7 @@ import FillRateHelper from '../FillRateHelper'; let rowFramesGlobal: ?{ - [string]: $ReadOnly<{ + [string]: Readonly<{ height: number, isMounted: boolean, y: number, @@ -37,13 +37,13 @@ function computeResult({ helper, state, scroll, -}: $ReadOnly<{ +}: Readonly<{ helper: FillRateHelper, - state?: $ReadOnly<{ + state?: Readonly<{ first?: number, last?: number, }>, - scroll?: $ReadOnly<{ + scroll?: Readonly<{ offset?: number, visibleLength?: number, }>, diff --git a/packages/virtualized-lists/Lists/__tests__/ViewabilityHelper-test.js b/packages/virtualized-lists/Lists/__tests__/ViewabilityHelper-test.js index e8690b49402..3fc9f79cc47 100644 --- a/packages/virtualized-lists/Lists/__tests__/ViewabilityHelper-test.js +++ b/packages/virtualized-lists/Lists/__tests__/ViewabilityHelper-test.js @@ -13,7 +13,7 @@ import type {CellMetricProps} from '../ListMetricsAggregator'; import ViewabilityHelper from '../ViewabilityHelper'; let rowFrames: ?{ - [string]: $ReadOnly<{height: number, y: number}>, + [string]: Readonly<{height: number, y: number}>, }; let data; const props: CellMetricProps = { diff --git a/private/react-native-fantom/runner/executables/hermesc.js b/private/react-native-fantom/runner/executables/hermesc.js index 9d43d643be7..cea3934a8ae 100644 --- a/private/react-native-fantom/runner/executables/hermesc.js +++ b/private/react-native-fantom/runner/executables/hermesc.js @@ -23,7 +23,7 @@ import { import fs from 'fs'; import path from 'path'; -type TesterOptions = $ReadOnly<{ +type TesterOptions = Readonly<{ isOptimizedMode: boolean, hermesVariant: HermesVariant, }>; diff --git a/private/react-native-fantom/runner/executables/tester.js b/private/react-native-fantom/runner/executables/tester.js index 2e173a41de9..bed44b2a610 100644 --- a/private/react-native-fantom/runner/executables/tester.js +++ b/private/react-native-fantom/runner/executables/tester.js @@ -27,7 +27,7 @@ import path from 'path'; const FANTOM_TESTER_BUCK_TARGET = 'fbsource//xplat/js/react-native-github/private/react-native-fantom/tester:tester'; -type TesterOptions = $ReadOnly<{ +type TesterOptions = Readonly<{ isOptimizedMode: boolean, hermesVariant: HermesVariant, }>; diff --git a/private/react-native-fantom/src/Benchmark.js b/private/react-native-fantom/src/Benchmark.js index ee2016e7ade..ddfa4f71948 100644 --- a/private/react-native-fantom/src/Benchmark.js +++ b/private/react-native-fantom/src/Benchmark.js @@ -22,7 +22,7 @@ import { type SyncFn = () => FnReturnedObject | void; -export type SuiteOptions = $ReadOnly<{ +export type SuiteOptions = Readonly<{ minIterations?: number, minTestExecutionTimeMs?: number, warmup?: boolean, @@ -51,12 +51,12 @@ export type BenchmarkResult = { timings: $ReadOnlyArray, }; -type InternalTestOptions = $ReadOnly<{ +type InternalTestOptions = Readonly<{ ...FnOptions, only?: boolean, }>; -type SuiteResults = Array<$ReadOnly>; +type SuiteResults = Array>; type TestWithArgName = string | ((testArg: TestArgType) => string); diff --git a/private/react-native-fantom/src/Constants.js b/private/react-native-fantom/src/Constants.js index 172bf7aca74..c995a10e04d 100644 --- a/private/react-native-fantom/src/Constants.js +++ b/private/react-native-fantom/src/Constants.js @@ -8,7 +8,7 @@ * @format */ -export type FantomRuntimeConstants = $ReadOnly<{ +export type FantomRuntimeConstants = Readonly<{ isOSS: boolean, isRunningFromCI: boolean, forceTestModeForBenchmarks: boolean, diff --git a/private/react-native-fantom/src/index.js b/private/react-native-fantom/src/index.js index dc96181baf3..c5cad6b86be 100644 --- a/private/react-native-fantom/src/index.js +++ b/private/react-native-fantom/src/index.js @@ -30,7 +30,7 @@ const nativeRuntimeScheduler = global.nativeRuntimeScheduler; const {unstable_scheduleCallback, unstable_ImmediatePriority} = nativeRuntimeScheduler; -type NodeOrRef = ReadOnlyNode | $ReadOnly<{current: ?ReadOnlyNode}>; +type NodeOrRef = ReadOnlyNode | Readonly<{current: ?ReadOnlyNode}>; export type RootConfig = { viewportWidth?: number, @@ -221,7 +221,7 @@ export function unstable_produceFramesForDuration(milliseconds: number) { */ export function unstable_getDirectManipulationProps( nodeOrRef: NodeOrRef, -): $ReadOnly<{ +): Readonly<{ [string]: unknown, }> { const node = getNode(nodeOrRef); @@ -229,7 +229,7 @@ export function unstable_getDirectManipulationProps( return NativeFantom.getDirectManipulationProps(shadowNode); } -export function unstable_getFabricUpdateProps(nodeOrRef: NodeOrRef): $ReadOnly<{ +export function unstable_getFabricUpdateProps(nodeOrRef: NodeOrRef): Readonly<{ [string]: unknown, }> { const node = getNode(nodeOrRef); @@ -400,8 +400,8 @@ export function createRoot(rootConfig?: RootConfig): Root { export function enqueueNativeEvent( nodeOrRef: NodeOrRef, type: string, - payload?: $ReadOnly<{[key: string]: unknown}>, - options?: $ReadOnly<{category?: NativeEventCategory, isUnique?: boolean}>, + payload?: Readonly<{[key: string]: unknown}>, + options?: Readonly<{category?: NativeEventCategory, isUnique?: boolean}>, ) { const node = getNode(nodeOrRef); const shadowNode = getNativeNodeReference(node); @@ -432,8 +432,8 @@ export function enqueueNativeEvent( export function dispatchNativeEvent( nodeOrRef: NodeOrRef, type: string, - payload?: $ReadOnly<{[key: string]: unknown}>, - options?: $ReadOnly<{category?: NativeEventCategory, isUnique?: boolean}>, + payload?: Readonly<{[key: string]: unknown}>, + options?: Readonly<{category?: NativeEventCategory, isUnique?: boolean}>, ) { const node = getNode(nodeOrRef); @@ -569,7 +569,7 @@ export function scrollTo(nodeOrRef: NodeOrRef, options: ScrollEventOptions) { */ export function enqueueModalSizeUpdate( nodeOrRef: NodeOrRef, - size: $ReadOnly<{width: number, height: number}>, + size: Readonly<{width: number, height: number}>, ) { const node = getNode(nodeOrRef); const shadowNode = getNativeNodeReference(node); diff --git a/scripts/build/config.js b/scripts/build/config.js index 04829f3d5f2..99b827e95d9 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -12,7 +12,7 @@ import type {BabelCoreOptions} from '@babel/core'; const {ModuleResolutionKind} = require('typescript'); -export type BuildOptions = $ReadOnly<{ +export type BuildOptions = Readonly<{ // The target runtime to compile for. target: 'node', @@ -23,9 +23,9 @@ export type BuildOptions = $ReadOnly<{ emitTypeScriptDefs?: boolean, }>; -export type BuildConfig = $ReadOnly<{ +export type BuildConfig = Readonly<{ // The packages to include for build and their build options. - packages: $ReadOnly<{[packageName: string]: BuildOptions}>, + packages: Readonly<{[packageName: string]: BuildOptions}>, }>; /** diff --git a/scripts/js-api/build-types/buildApiSnapshot.js b/scripts/js-api/build-types/buildApiSnapshot.js index 2e204be046f..9102075ad56 100644 --- a/scripts/js-api/build-types/buildApiSnapshot.js +++ b/scripts/js-api/build-types/buildApiSnapshot.js @@ -48,7 +48,7 @@ const postTransforms = ( ), ]; -type BuildApiSnapshotOptions = $ReadOnly<{ +type BuildApiSnapshotOptions = Readonly<{ validate: boolean, debugVersionAnnotations: boolean, }>; diff --git a/scripts/js-api/build-types/resolution/simpleResolve.js b/scripts/js-api/build-types/resolution/simpleResolve.js index a571f04a642..6991d9c449e 100644 --- a/scripts/js-api/build-types/resolution/simpleResolve.js +++ b/scripts/js-api/build-types/resolution/simpleResolve.js @@ -13,7 +13,7 @@ const {getPackages} = require('../../../shared/monorepoUtils'); const {existsSync} = require('fs'); const path = require('path'); -export type DependencyContext = $ReadOnly<{ +export type DependencyContext = Readonly<{ reportUnresolvedDependency(importPath: string): void, }>; diff --git a/scripts/releases/utils/octokit-utils.js b/scripts/releases/utils/octokit-utils.js index 9e7f1ff4897..74794523b31 100644 --- a/scripts/releases/utils/octokit-utils.js +++ b/scripts/releases/utils/octokit-utils.js @@ -13,9 +13,9 @@ // An interface shaped like a subset of the Octokit class from `@octokit/rest`. // Used to allow mocking in tests. export interface IOctokit { - +repos: $ReadOnly<{ + +repos: Readonly<{ listReleaseAssets: ( - params: $ReadOnly<{ + params: Readonly<{ owner: string, repo: string, release_id: string, @@ -29,13 +29,13 @@ export interface IOctokit { ... }>, uploadReleaseAsset: ( - params: $ReadOnly<{ + params: Readonly<{ owner: string, repo: string, release_id: string, name: string, data: Buffer, - headers: $ReadOnly<{ + headers: Readonly<{ 'content-type': string, ... }>,