From 92c32780f1842be4d0bb82ca06f66cf3d2ea4011 Mon Sep 17 00:00:00 2001 From: Marco Wang Date: Tue, 13 Jan 2026 21:59:05 -0800 Subject: [PATCH] Transform $ReadOnlyArray to ReadonlyArray 18/n (#55152) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55152 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Command: `js1 flow-runner codemod flow/transformUtilityType --legacy-type='$ReadOnlyArray'` Reviewed By: SamChou19815 Differential Revision: D90424826 fbshipit-source-id: 207e1abebb50671e8eb2a7f79ecfeaf4569b5b3e --- .../src/parsers/parsers-primitives.js | 4 +-- .../src/parsers/schema.js | 8 ++--- .../parsers/typescript/components/commands.js | 4 +-- .../typescript/components/componentsUtils.js | 4 +-- .../parsers/typescript/components/events.js | 6 ++-- .../parsers/typescript/components/extends.js | 2 +- .../typescript-module-parser-e2e-test.js | 6 ++-- .../src/parsers/typescript/modules/index.js | 4 +-- .../src/parsers/typescript/parser.js | 12 ++++---- .../src/ComparisonResult.js | 4 +-- .../src/ErrorFormatting.js | 8 ++--- .../src/SortTypeAnnotations.js | 6 ++-- .../src/TypeDiffing.js | 23 +++++++------- .../src/VersionDiffing.js | 2 +- .../NativeComponent.js.flow | 8 ++--- .../NativeComponent.js.flow | 2 +- .../NativeComponent.js.flow | 2 +- .../js/PopupMenuAndroid.android.js | 2 +- .../js/PopupMenuAndroid.js | 2 +- ...PopupMenuAndroidNativeComponent.android.js | 2 +- .../Libraries/Animated/AnimatedEvent.js | 8 ++--- .../Animated/AnimatedImplementation.js | 2 +- .../Animated/animations/TimingAnimation.js | 2 +- .../Animated/createAnimatedComponent.js | 6 ++-- .../Animated/nodes/AnimatedInterpolation.js | 22 +++++++------- .../Libraries/Animated/nodes/AnimatedNode.js | 2 +- .../Animated/nodes/AnimatedObject.js | 4 +-- .../Libraries/Animated/nodes/AnimatedProps.js | 8 ++--- .../Libraries/Animated/nodes/AnimatedStyle.js | 10 +++---- .../Animated/nodes/AnimatedTransform.js | 26 ++++++++-------- .../Animated/nodes/AnimatedWithChildren.js | 2 +- .../Libraries/BatchedBridge/MessageQueue.js | 4 +-- .../Libraries/BatchedBridge/NativeModules.js | 8 ++--- .../__mocks__/MessageQueueTestConfig.js | 2 +- .../__tests__/MessageQueue-test.js | 2 +- .../__tests__/NativeModules-test.js | 2 +- .../Libraries/Components/Button.js | 2 +- .../RefreshControl/RefreshControl.js | 2 +- .../Components/ScrollView/ScrollView.js | 4 +-- .../ScrollViewNativeComponentType.js | 2 +- .../Components/TextInput/TextInput.flow.js | 4 +-- .../Components/Touchable/PooledClass.js | 2 +- .../Components/Touchable/Touchable.js | 4 +-- .../Components/View/ViewAccessibility.js | 2 +- .../Core/Devtools/parseHermesStack.js | 2 +- .../Libraries/Core/ExceptionsManager.js | 4 +-- .../Libraries/Core/ExtendedError.js | 6 ++-- .../Core/__tests__/ExceptionsManager-test.js | 2 +- .../Libraries/Core/setUpDeveloperTools.js | 2 +- .../Libraries/Debugging/DebuggingOverlay.js | 4 +-- .../EventEmitter/NativeEventEmitter.js | 4 +-- .../__mocks__/NativeEventEmitter.js | 2 +- .../Libraries/Image/ImageSource.js | 2 +- .../Libraries/Image/ImageSourceUtils.js | 2 +- .../Image/ImageViewNativeComponent.js | 2 +- .../Image/TextInlineImageNativeComponent.js | 2 +- .../react-native/Libraries/Lists/FlatList.js | 2 +- .../Libraries/Lists/SectionList.js | 2 +- .../Libraries/Lists/SectionListModern.js | 2 +- .../Lists/__flowtests__/FlatList-flowtest.js | 4 +-- .../__flowtests__/SectionList-flowtest.js | 2 +- .../Libraries/LogBox/Data/LogBoxData.js | 6 ++-- .../LogBox/Data/__tests__/LogBoxLog-test.js | 4 +-- .../__tests__/LogBoxSymbolication-test.js | 2 +- .../Libraries/LogBox/Data/parseLogBoxLog.js | 10 +++---- .../react-native/Libraries/LogBox/LogBox.js | 6 ++-- .../LogBox/LogBoxInspectorContainer.js | 2 +- .../LogBox/LogBoxNotificationContainer.js | 2 +- .../Libraries/LogBox/UI/LogBoxInspector.js | 2 +- .../Libraries/LogBox/UI/LogBoxMessage.js | 2 +- .../react-native/Libraries/Modal/Modal.js | 2 +- .../__tests__/Pressability-test.js | 2 +- .../Libraries/ReactNative/AppRegistry.flow.js | 2 +- .../Libraries/ReactNative/AppRegistryImpl.js | 4 +-- .../Libraries/ReactNative/FabricUIManager.js | 2 +- .../ReactNative/UIManagerProperties.js | 2 +- .../Libraries/StyleSheet/StyleSheetTypes.js | 30 +++++++++---------- .../__tests__/processBackgroundImage-test.js | 22 +++++++------- .../StyleSheet/private/_TransformStyle.js | 4 +-- .../StyleSheet/processBackgroundImage.js | 14 ++++----- .../StyleSheet/processBackgroundPosition.js | 8 ++--- .../StyleSheet/processBackgroundRepeat.js | 8 ++--- .../StyleSheet/processBackgroundSize.js | 8 ++--- .../Libraries/StyleSheet/processBoxShadow.js | 2 +- .../Libraries/StyleSheet/processColorArray.js | 4 +-- .../Libraries/StyleSheet/processFilter.js | 4 +-- .../Libraries/Types/CodegenTypes.js | 2 +- .../Libraries/Types/CoreEventTypes.js | 6 ++-- .../Libraries/Utilities/HMRClient.js | 6 ++-- .../Utilities/__tests__/useRefEffect-test.js | 2 +- .../Utilities/codegenNativeCommands.js | 4 +-- .../Utilities/codegenNativeComponent.js | 2 +- .../Libraries/Utilities/logError.js | 2 +- .../Libraries/Utilities/useMergeRefs.js | 4 +-- .../Libraries/vendor/core/ErrorUtils.js | 8 ++--- .../Libraries/vendor/emitter/EventEmitter.js | 10 +++---- packages/react-native/flow/bom.js.flow | 28 ++++++++--------- packages/react-native/flow/dom.js.flow | 8 ++--- packages/react-native/flow/global.js | 2 +- .../utilities/accessibilityPropsSuite.js | 6 ++-- .../private/animated/NativeAnimatedHelper.js | 2 +- .../animated/createAnimatedPropsMemoHook.js | 12 ++++---- .../__tests__/VirtualView-itest.js | 2 +- ...ndroidSwipeRefreshLayoutNativeComponent.js | 2 +- .../DebuggingOverlayNativeComponent.js | 4 +-- .../RCTModalHostViewNativeComponent.js | 2 +- .../modules/NativeImageLoaderIOS.js | 2 +- .../src/private/styles/composeStyles.js | 2 +- .../src/private/webapis/dom/events/Event.js | 2 +- .../private/webapis/dom/events/EventTarget.js | 2 +- .../__tests__/EventTarget-benchmark-itest.js | 2 +- .../dom/events/__tests__/EventTarget-itest.js | 2 +- .../dom/events/internals/EventInternals.js | 4 +-- .../webapis/dom/nodes/ReadOnlyElement.js | 2 +- .../private/webapis/dom/nodes/ReadOnlyNode.js | 4 +-- .../webapis/dom/nodes/specs/NativeDOM.js | 16 +++++----- .../dom/oldstylecollections/HTMLCollection.js | 4 +-- .../HTMLCollection.js.flow | 2 +- .../dom/oldstylecollections/NodeList.js | 4 +-- .../dom/oldstylecollections/NodeList.js.flow | 2 +- .../private/webapis/geometry/DOMRectList.js | 4 +-- .../webapis/geometry/DOMRectList.js.flow | 2 +- .../IntersectionObserver.js | 16 +++++----- .../specs/NativeIntersectionObserver.js | 12 ++++---- .../mutationobserver/MutationObserver.js | 4 +-- .../mutationobserver/MutationRecord.js | 4 +-- .../__tests__/MutationObserver-itest.js | 4 +-- .../specs/NativeMutationObserver.js | 6 ++-- .../private/webapis/performance/LongTasks.js | 6 ++-- .../webapis/performance/Performance.js | 2 +- .../webapis/performance/PerformanceEntry.js | 2 +- .../performance/PerformanceObserver.js | 4 +-- .../performance/specs/NativePerformance.js | 16 +++++----- .../js/MyLegacyViewNativeComponent.js | 2 +- .../js/MyNativeViewNativeComponent.js | 20 ++++++------- .../js/components/RNTesterExampleFilter.js | 4 +-- .../PlatformTest/RNTesterPlatformTest.js | 2 +- .../RNTesterPlatformTestEventRecorder.js | 4 +-- .../RNTesterPlatformTestInstructions.js | 2 +- .../RNTesterPlatformTestResultView.js | 2 +- .../PlatformTest/RNTesterPlatformTestTypes.js | 2 +- .../PlatformTest/usePlatformTestHarness.js | 4 +-- .../PointerEventSupport.js | 2 +- .../js/examples/Image/ImageExample.js | 4 +-- .../IntersectionObserverClippingParent.js | 2 +- .../IntersectionObserverClippingRoot.js | 2 +- .../IntersectionObserverExplicitRoot.js | 2 +- .../Performance/PerformanceApiExample.js | 12 ++++---- .../RefreshControl/RefreshControlExample.js | 2 +- .../js/examples/Text/TextSharedExamples.js | 2 +- .../TextInput/TextInputSharedExamples.js | 6 ++-- packages/rn-tester/js/types/RNTesterTypes.js | 4 +-- .../virtualized-lists/Lists/CellRenderMask.js | 2 +- .../Lists/VirtualizedList.js | 4 +-- .../Lists/VirtualizedSectionList.js | 6 ++-- private/helloworld/lib/filesystem.js | 2 +- .../runner/executables/hermesc.js | 2 +- .../runner/executables/tester.js | 2 +- .../runner/getFantomTestConfigs.js | 2 +- private/react-native-fantom/runner/utils.js | 12 ++++---- private/react-native-fantom/src/Benchmark.js | 8 ++--- .../src/getFantomRenderedOutput.js | 8 ++--- .../js-api/build-types/buildApiSnapshot.js | 8 ++--- .../resolution/resolveTypeInputFile.js | 2 +- .../translatedModule.d.ts-template.js | 2 +- .../utils/applyBabelTransformsSeq.js | 2 +- .../utils/resolveCyclicImportsInDefinition.js | 2 +- 167 files changed, 416 insertions(+), 417 deletions(-) diff --git a/packages/react-native-codegen/src/parsers/parsers-primitives.js b/packages/react-native-codegen/src/parsers/parsers-primitives.js index 51340384b80..fb75f8abed7 100644 --- a/packages/react-native-codegen/src/parsers/parsers-primitives.js +++ b/packages/react-native-codegen/src/parsers/parsers-primitives.js @@ -435,8 +435,8 @@ function emitUnion( translateTypeAnnotation: $FlowFixMe, parser: Parser, ): Nullable { - const unparsedMemberTypes: $ReadOnlyArray<$FlowFixMe> = - (typeAnnotation.types: $ReadOnlyArray<$FlowFixMe>); + const unparsedMemberTypes: ReadonlyArray<$FlowFixMe> = + (typeAnnotation.types: ReadonlyArray<$FlowFixMe>); const memberTypes = unparsedMemberTypes.map( (memberType: $FlowFixMe): NativeModuleUnionTypeAnnotationMemberType => { diff --git a/packages/react-native-codegen/src/parsers/schema.js b/packages/react-native-codegen/src/parsers/schema.js index fab007d762a..2711c64684b 100644 --- a/packages/react-native-codegen/src/parsers/schema.js +++ b/packages/react-native-codegen/src/parsers/schema.js @@ -23,10 +23,10 @@ import type { export type ComponentSchemaBuilderConfig = Readonly<{ filename: string, componentName: string, - extendsProps: $ReadOnlyArray, - events: $ReadOnlyArray, - props: $ReadOnlyArray>, - commands: $ReadOnlyArray>, + extendsProps: ReadonlyArray, + events: ReadonlyArray, + props: ReadonlyArray>, + commands: ReadonlyArray>, options?: ?OptionsShape, }>; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/commands.js b/packages/react-native-codegen/src/parsers/typescript/components/commands.js index 2b039c1e89c..dc35f3304bb 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/commands.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/commands.js @@ -205,10 +205,10 @@ function buildCommandSchema( } function getCommands( - commandTypeAST: $ReadOnlyArray, + commandTypeAST: ReadonlyArray, types: TypeDeclarationMap, parser: Parser, -): $ReadOnlyArray> { +): ReadonlyArray> { return commandTypeAST .filter( property => diff --git a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js index d9319abee40..53259bb7e0f 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js @@ -476,10 +476,10 @@ function getSchemaInfo( } function flattenProperties( - typeDefinition: $ReadOnlyArray, + typeDefinition: ReadonlyArray, types: TypeDeclarationMap, parser: Parser, -): $ReadOnlyArray { +): ReadonlyArray { return typeDefinition .map(property => { if (property.type === 'TSPropertySignature') { diff --git a/packages/react-native-codegen/src/parsers/typescript/components/events.js b/packages/react-native-codegen/src/parsers/typescript/components/events.js index 9a97288a98f..faa4bc11c0a 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/events.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/events.js @@ -178,7 +178,7 @@ function findEventArgumentsAndType( bubblingType: void | 'direct' | 'bubble', paperName: ?$FlowFixMe, ): { - argumentProps: ?$ReadOnlyArray<$FlowFixMe>, + argumentProps: ?ReadonlyArray<$FlowFixMe>, paperTopLevelNameDeprecated: ?$FlowFixMe, bubblingType: ?'direct' | 'bubble', } { @@ -280,10 +280,10 @@ function buildEventSchema( } function getEvents( - eventTypeAST: $ReadOnlyArray, + eventTypeAST: ReadonlyArray, types: TypeDeclarationMap, parser: Parser, -): $ReadOnlyArray { +): ReadonlyArray { return eventTypeAST .map(property => buildEventSchema(types, property, parser)) .filter(Boolean); diff --git a/packages/react-native-codegen/src/parsers/typescript/components/extends.js b/packages/react-native-codegen/src/parsers/typescript/components/extends.js index b5065f425fd..571408f0129 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/extends.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/extends.js @@ -27,7 +27,7 @@ function isEvent(typeAnnotation: $FlowFixMe, parser: Parser): boolean { type PropsAST = Object; function categorizeProps( - typeDefinition: $ReadOnlyArray, + typeDefinition: ReadonlyArray, types: TypeDeclarationMap, events: Array, parser: Parser, 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 f454e4a8bdd..540f388168b 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 @@ -35,7 +35,7 @@ type PrimitiveTypeAnnotationType = | 'FloatTypeAnnotation' | 'BooleanTypeAnnotation'; -const PRIMITIVES: $ReadOnlyArray<[string, PrimitiveTypeAnnotationType]> = [ +const PRIMITIVES: ReadonlyArray<[string, PrimitiveTypeAnnotationType]> = [ ['string', 'StringTypeAnnotation'], ['number', 'NumberTypeAnnotation'], ['Int32', 'Int32TypeAnnotation'], @@ -44,9 +44,7 @@ const PRIMITIVES: $ReadOnlyArray<[string, PrimitiveTypeAnnotationType]> = [ ['boolean', 'BooleanTypeAnnotation'], ]; -const RESERVED_FUNCTION_VALUE_TYPE_NAME: $ReadOnlyArray<'RootTag'> = [ - 'RootTag', -]; +const RESERVED_FUNCTION_VALUE_TYPE_NAME: ReadonlyArray<'RootTag'> = ['RootTag']; const MODULE_NAME = 'NativeFoo'; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/index.js b/packages/react-native-codegen/src/parsers/typescript/modules/index.js index c1563f9139e..a5925aecef3 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/index.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/index.js @@ -57,9 +57,9 @@ function translateObjectTypeAnnotation( */ typeScriptTypeAnnotation: $FlowFixMe, nullable: boolean, - objectMembers: $ReadOnlyArray<$FlowFixMe>, + objectMembers: ReadonlyArray<$FlowFixMe>, typeResolutionStatus: TypeResolutionStatus, - baseTypes: $ReadOnlyArray, + baseTypes: ReadonlyArray, types: TypeDeclarationMap, aliasMap: {...NativeModuleAliasMap}, enumMap: {...NativeModuleEnumMap}, diff --git a/packages/react-native-codegen/src/parsers/typescript/parser.js b/packages/react-native-codegen/src/parsers/typescript/parser.js index 60416eb6a1b..b3f4d603b4d 100644 --- a/packages/react-native-codegen/src/parsers/typescript/parser.js +++ b/packages/react-native-codegen/src/parsers/typescript/parser.js @@ -157,7 +157,7 @@ class TypeScriptParser implements Parser { getFunctionTypeAnnotationParameters( functionTypeAnnotation: $FlowFixMe, - ): $ReadOnlyArray<$FlowFixMe> { + ): ReadonlyArray<$FlowFixMe> { return functionTypeAnnotation.parameters; } @@ -248,7 +248,7 @@ class TypeScriptParser implements Parser { parseEnumMembers( typeAnnotation: $FlowFixMe, - ): $ReadOnlyArray { + ): ReadonlyArray { return typeAnnotation.members.map(member => { const value = member.initializer?.operator === '-' @@ -385,7 +385,7 @@ class TypeScriptParser implements Parser { return annotatedElement.typeAnnotation.members; } - bodyProperties(typeAlias: TypeDeclarationMap): $ReadOnlyArray<$FlowFixMe> { + bodyProperties(typeAlias: TypeDeclarationMap): ReadonlyArray<$FlowFixMe> { return typeAlias.body.body; } @@ -516,11 +516,11 @@ class TypeScriptParser implements Parser { } getProps( - typeDefinition: $ReadOnlyArray, + typeDefinition: ReadonlyArray, types: TypeDeclarationMap, ): { - props: $ReadOnlyArray>, - extendsProps: $ReadOnlyArray, + props: ReadonlyArray>, + extendsProps: ReadonlyArray, } { const extendsProps: Array = []; const componentPropAsts: Array = []; diff --git a/packages/react-native-compatibility-check/src/ComparisonResult.js b/packages/react-native-compatibility-check/src/ComparisonResult.js index 281313ef08f..a6a296dcb15 100644 --- a/packages/react-native-compatibility-check/src/ComparisonResult.js +++ b/packages/react-native-compatibility-check/src/ComparisonResult.js @@ -81,8 +81,8 @@ export type FunctionComparisonResult = { // Array>> export type PropertiesComparisonResult = { - addedProperties?: $ReadOnlyArray>, - missingProperties?: $ReadOnlyArray>, + addedProperties?: ReadonlyArray>, + missingProperties?: ReadonlyArray>, errorProperties?: Array<{ property: string, fault?: TypeComparisonError, diff --git a/packages/react-native-compatibility-check/src/ErrorFormatting.js b/packages/react-native-compatibility-check/src/ErrorFormatting.js index 08760b29d67..6e0b6f2870e 100644 --- a/packages/react-native-compatibility-check/src/ErrorFormatting.js +++ b/packages/react-native-compatibility-check/src/ErrorFormatting.js @@ -210,7 +210,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { return ( '(' + // @lint-ignore-every FLOW_INCOMPATIBLE_TYPE_ARG - (annotation.types: $ReadOnlyArray) + (annotation.types: ReadonlyArray) .map(boolLit => formatTypeAnnotation(boolLit)) .join(' | ') + ')' @@ -226,7 +226,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { return ( '(' + // @lint-ignore-every FLOW_INCOMPATIBLE_TYPE_ARG - (annotation.types: $ReadOnlyArray) + (annotation.types: ReadonlyArray) .map(numLit => formatTypeAnnotation(numLit)) .join(' | ') + ')' @@ -244,7 +244,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { return ( '(' + // @lint-ignore-every FLOW_INCOMPATIBLE_TYPE_ARG - (annotation.types: $ReadOnlyArray) + (annotation.types: ReadonlyArray) .map(stringLit => formatTypeAnnotation(stringLit)) .join(' | ') + ')' @@ -335,7 +335,7 @@ export function formatDiffSet(summary: DiffSummary): FormattedDiffSummary { // nested errors formattedIncompat.incompatibleSpecs = incompat.incompatibleSpecs.reduce( ( - formattedModuleErrors: $ReadOnlyArray, + formattedModuleErrors: ReadonlyArray, specErrorStore, ) => formattedModuleErrors.concat( diff --git a/packages/react-native-compatibility-check/src/SortTypeAnnotations.js b/packages/react-native-compatibility-check/src/SortTypeAnnotations.js index 42562508834..537653ff967 100644 --- a/packages/react-native-compatibility-check/src/SortTypeAnnotations.js +++ b/packages/react-native-compatibility-check/src/SortTypeAnnotations.js @@ -13,7 +13,7 @@ import type {CompleteTypeAnnotation} from '@react-native/codegen/src/CodegenSche import invariant from 'invariant'; export function sortTypeAnnotations( - annotations: $ReadOnlyArray, + annotations: ReadonlyArray, ): Array<[number, CompleteTypeAnnotation]> { const sortableArray = annotations.map( (a, i): [number, CompleteTypeAnnotation] => [i, a], @@ -209,8 +209,8 @@ function compareNameAnnotationArraysForSorting( } function compareAnnotationArraysForSorting( - [originalPositionA, arrayA]: [number, $ReadOnlyArray], - [originalPositionB, arrayB]: [number, $ReadOnlyArray], + [originalPositionA, arrayA]: [number, ReadonlyArray], + [originalPositionB, arrayB]: [number, ReadonlyArray], ) { if (arrayA.length - arrayB.length !== 0) { return arrayA.length - arrayB.length; diff --git a/packages/react-native-compatibility-check/src/TypeDiffing.js b/packages/react-native-compatibility-check/src/TypeDiffing.js index 0f3b7ce4919..d808a6893b6 100644 --- a/packages/react-native-compatibility-check/src/TypeDiffing.js +++ b/packages/react-native-compatibility-check/src/TypeDiffing.js @@ -269,7 +269,8 @@ export function compareTypeAnnotation( ); return compareReservedTypeAnnotation(newerAnnotation, olderAnnotation); - default: // Flow exhaustiveness check + default: + // Flow exhaustiveness check (newerAnnotation: empty); throw new Error(`Unsupported type annotation: ${newerAnnotation.type}`); } @@ -449,8 +450,8 @@ function checkOptionalityChanges( } function comparePropertyArrays( - newerOriginal: $ReadOnlyArray>, - olderOriginal: $ReadOnlyArray>, + newerOriginal: ReadonlyArray>, + olderOriginal: ReadonlyArray>, ): PropertiesComparisonResult { const newer = newerOriginal.slice(0); const older = olderOriginal.slice(0); @@ -547,8 +548,8 @@ function comparePropertyArrays( } export function compareObjectTypes( - newerPropertyTypes: $ReadOnlyArray>, - olderPropertyTypes: $ReadOnlyArray>, + newerPropertyTypes: ReadonlyArray>, + olderPropertyTypes: ReadonlyArray>, ): ComparisonResult { if (newerPropertyTypes.length === 0 && olderPropertyTypes.length === 0) { return {status: 'matching'}; @@ -612,7 +613,7 @@ export function compareObjectTypes( } function objectTypeAnnotation( - properties: $ReadOnlyArray>, + properties: ReadonlyArray>, ): ObjectTypeAnnotation { return { type: 'ObjectTypeAnnotation', @@ -703,7 +704,8 @@ export function compareEnumDeclarationMemberArrays( case 'members': case 'unionMembers': break; - default: // Flow exhaustiveness check + default: + // Flow exhaustiveness check (comparedTypes: empty); throw new Error('Unsupported status ' + comparedTypes.status); } @@ -783,7 +785,8 @@ export function compareUnionMemberArrays( case 'members': case 'unionMembers': break; - default: // Flow exhaustiveness check + default: + // Flow exhaustiveness check (headComparison: empty); throw new Error('Unsupported status ' + headComparison.status); } @@ -1227,8 +1230,8 @@ type ArrayComparisonResult = function compareArrayOfTypes( fixedOrder: boolean, fixedLength: boolean, - newerTypes: $ReadOnlyArray, - olderTypes: $ReadOnlyArray, + newerTypes: ReadonlyArray, + olderTypes: ReadonlyArray, ): ArrayComparisonResult { const sameLength = newerTypes.length === olderTypes.length; if (fixedLength && !sameLength) { diff --git a/packages/react-native-compatibility-check/src/VersionDiffing.js b/packages/react-native-compatibility-check/src/VersionDiffing.js index 7230c6f1351..5a3405eabf7 100644 --- a/packages/react-native-compatibility-check/src/VersionDiffing.js +++ b/packages/react-native-compatibility-check/src/VersionDiffing.js @@ -198,7 +198,7 @@ function nestedPropertiesCheck( function checkOptionalityAndSetError( typeName: string, - properties: $ReadOnlyArray>, + properties: ReadonlyArray>, msg: string, errorCode: ErrorCode, ): Array { 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 f683d900a60..b5c9ab0208b 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 @@ -59,20 +59,20 @@ type NativeProps = Readonly<{ color: ColorValue, }>, - arrayStringUnion?: WithDefault<$ReadOnlyArray<'foo' | 'bar'>, 'foo'>, + arrayStringUnion?: WithDefault, 'foo'>, arrayStringUnionExtra?: WithDefault< - $ReadOnlyArray<'foo' | 'bar' | 'baz'>, + ReadonlyArray<'foo' | 'bar' | 'baz'>, 'bar', >, - arrayNestedObject: $ReadOnlyArray< + arrayNestedObject: ReadonlyArray< Readonly<{ string: string, color: ColorValue, }>, >, - arrayNestedObjectChange: $ReadOnlyArray< + arrayNestedObjectChange: ReadonlyArray< Readonly<{ string: boolean, color: ColorValue, 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 3db5c80ccf8..9c449f41376 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 @@ -16,7 +16,7 @@ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNati export type Props = Readonly<{ ...ViewProps, - sizes?: WithDefault<$ReadOnlyArray<'small' | 'large' | 'huge'>, 'small'>, + sizes?: WithDefault, 'small'>, }>; export default (codegenNativeComponent( 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 571f3ea77a7..ae34e13fa71 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 @@ -16,7 +16,7 @@ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNati export type Props = Readonly<{ ...ViewProps, - sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>, + sizes?: WithDefault, 'small'>, }>; export default (codegenNativeComponent( 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 464b632c78e..ccebd6ccd8f 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js @@ -32,7 +32,7 @@ export type PopupMenuAndroidInstance = { }; type Props = { - menuItems: $ReadOnlyArray, + menuItems: ReadonlyArray, onSelectionChange: number => void, onDismiss?: () => void, children: React.Node, diff --git a/packages/react-native-popup-menu-android/js/PopupMenuAndroid.js b/packages/react-native-popup-menu-android/js/PopupMenuAndroid.js index 65f196e009a..cdb973a4f44 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroid.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroid.js @@ -41,7 +41,7 @@ export type PopupMenuAndroidInstance = { }; type Props = { - menuItems: $ReadOnlyArray, + menuItems: ReadonlyArray, onSelectionChange: number => void, onDismiss?: () => void, children: Node, 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 67b642eda15..4d776ee7e3e 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js @@ -29,7 +29,7 @@ type NativeProps = Readonly<{ ...ViewProps, //Props - menuItems?: ?$ReadOnlyArray, + menuItems?: ?ReadonlyArray, onPopupMenuSelectionChange?: DirectEventHandler, onPopupMenuDismiss?: DirectEventHandler, diff --git a/packages/react-native/Libraries/Animated/AnimatedEvent.js b/packages/react-native/Libraries/Animated/AnimatedEvent.js index 3c80e253ae7..3f1245e3fd2 100644 --- a/packages/react-native/Libraries/Animated/AnimatedEvent.js +++ b/packages/react-native/Libraries/Animated/AnimatedEvent.js @@ -33,7 +33,7 @@ export type EventConfig = { export function attachNativeEventImpl( viewRef: any, eventName: string, - argMapping: $ReadOnlyArray, + argMapping: ReadonlyArray, platformConfig: ?PlatformConfig, ): {detach: () => void} { // Find animated values in `argMapping` and create an array representing their @@ -93,7 +93,7 @@ export function attachNativeEventImpl( }; } -function validateMapping(argMapping: $ReadOnlyArray, args: any) { +function validateMapping(argMapping: ReadonlyArray, args: any) { const validate = (recMapping: ?Mapping, recEvt: any, key: string) => { if (recMapping instanceof AnimatedValue) { invariant( @@ -146,13 +146,13 @@ function validateMapping(argMapping: $ReadOnlyArray, args: any) { } export class AnimatedEvent { - _argMapping: $ReadOnlyArray; + _argMapping: ReadonlyArray; _listeners: Array = []; _attachedEvent: ?{detach: () => void, ...}; __isNative: boolean; __platformConfig: ?PlatformConfig; - constructor(argMapping: $ReadOnlyArray, config: EventConfig) { + constructor(argMapping: ReadonlyArray, config: EventConfig) { this._argMapping = argMapping; if (config == null) { diff --git a/packages/react-native/Libraries/Animated/AnimatedImplementation.js b/packages/react-native/Libraries/Animated/AnimatedImplementation.js index fa51e5ea1fd..740ac6d4708 100644 --- a/packages/react-native/Libraries/Animated/AnimatedImplementation.js +++ b/packages/react-native/Libraries/Animated/AnimatedImplementation.js @@ -543,7 +543,7 @@ function unforkEventImpl( } const eventImpl = function ( - argMapping: $ReadOnlyArray, + argMapping: ReadonlyArray, config: EventConfig, ): any { const animatedEvent = new AnimatedEvent(argMapping, config); diff --git a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js index 96946862b21..f872d098bdf 100644 --- a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js @@ -82,7 +82,7 @@ export default class TimingAnimation extends Animation { __getNativeAnimationConfig(): Readonly<{ type: 'frames', - frames: $ReadOnlyArray, + frames: ReadonlyArray, toValue: number, iterations: number, platformConfig: ?PlatformConfig, diff --git a/packages/react-native/Libraries/Animated/createAnimatedComponent.js b/packages/react-native/Libraries/Animated/createAnimatedComponent.js index 470e745d5af..d8fcb31bd63 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -29,7 +29,7 @@ import {useMemo} from 'react'; type Nullable = void | null; type Primitive = string | number | boolean | symbol | void; -type Builtin = (...$ReadOnlyArray) => unknown | Date | Error | RegExp; +type Builtin = (...ReadonlyArray) => unknown | Date | Error | RegExp; export type WithAnimatedValue<+T> = T extends Builtin | Nullable ? T @@ -48,8 +48,8 @@ export type WithAnimatedValue<+T> = T extends Builtin | Nullable | AnimatedInterpolation | AnimatedInterpolation | AnimatedInterpolation - : T extends $ReadOnlyArray - ? $ReadOnlyArray> + : T extends ReadonlyArray + ? ReadonlyArray> : T extends {...} ? {+[K in keyof T]: WithAnimatedValue} : T; diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js index aa3d9c3edca..f5b36eea5ba 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -36,8 +36,8 @@ export type InterpolationConfigType< OutputT: InterpolationConfigSupportedOutputType, > = Readonly<{ ...AnimatedNodeConfig, - inputRange: $ReadOnlyArray, - outputRange: $ReadOnlyArray, + inputRange: ReadonlyArray, + outputRange: ReadonlyArray, easing?: (input: number) => number, extrapolate?: ExtrapolateType, extrapolateLeft?: ExtrapolateType, @@ -51,7 +51,7 @@ export type InterpolationConfigType< function createNumericInterpolation( config: InterpolationConfigType, ): (input: number) => number { - const outputRange: $ReadOnlyArray = (config.outputRange: any); + const outputRange: ReadonlyArray = (config.outputRange: any); const inputRange = config.inputRange; const easing = config.easing || Easing.linear; @@ -187,7 +187,7 @@ function mapStringToNumericComponents( input: string, ): | {isColor: true, components: [number, number, number, number]} - | {isColor: false, components: $ReadOnlyArray} { + | {isColor: false, components: ReadonlyArray} { let normalizedColor = normalizeColor(input); invariant( normalizedColor == null || typeof normalizedColor !== 'object', @@ -262,7 +262,7 @@ function createStringInterpolation( ); } - const numericComponents: $ReadOnlyArray<$ReadOnlyArray> = + const numericComponents: ReadonlyArray> = outputRange.map(output => isColor ? // $FlowFixMe[incompatible-type] @@ -297,7 +297,7 @@ function createStringInterpolation( } } -function findRange(input: number, inputRange: $ReadOnlyArray) { +function findRange(input: number, inputRange: ReadonlyArray) { let i; for (i = 1; i < inputRange.length - 1; ++i) { if (inputRange[i] >= input) { @@ -308,8 +308,8 @@ function findRange(input: number, inputRange: $ReadOnlyArray) { } function checkValidRanges( - inputRange: $ReadOnlyArray, - outputRange: $ReadOnlyArray, + inputRange: ReadonlyArray, + outputRange: ReadonlyArray, ) { checkInfiniteRange('outputRange', outputRange); checkInfiniteRange('inputRange', inputRange); @@ -325,7 +325,7 @@ function checkValidRanges( ); } -function checkValidInputRange(arr: $ReadOnlyArray) { +function checkValidInputRange(arr: ReadonlyArray) { invariant(arr.length >= 2, 'inputRange must have at least 2 elements'); const message = 'inputRange must be monotonically non-decreasing ' + String(arr); @@ -336,7 +336,7 @@ function checkValidInputRange(arr: $ReadOnlyArray) { function checkInfiniteRange( name: string, - arr: $ReadOnlyArray, + arr: ReadonlyArray, ) { invariant(arr.length >= 2, name + ' must have at least 2 elements'); invariant( @@ -428,7 +428,7 @@ export default class AnimatedInterpolation< let outputType = null; if (typeof outputRange[0] === 'string') { // $FlowFixMe[incompatible-type] - outputRange = ((outputRange: $ReadOnlyArray).map(value => { + outputRange = ((outputRange: ReadonlyArray).map(value => { const processedColor = processColor(value); if (typeof processedColor === 'number') { outputType = 'color'; diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js index fa1d59b3b7a..b10fe9da8be 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js @@ -61,7 +61,7 @@ export default class AnimatedNode { } __addChild(child: AnimatedNode) {} __removeChild(child: AnimatedNode) {} - __getChildren(): $ReadOnlyArray { + __getChildren(): ReadonlyArray { return []; } diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js index 0064816bf36..8f1793ec047 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js @@ -87,7 +87,7 @@ function mapAnimatedNodes(value: any, fn: any => any, depth: number = 0): any { } export default class AnimatedObject extends AnimatedWithChildren { - _nodes: $ReadOnlyArray; + _nodes: ReadonlyArray; _value: unknown; /** @@ -106,7 +106,7 @@ export default class AnimatedObject extends AnimatedWithChildren { * Should only be called by `AnimatedObject.from`. */ constructor( - nodes: $ReadOnlyArray, + nodes: ReadonlyArray, value: unknown, config?: ?AnimatedNodeConfig, ) { diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js index 6c63964b7c6..e053d91635a 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js @@ -38,7 +38,7 @@ type TargetViewInstance = React.ElementRef; function createAnimatedProps( inputProps: {[string]: unknown}, allowlist: ?AnimatedPropsAllowlist, -): [$ReadOnlyArray, $ReadOnlyArray, {[string]: unknown}] { +): [ReadonlyArray, ReadonlyArray, {[string]: unknown}] { const nodeKeys: Array = []; const nodes: Array = []; const props: {[string]: unknown} = {}; @@ -96,8 +96,8 @@ function createAnimatedProps( export default class AnimatedProps extends AnimatedNode { _callback: () => void; - _nodeKeys: $ReadOnlyArray; - _nodes: $ReadOnlyArray; + _nodeKeys: ReadonlyArray; + _nodes: ReadonlyArray; _props: {[string]: unknown}; _target: ?TargetView = null; _rootTag: ?RootTag = undefined; @@ -179,7 +179,7 @@ export default class AnimatedProps extends AnimatedNode { return props; } - __getNativeAnimatedEventTuples(): $ReadOnlyArray<[string, AnimatedEvent]> { + __getNativeAnimatedEventTuples(): ReadonlyArray<[string, AnimatedEvent]> { const tuples = []; const keys = Object.keys(this._props); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js index a5a9c3887a7..54160fcc367 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js @@ -28,7 +28,7 @@ function createAnimatedStyle( flatStyle: FlatStyle, allowlist: ?AnimatedStyleAllowlist, keepUnanimatedValues: boolean, -): [$ReadOnlyArray, $ReadOnlyArray, {[string]: unknown}] { +): [ReadonlyArray, ReadonlyArray, {[string]: unknown}] { const nodeKeys: Array = []; const nodes: Array = []; const style: {[string]: unknown} = {}; @@ -83,8 +83,8 @@ function createAnimatedStyle( export default class AnimatedStyle extends AnimatedWithChildren { _originalStyleForWeb: ?unknown; - _nodeKeys: $ReadOnlyArray; - _nodes: $ReadOnlyArray; + _nodeKeys: ReadonlyArray; + _nodes: ReadonlyArray; _style: {[string]: unknown}; /** @@ -113,8 +113,8 @@ export default class AnimatedStyle extends AnimatedWithChildren { } constructor( - nodeKeys: $ReadOnlyArray, - nodes: $ReadOnlyArray, + nodeKeys: ReadonlyArray, + nodes: ReadonlyArray, style: {[string]: unknown}, originalStyleForWeb: ?unknown, config?: ?AnimatedNodeConfig, diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js b/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js index 10ee5b1ced5..86900cc17f8 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js @@ -23,12 +23,12 @@ type Transform = { | number | string | T - | $ReadOnlyArray + | ReadonlyArray | {[string]: number | string | T}, }; function flatAnimatedNodes( - transforms: $ReadOnlyArray>, + transforms: ReadonlyArray>, ): Array { const nodes = []; for (let ii = 0, length = transforms.length; ii < length; ii++) { @@ -47,15 +47,15 @@ function flatAnimatedNodes( export default class AnimatedTransform extends AnimatedWithChildren { // NOTE: For potentially historical reasons, some operations only operate on // the first level of AnimatedNode instances. This optimizes that bevavior. - _nodes: $ReadOnlyArray; + _nodes: ReadonlyArray; - _transforms: $ReadOnlyArray>; + _transforms: ReadonlyArray>; /** * Creates an `AnimatedTransform` if `transforms` contains `AnimatedNode` * instances. Otherwise, returns `null`. */ - static from(transforms: $ReadOnlyArray>): ?AnimatedTransform { + static from(transforms: ReadonlyArray>): ?AnimatedTransform { const nodes = flatAnimatedNodes( // NOTE: This check should not be necessary, but the types are not // enforced as of this writing. This check should be hoisted to @@ -69,8 +69,8 @@ export default class AnimatedTransform extends AnimatedWithChildren { } constructor( - nodes: $ReadOnlyArray, - transforms: $ReadOnlyArray>, + nodes: ReadonlyArray, + transforms: ReadonlyArray>, config?: ?AnimatedNodeConfig, ) { super(config); @@ -87,15 +87,15 @@ export default class AnimatedTransform extends AnimatedWithChildren { super.__makeNative(platformConfig); } - __getValue(): $ReadOnlyArray> { + __getValue(): ReadonlyArray> { return mapTransforms(this._transforms, animatedNode => animatedNode.__getValue(), ); } __getValueWithStaticTransforms( - staticTransforms: $ReadOnlyArray, - ): $ReadOnlyArray { + staticTransforms: ReadonlyArray, + ): ReadonlyArray { const values = []; mapTransforms(this._transforms, node => { values.push(node.__getValue()); @@ -105,7 +105,7 @@ export default class AnimatedTransform extends AnimatedWithChildren { return mapTransforms(staticTransforms, () => values.shift()); } - __getAnimatedValue(): $ReadOnlyArray> { + __getAnimatedValue(): ReadonlyArray> { return mapTransforms(this._transforms, animatedNode => animatedNode.__getAnimatedValue(), ); @@ -169,9 +169,9 @@ export default class AnimatedTransform extends AnimatedWithChildren { } function mapTransforms( - transforms: $ReadOnlyArray>, + transforms: ReadonlyArray>, mapFunction: AnimatedNode => T, -): $ReadOnlyArray> { +): ReadonlyArray> { return transforms.map(transform => { const result: Transform = {}; // There should be exactly one property in `transform`. diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js b/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js index 9d4469e33c4..2e0a0311200 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js @@ -65,7 +65,7 @@ export default class AnimatedWithChildren extends AnimatedNode { } } - __getChildren(): $ReadOnlyArray { + __getChildren(): ReadonlyArray { return this._children; } diff --git a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js index 4f18c0686c2..b177b30c1c1 100644 --- a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js +++ b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js @@ -52,7 +52,7 @@ class MessageQueue { _debugInfo: {[number]: [number, number], ...}; _remoteModuleTable: {[number]: string, ...}; - _remoteMethodTable: {[number]: $ReadOnlyArray, ...}; + _remoteMethodTable: {[number]: ReadonlyArray, ...}; __spy: ?(data: SpyData) => void; @@ -347,7 +347,7 @@ class MessageQueue { createDebugLookup( moduleID: number, name: string, - methods: ?$ReadOnlyArray, + methods: ?ReadonlyArray, ) { if (__DEV__) { this._remoteModuleTable[moduleID] = name; diff --git a/packages/react-native/Libraries/BatchedBridge/NativeModules.js b/packages/react-native/Libraries/BatchedBridge/NativeModules.js index 876d5ed1f14..95f1339d8ce 100644 --- a/packages/react-native/Libraries/BatchedBridge/NativeModules.js +++ b/packages/react-native/Libraries/BatchedBridge/NativeModules.js @@ -18,9 +18,9 @@ const invariant = require('invariant'); export type ModuleConfig = [ string /* name */, ?{...} /* constants */, - ?$ReadOnlyArray /* functions */, - ?$ReadOnlyArray /* promise method IDs */, - ?$ReadOnlyArray /* sync method IDs */, + ?ReadonlyArray /* functions */, + ?ReadonlyArray /* promise method IDs */, + ?ReadonlyArray /* sync method IDs */, ]; export type MethodType = 'async' | 'promise' | 'sync'; @@ -165,7 +165,7 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { return fn; } -function arrayContains(array: $ReadOnlyArray, value: T): boolean { +function arrayContains(array: ReadonlyArray, value: T): boolean { return array.indexOf(value) !== -1; } diff --git a/packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js b/packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js index 92b6b07beb2..c54a3dfadd1 100644 --- a/packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +++ b/packages/react-native/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js @@ -12,7 +12,7 @@ import type {ModuleConfig} from '../NativeModules'; -const remoteModulesConfig: $ReadOnlyArray = [ +const remoteModulesConfig: ReadonlyArray = [ [ 'RemoteModule1', null, diff --git a/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-test.js b/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-test.js index d6512f107a4..196c788fb70 100644 --- a/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-test.js +++ b/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-test.js @@ -23,7 +23,7 @@ const assertQueue = ( index: number, moduleID: number, methodID: number, - params: $ReadOnlyArray, + params: ReadonlyArray, ) => { if (flushedQueue == null) { throw new Error('Expected `flushedQueue` to be non-null'); diff --git a/packages/react-native/Libraries/BatchedBridge/__tests__/NativeModules-test.js b/packages/react-native/Libraries/BatchedBridge/__tests__/NativeModules-test.js index ea18bf1fe1e..ce4f651655c 100644 --- a/packages/react-native/Libraries/BatchedBridge/__tests__/NativeModules-test.js +++ b/packages/react-native/Libraries/BatchedBridge/__tests__/NativeModules-test.js @@ -25,7 +25,7 @@ const assertQueue = ( index: number, moduleID: number, methodID: number, - params: $ReadOnlyArray, + params: ReadonlyArray, ) => { if (flushedQueue == null) { throw new Error('Expected `flushedQueue` to be non-null'); diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 71c947adf4d..8e02c93af10 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -147,7 +147,7 @@ export type ButtonProps = Readonly<{ * Accessibility props. */ accessible?: ?boolean, - accessibilityActions?: ?$ReadOnlyArray, + accessibilityActions?: ?ReadonlyArray, onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown, accessibilityState?: ?AccessibilityState, diff --git a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js index 53b5231bc7f..5ce30f3002d 100644 --- a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js +++ b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js @@ -44,7 +44,7 @@ export type RefreshControlPropsAndroid = Readonly<{ /** * The colors (at least one) that will be used to draw the refresh indicator. */ - colors?: ?$ReadOnlyArray, + colors?: ?ReadonlyArray, /** * The background color of the refresh indicator. */ diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index d247ac706d2..53ff2d3d5b0 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -591,7 +591,7 @@ type ScrollViewBaseProps = Readonly<{ * top of the scroll view. This property is not supported in conjunction * with `horizontal={true}`. */ - stickyHeaderIndices?: ?$ReadOnlyArray, + stickyHeaderIndices?: ?ReadonlyArray, /** * A React Component that will be used to render sticky headers. * To be used together with `stickyHeaderIndices` or with `SectionList`, defaults to `ScrollViewStickyHeader`. @@ -625,7 +625,7 @@ type ScrollViewBaseProps = Readonly<{ * * Overrides less configurable `pagingEnabled` and `snapToInterval` props. */ - snapToOffsets?: ?$ReadOnlyArray, + snapToOffsets?: ?ReadonlyArray, /** * Use in conjunction with `snapToOffsets`. By default, the beginning * of the list counts as a snap offset. Set `snapToStart` to false to disable diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js index 05a2eb18690..e02f988f403 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js @@ -75,7 +75,7 @@ export type ScrollViewNativeProps = Readonly<{ snapToAlignment?: ?('start' | 'center' | 'end'), snapToEnd?: ?boolean, snapToInterval?: ?number, - snapToOffsets?: ?$ReadOnlyArray, + snapToOffsets?: ?ReadonlyArray, snapToStart?: ?boolean, zoomScale?: ?number, // Overrides diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index 27063a5dd9d..665a21250d4 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -306,7 +306,7 @@ export type TextInputIOSProps = Readonly<{ */ dataDetectorTypes?: | ?DataDetectorTypesType - | $ReadOnlyArray, + | ReadonlyArray, /** * If `true`, the keyboard disables the return key when there is no text and @@ -531,7 +531,7 @@ type TextInputBaseProps = Readonly<{ * * @see https://developer.android.com/reference/android/content/ClipData for more information on MIME types */ - experimental_acceptDragAndDropTypes?: ?$ReadOnlyArray, + experimental_acceptDragAndDropTypes?: ?ReadonlyArray, /** * Can tell `TextInput` to automatically capitalize certain characters. diff --git a/packages/react-native/Libraries/Components/Touchable/PooledClass.js b/packages/react-native/Libraries/Components/Touchable/PooledClass.js index 18289bc8d4f..399019b8a56 100644 --- a/packages/react-native/Libraries/Components/Touchable/PooledClass.js +++ b/packages/react-native/Libraries/Components/Touchable/PooledClass.js @@ -105,7 +105,7 @@ const addPoolingTo = function ( pooler: Pooler, ): Class & { getPooled( - ...args: $ReadOnlyArray + ...args: ReadonlyArray ): /* arguments of the constructor */ T, release(instance: unknown): void, ... diff --git a/packages/react-native/Libraries/Components/Touchable/Touchable.js b/packages/react-native/Libraries/Components/Touchable/Touchable.js index 0ca8eea0f8d..3428109bb23 100644 --- a/packages/react-native/Libraries/Components/Touchable/Touchable.js +++ b/packages/react-native/Libraries/Components/Touchable/Touchable.js @@ -25,7 +25,7 @@ import Position from './Position'; import * as React from 'react'; const extractSingleTouch = (nativeEvent: { - +changedTouches: $ReadOnlyArray, + +changedTouches: ReadonlyArray, +force?: number, +identifier: number, +locationX: number, @@ -34,7 +34,7 @@ const extractSingleTouch = (nativeEvent: { +pageY: number, +target: ?number, +timestamp: number, - +touches: $ReadOnlyArray, + +touches: ReadonlyArray, }) => { const touches = nativeEvent.touches; const changedTouches = nativeEvent.changedTouches; diff --git a/packages/react-native/Libraries/Components/View/ViewAccessibility.js b/packages/react-native/Libraries/Components/View/ViewAccessibility.js index 3c99c03925e..59dd449ac2b 100644 --- a/packages/react-native/Libraries/Components/View/ViewAccessibility.js +++ b/packages/react-native/Libraries/Components/View/ViewAccessibility.js @@ -403,7 +403,7 @@ export type AccessibilityProps = Readonly<{ * Provides an array of custom actions available for accessibility. * */ - accessibilityActions?: ?$ReadOnlyArray, + accessibilityActions?: ?ReadonlyArray, /** * alias for accessibilityState diff --git a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js b/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js index b89ba3102d5..21357bbcc76 100644 --- a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js +++ b/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js @@ -56,7 +56,7 @@ type HermesStackEntry = HermesStackEntryFrame | HermesStackEntrySkipped; export type HermesParsedStack = Readonly<{ message: string, - entries: $ReadOnlyArray, + entries: ReadonlyArray, }>; // Capturing groups: diff --git a/packages/react-native/Libraries/Core/ExceptionsManager.js b/packages/react-native/Libraries/Core/ExceptionsManager.js index 93464f492b1..3efa552449e 100644 --- a/packages/react-native/Libraries/Core/ExceptionsManager.js +++ b/packages/react-native/Libraries/Core/ExceptionsManager.js @@ -135,8 +135,8 @@ function reportException( } declare var console: { - error: (...data: $ReadOnlyArray) => void, - _errorOriginal: (...data: $ReadOnlyArray) => void, + error: (...data: ReadonlyArray) => void, + _errorOriginal: (...data: ReadonlyArray) => void, reportErrorsAsExceptions: boolean, ... }; diff --git a/packages/react-native/Libraries/Core/ExtendedError.js b/packages/react-native/Libraries/Core/ExtendedError.js index 7ce700eb119..4a76a276374 100644 --- a/packages/react-native/Libraries/Core/ExtendedError.js +++ b/packages/react-native/Libraries/Core/ExtendedError.js @@ -24,10 +24,10 @@ export type ExtendedError = Error & name: string, message: string, // $FlowFixMe[unclear-type] - stackElements?: $ReadOnlyArray, + stackElements?: ReadonlyArray, // $FlowFixMe[unclear-type] - stackSymbols?: $ReadOnlyArray, + stackSymbols?: ReadonlyArray, // $FlowFixMe[unclear-type] - stackReturnAddresses?: $ReadOnlyArray, + stackReturnAddresses?: ReadonlyArray, }, }; diff --git a/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js b/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js index 327acd87aff..681cb11a6c7 100644 --- a/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js +++ b/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js @@ -1076,7 +1076,7 @@ function runExceptionsManagerTests() { }); }); } -const linesByFile = new Map>(); +const linesByFile = new Map>(); function getLineFromFrame({lineNumber /* 1-based */, file}: $FlowFixMe) { if (file == null) { diff --git a/packages/react-native/Libraries/Core/setUpDeveloperTools.js b/packages/react-native/Libraries/Core/setUpDeveloperTools.js index 7b138a9c344..3b368000348 100644 --- a/packages/react-native/Libraries/Core/setUpDeveloperTools.js +++ b/packages/react-native/Libraries/Core/setUpDeveloperTools.js @@ -37,7 +37,7 @@ if (__DEV__) { ] as const ).forEach(level => { const originalFunction = console[level]; - console[level] = function (...args: $ReadOnlyArray) { + console[level] = function (...args: ReadonlyArray) { HMRClient.log(level, args); originalFunction.apply(console, args); }; diff --git a/packages/react-native/Libraries/Debugging/DebuggingOverlay.js b/packages/react-native/Libraries/Debugging/DebuggingOverlay.js index 30281bf6958..a66876579c1 100644 --- a/packages/react-native/Libraries/Debugging/DebuggingOverlay.js +++ b/packages/react-native/Libraries/Debugging/DebuggingOverlay.js @@ -26,8 +26,8 @@ const isNativeComponentReady = UIManager.hasViewManagerConfig('DebuggingOverlay'); type DebuggingOverlayHandle = { - highlightTraceUpdates(updates: $ReadOnlyArray): void, - highlightElements(elements: $ReadOnlyArray): void, + highlightTraceUpdates(updates: ReadonlyArray): void, + highlightElements(elements: ReadonlyArray): void, clearElementsHighlight(): void, }; diff --git a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js index 5a996da4f31..9e798c90d95 100644 --- a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js @@ -46,8 +46,8 @@ type UnsafeNativeEventObject = Object; */ export default class NativeEventEmitter< TEventToArgsMap: Readonly< - Record>, - > = Readonly>>, + Record>, + > = Readonly>>, > implements IEventEmitter { _nativeModule: ?NativeModule; diff --git a/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js index 9bfe9ee44e7..e978329bd38 100644 --- a/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js @@ -19,7 +19,7 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter'; * Mock `NativeEventEmitter` to ignore Native Modules. */ export default class NativeEventEmitter< - TEventToArgsMap: Readonly>>, + TEventToArgsMap: Readonly>>, > implements IEventEmitter { addListener>( diff --git a/packages/react-native/Libraries/Image/ImageSource.js b/packages/react-native/Libraries/Image/ImageSource.js index 12df755a0dc..89e79245e54 100644 --- a/packages/react-native/Libraries/Image/ImageSource.js +++ b/packages/react-native/Libraries/Image/ImageSource.js @@ -87,7 +87,7 @@ export type ImageRequireSource = number; export type ImageSource = | ImageRequireSource | ImageURISource - | $ReadOnlyArray; + | ReadonlyArray; type ImageSourceProperties = { body?: ?string, diff --git a/packages/react-native/Libraries/Image/ImageSourceUtils.js b/packages/react-native/Libraries/Image/ImageSourceUtils.js index b9e2d63e0cd..8db169ebba5 100644 --- a/packages/react-native/Libraries/Image/ImageSourceUtils.js +++ b/packages/react-native/Libraries/Image/ImageSourceUtils.js @@ -27,7 +27,7 @@ export function getImageSourcesFromImageProps( imageProps: ImageProps, ): | ?ResolvedAssetSource - | $ReadOnlyArray<{uri: string, headers: ImageSourceHeaders, ...}> { + | ReadonlyArray<{uri: string, headers: ImageSourceHeaders, ...}> { let source = resolveAssetSource(imageProps.source); let sources; diff --git a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js index f5236d2101c..d1572c5de53 100644 --- a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js +++ b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js @@ -37,7 +37,7 @@ type ImageHostComponentProps = Readonly<{ // Android native props shouldNotifyLoadEvents?: boolean, - src?: ?ResolvedAssetSource | ?$ReadOnlyArray>, + src?: ?ResolvedAssetSource | ?ReadonlyArray>, headers?: ?{[string]: string}, defaultSource?: ?ImageSource | ?string, loadingIndicatorSrc?: ?string, diff --git a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js b/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js index 9f4f62beb0b..48ee4a554b4 100644 --- a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js +++ b/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js @@ -21,7 +21,7 @@ import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegi type RCTTextInlineImageNativeProps = Readonly<{ ...ViewProps, resizeMode?: ?ImageResizeMode, - src?: ?$ReadOnlyArray>, + src?: ?ReadonlyArray>, tintColor?: ?ColorValue, headers?: ?{[string]: string}, }>; diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index 44257b7c91b..721f0539947 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -519,7 +519,7 @@ class FlatList extends React.PureComponent> { _getItem = ( data: $ArrayLike, index: number, - ): ?(ItemT | $ReadOnlyArray) => { + ): ?(ItemT | ReadonlyArray) => { const numColumns = numColumnsOrDefault(this.props.numColumns); if (numColumns > 1) { const ret = []; diff --git a/packages/react-native/Libraries/Lists/SectionList.js b/packages/react-native/Libraries/Lists/SectionList.js index 55ddc5d15ec..0f1193b9c59 100644 --- a/packages/react-native/Libraries/Lists/SectionList.js +++ b/packages/react-native/Libraries/Lists/SectionList.js @@ -51,7 +51,7 @@ type RequiredSectionListProps = { * ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>, * }> */ - sections: $ReadOnlyArray>, + sections: ReadonlyArray>, }; export type SectionListRenderItemInfo = { diff --git a/packages/react-native/Libraries/Lists/SectionListModern.js b/packages/react-native/Libraries/Lists/SectionListModern.js index 01de31a98f5..2661a31bc32 100644 --- a/packages/react-native/Libraries/Lists/SectionListModern.js +++ b/packages/react-native/Libraries/Lists/SectionListModern.js @@ -46,7 +46,7 @@ type RequiredProps = { * ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>, * }> */ - sections: $ReadOnlyArray>, + sections: ReadonlyArray>, }; type OptionalProps = { diff --git a/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js b/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js index 9a7efd0e236..3c292911bae 100644 --- a/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js +++ b/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js @@ -72,7 +72,7 @@ export function testGoodDataWithBadCustomRenderItemFunction(): React.Node { ); } -export function testBadRenderItemFunction(): $ReadOnlyArray { +export function testBadRenderItemFunction(): ReadonlyArray { const data = [ { title: 'foo', @@ -106,7 +106,7 @@ export function testBadRenderItemFunction(): $ReadOnlyArray { ]; } -export function testOtherBadProps(): $ReadOnlyArray { +export function testOtherBadProps(): ReadonlyArray { return [ // $FlowExpectedError[incompatible-type] - bad numColumns type "lots" , diff --git a/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js b/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js index 6d8424f914b..9f5a7efd200 100644 --- a/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js +++ b/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js @@ -41,7 +41,7 @@ export function testGoodDataWithGoodItem(): React.Node { return ; } -export function testBadRenderItemFunction(): $ReadOnlyArray { +export function testBadRenderItemFunction(): ReadonlyArray { const sections = [ { key: 'a', diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js index 277a989a765..6d1f5cc7916 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js @@ -351,12 +351,12 @@ export function checkWarningFilter(format: string): WarningInfo { return warningFilter(format); } -export function getIgnorePatterns(): $ReadOnlyArray { +export function getIgnorePatterns(): ReadonlyArray { return Array.from(ignorePatterns); } export function addIgnorePatterns( - patterns: $ReadOnlyArray, + patterns: ReadonlyArray, ): void { const existingSize = ignorePatterns.size; // The same pattern may be added multiple times, but adding a new pattern @@ -438,7 +438,7 @@ type LogBoxStateSubscriptionState = Readonly<{ type SubscribedComponent = React.ComponentType< Readonly<{ - logs: $ReadOnlyArray, + logs: ReadonlyArray, isDisabled: boolean, selectedLogIndex: number, }>, diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js index 42a3a3a67ec..89fdd7d3607 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js @@ -78,7 +78,7 @@ function getLogBoxLog() { function getLogBoxSymbolication(): { symbolicate: JestMockFn< - $ReadOnlyArray>, + ReadonlyArray>, Promise, >, } { @@ -113,7 +113,7 @@ const createComponentStack = (methodNames: Array) => })); function mockSymbolicate( - stack: $ReadOnlyArray, + stack: ReadonlyArray, stackCodeFrame: ?CodeCodeFrame, componentCodeFrame: ?CodeCodeFrame, ): SymbolicatedStackTrace { diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js index e3af5f85145..7a348e45956 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js @@ -18,7 +18,7 @@ const LogBoxSymbolication = require('../LogBoxSymbolication'); jest.mock('../../../Core/Devtools/symbolicateStackTrace'); const symbolicateStackTrace: JestMockFn< - $ReadOnlyArray>, + ReadonlyArray>, Promise, > = (require('../../../Core/Devtools/symbolicateStackTrace').default: any); diff --git a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js index 2d8e7f54627..31a47205eba 100644 --- a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js +++ b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js @@ -93,7 +93,7 @@ const RE_BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp( 'm', ); -export function hasComponentStack(args: $ReadOnlyArray): boolean { +export function hasComponentStack(args: ReadonlyArray): boolean { for (const arg of args) { if (typeof arg === 'string' && isComponentStack(arg)) { return true; @@ -123,7 +123,7 @@ export type CodeFrame = Readonly<{ }>; export type Message = Readonly<{ content: string, - substitutions: $ReadOnlyArray< + substitutions: ReadonlyArray< Readonly<{ length: number, offset: number, @@ -131,12 +131,12 @@ export type Message = Readonly<{ >, }>; -export type ComponentStack = $ReadOnlyArray; +export type ComponentStack = ReadonlyArray; export type ComponentStackType = 'legacy' | 'stack'; const SUBSTITUTION = UTFSequence.BOM + '%s'; -export function parseInterpolation(args: $ReadOnlyArray): Readonly<{ +export function parseInterpolation(args: ReadonlyArray): Readonly<{ category: Category, message: Message, }> { @@ -456,7 +456,7 @@ export function withoutANSIColorStyles(message: unknown): unknown { ); } -export function parseLogBoxLog(args: $ReadOnlyArray): { +export function parseLogBoxLog(args: ReadonlyArray): { componentStack: ComponentStack, componentStackType: ComponentStackType, category: Category, diff --git a/packages/react-native/Libraries/LogBox/LogBox.js b/packages/react-native/Libraries/LogBox/LogBox.js index 96ff3ad64b8..176cfc7bde4 100644 --- a/packages/react-native/Libraries/LogBox/LogBox.js +++ b/packages/react-native/Libraries/LogBox/LogBox.js @@ -24,7 +24,7 @@ interface ILogBox { install(): void; uninstall(): void; isInstalled(): boolean; - ignoreLogs($ReadOnlyArray): void; + ignoreLogs(ReadonlyArray): void; ignoreAllLogs(value?: boolean): void; clearAllLogs(): void; addLog(log: LogData): void; @@ -118,7 +118,7 @@ if (__DEV__) { /** * Silence any logs that match the given strings or regexes. */ - ignoreLogs(patterns: $ReadOnlyArray): void { + ignoreLogs(patterns: ReadonlyArray): void { LogBoxData.addIgnorePatterns(patterns); }, @@ -256,7 +256,7 @@ if (__DEV__) { return false; }, - ignoreLogs(patterns: $ReadOnlyArray): void { + ignoreLogs(patterns: ReadonlyArray): void { // Do nothing. }, diff --git a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js index 0e496ec9536..cd65c8781a2 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js @@ -17,7 +17,7 @@ import LogBoxInspector from './UI/LogBoxInspector'; import * as React from 'react'; type Props = Readonly<{ - logs: $ReadOnlyArray, + logs: ReadonlyArray, selectedLogIndex: number, isDisabled?: ?boolean, }>; diff --git a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js index 3eaae63de9d..c121a16b4e3 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js @@ -17,7 +17,7 @@ import LogBoxLogNotification from './UI/LogBoxNotification'; import * as React from 'react'; type Props = Readonly<{ - logs: $ReadOnlyArray, + logs: ReadonlyArray, selectedLogIndex: number, isDisabled?: ?boolean, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js index ac6a5816176..3f3ae961968 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js @@ -24,7 +24,7 @@ type Props = Readonly<{ onDismiss: () => void, onChangeSelectedIndex: (index: number) => void, onMinimize: () => void, - logs: $ReadOnlyArray, + logs: ReadonlyArray, selectedIndex: number, fatalType?: ?LogLevel, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js b/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js index 1e1fcc24e8e..e62bd64d2d4 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js @@ -29,7 +29,7 @@ type Range = { upperBound: number, }; -function getLinkRanges(string: string): $ReadOnlyArray { +function getLinkRanges(string: string): ReadonlyArray { const regex = /https?:\/\/[^\s$.?#].[^\s]*/gi; const matches = []; diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 6900fffe7bc..1fabac7de3d 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -125,7 +125,7 @@ export type ModalPropsIOS = { * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. * On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field. */ - supportedOrientations?: ?$ReadOnlyArray< + supportedOrientations?: ?ReadonlyArray< | 'portrait' | 'portrait-upside-down' | 'landscape' diff --git a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js index 431429183d7..7e87d4cf23a 100644 --- a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js +++ b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js @@ -26,7 +26,7 @@ const itif = (condition: boolean) => { }; // TODO: Move this util to a shared location. -function getMock, TReturn>( +function getMock, TReturn>( fn: (...args: TArguments) => TReturn, ): JestMockFn { if (!jest.isMockFunction(fn)) { diff --git a/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js b/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js index a2db296f50b..ce51f1380c9 100644 --- a/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js +++ b/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js @@ -39,7 +39,7 @@ export type Runnable = ( ) => void; export type Runnables = {[appKey: string]: Runnable}; export type Registry = { - sections: $ReadOnlyArray, + sections: ReadonlyArray, runnables: Runnables, ... }; diff --git a/packages/react-native/Libraries/ReactNative/AppRegistryImpl.js b/packages/react-native/Libraries/ReactNative/AppRegistryImpl.js index 2fe95f88970..c37640b1b5d 100644 --- a/packages/react-native/Libraries/ReactNative/AppRegistryImpl.js +++ b/packages/react-native/Libraries/ReactNative/AppRegistryImpl.js @@ -119,11 +119,11 @@ export function registerSection( registerComponent(appKey, component, true); } -export function getAppKeys(): $ReadOnlyArray { +export function getAppKeys(): ReadonlyArray { return Object.keys(runnables); } -export function getSectionKeys(): $ReadOnlyArray { +export function getSectionKeys(): ReadonlyArray { return Object.keys(sections); } diff --git a/packages/react-native/Libraries/ReactNative/FabricUIManager.js b/packages/react-native/Libraries/ReactNative/FabricUIManager.js index 0e594c1ce71..40de0d069c7 100644 --- a/packages/react-native/Libraries/ReactNative/FabricUIManager.js +++ b/packages/react-native/Libraries/ReactNative/FabricUIManager.js @@ -154,7 +154,7 @@ export function getFabricUIManager(): ?Spec { */ function createProxyWithCachedProperties( implementation: Spec, - propertiesToCache: $ReadOnlyArray, + propertiesToCache: ReadonlyArray, ): Spec { const proxy = Object.create(implementation); for (const propertyName of propertiesToCache) { diff --git a/packages/react-native/Libraries/ReactNative/UIManagerProperties.js b/packages/react-native/Libraries/ReactNative/UIManagerProperties.js index f91b3f15736..bfcbeee871c 100644 --- a/packages/react-native/Libraries/ReactNative/UIManagerProperties.js +++ b/packages/react-native/Libraries/ReactNative/UIManagerProperties.js @@ -26,7 +26,7 @@ * accessed. Once UIManager property accesses for view managers has been fully * deprecated, this file will also be removed. */ -const UIManagerProperties: $ReadOnlyArray = [ +const UIManagerProperties: ReadonlyArray = [ 'clearJSResponder', 'configureNextLayoutAnimation', 'createView', diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index d48f6e0dc32..063523fcb57 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -26,7 +26,7 @@ export type {____TransformStyle_Internal}; declare export opaque type NativeColorValue; export type ____ColorValue_Internal = null | string | number | NativeColorValue; -export type ColorArrayValue = null | $ReadOnlyArray<____ColorValue_Internal>; +export type ColorArrayValue = null | ReadonlyArray<____ColorValue_Internal>; export type PointValue = { x: number, y: number, @@ -729,9 +729,9 @@ type LinearGradientValue = { type: 'linear-gradient', // Angle or direction enums direction?: string, - colorStops: $ReadOnlyArray<{ + colorStops: ReadonlyArray<{ color: ____ColorValue_Internal, - positions?: $ReadOnlyArray, + positions?: ReadonlyArray, }>, }; @@ -771,9 +771,9 @@ type RadialGradientValue = { shape: RadialGradientShape, size: RadialGradientSize, position: RadialGradientPosition, - colorStops: $ReadOnlyArray<{ + colorStops: ReadonlyArray<{ color: ____ColorValue_Internal, - positions?: $ReadOnlyArray, + positions?: ReadonlyArray, }>, }; @@ -886,17 +886,15 @@ export type ____ViewStyle_InternalBase = Readonly<{ elevation?: number, pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only', cursor?: CursorValue, - boxShadow?: $ReadOnlyArray | string, - filter?: $ReadOnlyArray | string, + boxShadow?: ReadonlyArray | string, + filter?: ReadonlyArray | string, mixBlendMode?: ____BlendMode_Internal, - experimental_backgroundImage?: $ReadOnlyArray | string, - experimental_backgroundSize?: $ReadOnlyArray | string, + experimental_backgroundImage?: ReadonlyArray | string, + experimental_backgroundSize?: ReadonlyArray | string, experimental_backgroundPosition?: - | $ReadOnlyArray - | string, - experimental_backgroundRepeat?: - | $ReadOnlyArray + | ReadonlyArray | string, + experimental_backgroundRepeat?: ReadonlyArray | string, isolation?: 'auto' | 'isolate', }>; @@ -997,7 +995,7 @@ export type ____FontVariant_Internal = | 'stylistic-twenty'; export type ____FontVariantArray_Internal = - $ReadOnlyArray<____FontVariant_Internal>; + ReadonlyArray<____FontVariant_Internal>; type ____TextStyle_InternalBase = Readonly<{ color?: ____ColorValue_Internal, @@ -1074,7 +1072,7 @@ export type StyleProp<+T> = | T | false | '' - | $ReadOnlyArray>; + | ReadonlyArray>; export type ____DangerouslyImpreciseStyleProp_Internal = StyleProp< Partial<____DangerouslyImpreciseStyle_Internal>, @@ -1110,7 +1108,7 @@ type ____FlattenStyleProp_Helper< ? empty : TStyleProp extends null | void | false | '' ? empty // When TStyleProp is an array, recurse with decremented Depth - : TStyleProp extends $ReadOnlyArray + : TStyleProp extends ReadonlyArray ? ____FlattenStyleProp_Helper< V, Depth extends number ? FlattenDepthLimiter[Depth] : 0, diff --git a/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js b/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js index 91c8207eb8f..87b7fbdc38d 100644 --- a/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js +++ b/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js @@ -123,7 +123,7 @@ describe('processBackgroundImage', () => { }); it('should process a linear gradient object style with case-insensitive direction keyword', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, direction: 'To Bottom', @@ -140,7 +140,7 @@ describe('processBackgroundImage', () => { }); it('should process a linear gradient object style with case-insensitive angle', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, direction: '45DEG', @@ -352,7 +352,7 @@ describe('processBackgroundImage', () => { }); it('should process an array of style objects', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, direction: 'to bottom right', @@ -376,7 +376,7 @@ describe('processBackgroundImage', () => { }); it('should process an style object with default direction', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, colorStops: [{color: 'red'}, {color: 'blue'}], @@ -390,7 +390,7 @@ describe('processBackgroundImage', () => { }); it('should process style object with direction enum', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, direction: 'to right', @@ -405,7 +405,7 @@ describe('processBackgroundImage', () => { }); it('should process style object with direction angle', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, direction: '45deg', @@ -420,7 +420,7 @@ describe('processBackgroundImage', () => { }); it('should fix up stop positions #1', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, colorStops: [ @@ -458,7 +458,7 @@ describe('processBackgroundImage', () => { }); it('should process multiple stop positions', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, colorStops: [ @@ -495,7 +495,7 @@ describe('processBackgroundImage', () => { }); it('should fix up stop positions #2', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, colorStops: [ @@ -528,7 +528,7 @@ describe('processBackgroundImage', () => { }); it('should fix up stop positions #3', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, colorStops: [ @@ -561,7 +561,7 @@ describe('processBackgroundImage', () => { }); it('should fix up stop positions #4', () => { - const input: $ReadOnlyArray | string = [ + const input: ReadonlyArray | string = [ { type: 'linear-gradient' as const, colorStops: [ diff --git a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js index 202f13987c9..ec6b7586d01 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js +++ b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js @@ -47,7 +47,7 @@ export type ____TransformStyle_Internal = Readonly<{ * `transform([{ skewX: '45deg' }])` */ transform?: - | $ReadOnlyArray< + | ReadonlyArray< Readonly< MaximumOneOf< MergeUnion< @@ -73,7 +73,7 @@ export type ____TransformStyle_Internal = Readonly<{ | {+skewY: string | AnimatedNode} // TODO: what is the actual type it expects? | { - +matrix: $ReadOnlyArray | AnimatedNode, + +matrix: ReadonlyArray | AnimatedNode, }, >, >, diff --git a/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js b/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js index ef7906e7e4c..7b86ff926e4 100644 --- a/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js +++ b/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js @@ -37,7 +37,7 @@ type LinearGradientDirection = type LinearGradientBackgroundImage = { type: 'linear-gradient', direction: LinearGradientDirection, - colorStops: $ReadOnlyArray<{ + colorStops: ReadonlyArray<{ color: ColorStopColor, position: ColorStopPosition, }>, @@ -57,7 +57,7 @@ type RadialGradientBackgroundImage = { shape: RadialGradientShape, size: RadialGradientSize, position: RadialGradientPosition, - colorStops: $ReadOnlyArray<{ + colorStops: ReadonlyArray<{ color: ColorStopColor, position: ColorStopPosition, }>, @@ -73,9 +73,9 @@ type ParsedBackgroundImageValue = | RadialGradientBackgroundImage; export default function processBackgroundImage( - backgroundImage: ?($ReadOnlyArray | string), -): $ReadOnlyArray { - let result: $ReadOnlyArray = []; + backgroundImage: ?(ReadonlyArray | string), +): ReadonlyArray { + let result: ReadonlyArray = []; if (backgroundImage == null) { return result; } @@ -183,7 +183,7 @@ export default function processBackgroundImage( return result; } -function processColorStops(bgImage: BackgroundImageValue): $ReadOnlyArray<{ +function processColorStops(bgImage: BackgroundImageValue): ReadonlyArray<{ color: ColorStopColor, position: ColorStopPosition, }> | null { @@ -249,7 +249,7 @@ function processColorStops(bgImage: BackgroundImageValue): $ReadOnlyArray<{ function parseBackgroundImageCSSString( cssString: string, -): $ReadOnlyArray { +): ReadonlyArray { const gradients = []; const bgImageStrings = splitGradients(cssString); diff --git a/packages/react-native/Libraries/StyleSheet/processBackgroundPosition.js b/packages/react-native/Libraries/StyleSheet/processBackgroundPosition.js index 3d8dadaa40a..0b3800c4966 100644 --- a/packages/react-native/Libraries/StyleSheet/processBackgroundPosition.js +++ b/packages/react-native/Libraries/StyleSheet/processBackgroundPosition.js @@ -12,9 +12,9 @@ import type {BackgroundPositionValue} from './StyleSheetTypes'; export default function processBackgroundPosition( - backgroundPosition: ?($ReadOnlyArray | string), -): $ReadOnlyArray { - let result: $ReadOnlyArray = []; + backgroundPosition: ?(ReadonlyArray | string), +): ReadonlyArray { + let result: ReadonlyArray = []; if (backgroundPosition == null) { return []; @@ -33,7 +33,7 @@ export default function processBackgroundPosition( // https://www.w3.org/TR/css-backgrounds-3/#typedef-bg-position const parseBackgroundPositionCSSString = ( backgroundPosition: string, -): $ReadOnlyArray => { +): ReadonlyArray => { const result: Array = []; const positions = backgroundPosition.split(',').map(s => s.trim()); diff --git a/packages/react-native/Libraries/StyleSheet/processBackgroundRepeat.js b/packages/react-native/Libraries/StyleSheet/processBackgroundRepeat.js index cf140b937cb..72aad00ac4f 100644 --- a/packages/react-native/Libraries/StyleSheet/processBackgroundRepeat.js +++ b/packages/react-native/Libraries/StyleSheet/processBackgroundRepeat.js @@ -27,9 +27,9 @@ function isBackgroundRepeatKeyword( } export default function processBackgroundRepeat( - backgroundRepeat: ?($ReadOnlyArray | string), -): $ReadOnlyArray { - let result: $ReadOnlyArray = []; + backgroundRepeat: ?(ReadonlyArray | string), +): ReadonlyArray { + let result: ReadonlyArray = []; if (backgroundRepeat == null) { return []; } @@ -50,7 +50,7 @@ export default function processBackgroundRepeat( // https://www.w3.org/TR/css-backgrounds-3/#typedef-repeat-style function parseBackgroundRepeatCSSString( backgroundRepeat: string, -): $ReadOnlyArray { +): ReadonlyArray { const result: Array = []; const bgRepeatArray = backgroundRepeat.split(',').map(s => s.trim()); diff --git a/packages/react-native/Libraries/StyleSheet/processBackgroundSize.js b/packages/react-native/Libraries/StyleSheet/processBackgroundSize.js index 0c494776d3a..f95b5ede269 100644 --- a/packages/react-native/Libraries/StyleSheet/processBackgroundSize.js +++ b/packages/react-native/Libraries/StyleSheet/processBackgroundSize.js @@ -13,9 +13,9 @@ import type {BackgroundSizeValue} from './StyleSheetTypes'; export default function processBackgroundSize( - backgroundSize: ?($ReadOnlyArray | string), -): $ReadOnlyArray { - let result: $ReadOnlyArray = []; + backgroundSize: ?(ReadonlyArray | string), +): ReadonlyArray { + let result: ReadonlyArray = []; if (backgroundSize == null) { // If the size is invalid, return an empty array and do not apply any background size. Same as web. @@ -34,7 +34,7 @@ export default function processBackgroundSize( // = [ | auto ]{1,2} | cover | contain function parseBackgroundSizeCSSString( backgroundSize: string, -): $ReadOnlyArray { +): ReadonlyArray { const result: Array = []; const sizes = backgroundSize.split(',').map(s => s.trim()); diff --git a/packages/react-native/Libraries/StyleSheet/processBoxShadow.js b/packages/react-native/Libraries/StyleSheet/processBoxShadow.js index 187868c35c7..0d1aa710d29 100644 --- a/packages/react-native/Libraries/StyleSheet/processBoxShadow.js +++ b/packages/react-native/Libraries/StyleSheet/processBoxShadow.js @@ -23,7 +23,7 @@ export type ParsedBoxShadow = { }; export default function processBoxShadow( - rawBoxShadows: ?($ReadOnlyArray | string), + rawBoxShadows: ?(ReadonlyArray | string), ): Array { const result: Array = []; if (rawBoxShadows == null) { diff --git a/packages/react-native/Libraries/StyleSheet/processColorArray.js b/packages/react-native/Libraries/StyleSheet/processColorArray.js index 4f583933e83..258697a60d8 100644 --- a/packages/react-native/Libraries/StyleSheet/processColorArray.js +++ b/packages/react-native/Libraries/StyleSheet/processColorArray.js @@ -17,8 +17,8 @@ import processColor, {type ProcessedColorValue} from './processColor'; const TRANSPARENT = 0; // rgba(0, 0, 0, 0) function processColorArray( - colors: ?$ReadOnlyArray, -): ?$ReadOnlyArray { + colors: ?ReadonlyArray, +): ?ReadonlyArray { return colors == null ? null : colors.map(processColorElement); } diff --git a/packages/react-native/Libraries/StyleSheet/processFilter.js b/packages/react-native/Libraries/StyleSheet/processFilter.js index 66471f219d5..fd376bd3d28 100644 --- a/packages/react-native/Libraries/StyleSheet/processFilter.js +++ b/packages/react-native/Libraries/StyleSheet/processFilter.js @@ -35,8 +35,8 @@ type ParsedDropShadow = { }; export default function processFilter( - filter: ?($ReadOnlyArray | string), -): $ReadOnlyArray { + filter: ?(ReadonlyArray | string), +): ReadonlyArray { let result: Array = []; if (filter == null) { return result; diff --git a/packages/react-native/Libraries/Types/CodegenTypes.js b/packages/react-native/Libraries/Types/CodegenTypes.js index 289659521b4..78164b950e1 100644 --- a/packages/react-native/Libraries/Types/CodegenTypes.js +++ b/packages/react-native/Libraries/Types/CodegenTypes.js @@ -33,7 +33,7 @@ export type Int32 = number; export type UnsafeObject = Object; export type UnsafeMixed = unknown; -type DefaultTypes = number | boolean | string | $ReadOnlyArray; +type DefaultTypes = number | boolean | string | ReadonlyArray; // Default handling, ignore the unused value // we're only using it for type checking // diff --git a/packages/react-native/Libraries/Types/CoreEventTypes.js b/packages/react-native/Libraries/Types/CoreEventTypes.js index eb822951d45..1e30bd6047c 100644 --- a/packages/react-native/Libraries/Types/CoreEventTypes.js +++ b/packages/react-native/Libraries/Types/CoreEventTypes.js @@ -37,7 +37,7 @@ export type ResponderSyntheticEvent = Readonly<{ indexOfSingleActiveTouch: number, mostRecentTimeStamp: number, numberActiveTouches: number, - touchBank: $ReadOnlyArray< + touchBank: ReadonlyArray< Readonly<{ touchActive: boolean, startPageX: number, @@ -224,7 +224,7 @@ export type NativeTouchEvent = Readonly<{ /** * Array of all touch events that have changed since the last event */ - changedTouches: $ReadOnlyArray, + changedTouches: ReadonlyArray, /** * 3D Touch reported force * @platform ios @@ -261,7 +261,7 @@ export type NativeTouchEvent = Readonly<{ /** * Array of all current touches on the screen */ - touches: $ReadOnlyArray, + touches: ReadonlyArray, }>; export type GestureResponderEvent = ResponderSyntheticEvent; diff --git a/packages/react-native/Libraries/Utilities/HMRClient.js b/packages/react-native/Libraries/Utilities/HMRClient.js index b49e230d45d..02ff12e9750 100644 --- a/packages/react-native/Libraries/Utilities/HMRClient.js +++ b/packages/react-native/Libraries/Utilities/HMRClient.js @@ -26,7 +26,7 @@ let hmrUnavailableReason: string | null = null; let hmrOrigin: string | null = null; let currentCompileErrorMessage: string | null = null; let didConnect: boolean = false; -let pendingLogs: Array<[LogLevel, $ReadOnlyArray]> = []; +let pendingLogs: Array<[LogLevel, ReadonlyArray]> = []; type LogLevel = | 'trace' @@ -43,7 +43,7 @@ export type HMRClientNativeInterface = { enable(): void, disable(): void, registerBundle(requestUrl: string): void, - log(level: LogLevel, data: $ReadOnlyArray): void, + log(level: LogLevel, data: ReadonlyArray): void, setup( platform: string, bundleEntry: string, @@ -113,7 +113,7 @@ const HMRClient: HMRClientNativeInterface = { registerBundleEntryPoints(hmrClient); }, - log(level: LogLevel, data: $ReadOnlyArray) { + log(level: LogLevel, data: ReadonlyArray) { if (!hmrClient) { // Catch a reasonable number of early logs // in case hmrClient gets initialized later. diff --git a/packages/react-native/Libraries/Utilities/__tests__/useRefEffect-test.js b/packages/react-native/Libraries/Utilities/__tests__/useRefEffect-test.js index abefb60f47d..8dec217c19c 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/useRefEffect-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/useRefEffect-test.js @@ -86,7 +86,7 @@ expect.extend({ function mockEffectRegistry(): { mockEffect: string => () => () => void, mockEffectWithoutCleanup: string => () => void, - registry: $ReadOnlyArray, + registry: ReadonlyArray, } { const registry: Array = []; return { diff --git a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js index 17c271f1191..c4ce2aa9d4d 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js @@ -11,13 +11,13 @@ const {dispatchCommand} = require('../ReactNative/RendererProxy'); type NativeCommandsOptions = Readonly<{ - supportedCommands: $ReadOnlyArray, + supportedCommands: ReadonlyArray, }>; function codegenNativeCommands( options: NativeCommandsOptions<$Keys>, ): T { - const commandObj: {[$Keys]: (...$ReadOnlyArray) => void} = {}; + const commandObj: {[$Keys]: (...ReadonlyArray) => void} = {}; options.supportedCommands.forEach(command => { // $FlowFixMe[missing-local-annot] diff --git a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js index 3b6510a84c4..cf9b2eccbcf 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js @@ -20,7 +20,7 @@ type NativeComponentOptions = Readonly<{ interfaceOnly?: boolean, paperComponentName?: string, paperComponentNameDeprecated?: string, - excludedPlatforms?: $ReadOnlyArray<'iOS' | 'android'>, + excludedPlatforms?: ReadonlyArray<'iOS' | 'android'>, }>; export type NativeComponentType = HostComponent; diff --git a/packages/react-native/Libraries/Utilities/logError.js b/packages/react-native/Libraries/Utilities/logError.js index 70d8b7dc3c9..3e9bf1ad90f 100644 --- a/packages/react-native/Libraries/Utilities/logError.js +++ b/packages/react-native/Libraries/Utilities/logError.js @@ -15,7 +15,7 @@ * `console.error` as a failure callback - it's not properly bound. If passes an * `Error` object, it will print the message and stack. */ -const logError = function (...args: $ReadOnlyArray) { +const logError = function (...args: ReadonlyArray) { if (args.length === 1 && args[0] instanceof Error) { const err = args[0]; console.error('Error: "' + err.message + '". Stack:\n' + err.stack); diff --git a/packages/react-native/Libraries/Utilities/useMergeRefs.js b/packages/react-native/Libraries/Utilities/useMergeRefs.js index 5e6f2957878..3f76a0b3392 100644 --- a/packages/react-native/Libraries/Utilities/useMergeRefs.js +++ b/packages/react-native/Libraries/Utilities/useMergeRefs.js @@ -22,11 +22,11 @@ import {useCallback} from 'react'; * lead to problems with the given refs being invoked more times than desired. */ export default function useMergeRefs( - ...refs: $ReadOnlyArray> + ...refs: ReadonlyArray> ): React.RefSetter { const refEffect = useCallback( (current: Instance) => { - const cleanups: $ReadOnlyArray void)> = refs.map(ref => { + const cleanups: ReadonlyArray void)> = refs.map(ref => { if (ref == null) { return undefined; } else { diff --git a/packages/react-native/Libraries/vendor/core/ErrorUtils.js b/packages/react-native/Libraries/vendor/core/ErrorUtils.js index 7d6a0d8f677..137f555d3e5 100644 --- a/packages/react-native/Libraries/vendor/core/ErrorUtils.js +++ b/packages/react-native/Libraries/vendor/core/ErrorUtils.js @@ -10,22 +10,22 @@ // From @react-native/js-polyfills type ErrorHandler = (error: unknown, isFatal: boolean) => void; -type Fn, Return> = (...Args) => Return; +type Fn, Return> = (...Args) => Return; export type ErrorUtils = { - applyWithGuard, TOut>( + applyWithGuard, TOut>( fun: Fn, context?: unknown, args?: ?TArgs, unused_onError?: null, unused_name?: ?string, ): ?TOut, - applyWithGuardIfNeeded, TOut>( + applyWithGuardIfNeeded, TOut>( fun: Fn, context?: unknown, args?: ?TArgs, ): ?TOut, getGlobalHandler(): ErrorHandler, - guard, TOut>( + guard, TOut>( fun: Fn, name?: ?string, context?: unknown, diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 2ccfeb47b40..05d668dee42 100644 --- a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js +++ b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js @@ -16,7 +16,7 @@ export interface EventSubscription { } export interface IEventEmitter< - TEventToArgsMap: Readonly>>, + TEventToArgsMap: Readonly>>, > { addListener>( eventType: TEvent, @@ -41,7 +41,7 @@ interface Registration { } type Registry< - TEventToArgsMap: Readonly>>, + TEventToArgsMap: Readonly>>, > = { [K in keyof TEventToArgsMap]: Set>, }; @@ -68,8 +68,8 @@ type Registry< */ export default class EventEmitter< TEventToArgsMap: Readonly< - Record>, - > = Readonly>>, + Record>, + > = Readonly>>, > implements IEventEmitter { #registry: Registry; @@ -157,7 +157,7 @@ export default class EventEmitter< } function allocate< - TEventToArgsMap: Readonly>>, + TEventToArgsMap: Readonly>>, TEvent: $Keys, TEventArgs: TEventToArgsMap[TEvent], >( diff --git a/packages/react-native/flow/bom.js.flow b/packages/react-native/flow/bom.js.flow index 1c4d3c8b0ee..cb766878cf2 100644 --- a/packages/react-native/flow/bom.js.flow +++ b/packages/react-native/flow/bom.js.flow @@ -32,31 +32,31 @@ declare interface ConsoleTask { // $FlowExpectedError[libdef-override] Flow core definitions are incomplete. declare var console: { // Logging - log(...data: $ReadOnlyArray): void, - trace(...data: $ReadOnlyArray): void, - debug(...data: $ReadOnlyArray): void, - info(...data: $ReadOnlyArray): void, - warn(...data: $ReadOnlyArray): void, - error(...data: $ReadOnlyArray): void, + log(...data: ReadonlyArray): void, + trace(...data: ReadonlyArray): void, + debug(...data: ReadonlyArray): void, + info(...data: ReadonlyArray): void, + warn(...data: ReadonlyArray): void, + error(...data: ReadonlyArray): void, // Grouping - group(...data: $ReadOnlyArray): void, - groupCollapsed(...data: $ReadOnlyArray): void, + group(...data: ReadonlyArray): void, + groupCollapsed(...data: ReadonlyArray): void, groupEnd(): void, // Printing table( tabularData: | Readonly<{[key: string]: unknown, ...}> - | $ReadOnlyArray> - | $ReadOnlyArray<$ReadOnlyArray>, + | ReadonlyArray> + | ReadonlyArray>, ): void, - dir(...data: $ReadOnlyArray): void, - dirxml(...data: $ReadOnlyArray): void, + dir(...data: ReadonlyArray): void, + dirxml(...data: ReadonlyArray): void, clear(): void, // Utilities - assert(condition: unknown, ...data: $ReadOnlyArray): void, + assert(condition: unknown, ...data: ReadonlyArray): void, // Profiling profile(name?: string): void, @@ -172,7 +172,7 @@ declare class TaskAttributionTiming extends PerformanceEntry { // https://w3c.github.io/longtasks/#sec-PerformanceLongTaskTiming declare class PerformanceLongTaskTiming extends PerformanceEntry { - attribution: $ReadOnlyArray; + attribution: ReadonlyArray; } // https://www.w3.org/TR/user-timing/#extensions-performance-interface diff --git a/packages/react-native/flow/dom.js.flow b/packages/react-native/flow/dom.js.flow index 2f3dd185513..89862933a07 100644 --- a/packages/react-native/flow/dom.js.flow +++ b/packages/react-native/flow/dom.js.flow @@ -58,7 +58,7 @@ declare type FilePropertyBag = { }; declare class File extends Blob { constructor( - fileBits: $ReadOnlyArray, + fileBits: ReadonlyArray, filename: string, options?: FilePropertyBag, ): void; @@ -1216,7 +1216,7 @@ type ClipboardItemOptions = { }; declare class ClipboardItem { - +types: $ReadOnlyArray; + +types: ReadonlyArray; getType(type: string): Promise; constructor( items: {[type: string]: ClipboardItemData}, @@ -1315,7 +1315,7 @@ declare class Node extends EventTarget { normalize(): void; removeChild(oldChild: T): T; replaceChild(newChild: Node, oldChild: T): T; - replaceChildren(...nodes: $ReadOnlyArray): void; + replaceChildren(...nodes: ReadonlyArray): void; static ATTRIBUTE_NODE: number; static CDATA_SECTION_NODE: number; static COMMENT_NODE: number; @@ -3797,7 +3797,7 @@ declare class CanvasRenderingContext2D { y: number, w: number, h: number, - radii?: number | DOMPointInit | $ReadOnlyArray, + radii?: number | DOMPointInit | ReadonlyArray, ): void; strokeRect(x: number, y: number, w: number, h: number): void; diff --git a/packages/react-native/flow/global.js b/packages/react-native/flow/global.js index 4c7f9e25cc2..dc6de666ec0 100644 --- a/packages/react-native/flow/global.js +++ b/packages/react-native/flow/global.js @@ -24,7 +24,7 @@ declare var global: { +env: { +NODE_ENV: 'development' | 'production', }, - +argv?: $ReadOnlyArray, + +argv?: ReadonlyArray, }, // setUpPerformance diff --git a/packages/react-native/src/private/__tests__/utilities/accessibilityPropsSuite.js b/packages/react-native/src/private/__tests__/utilities/accessibilityPropsSuite.js index e28d6acf2c8..ec3877292ec 100644 --- a/packages/react-native/src/private/__tests__/utilities/accessibilityPropsSuite.js +++ b/packages/react-native/src/private/__tests__/utilities/accessibilityPropsSuite.js @@ -15,7 +15,7 @@ import type {AccessibilityProps} from 'react-native'; import * as Fantom from '@react-native/fantom'; import * as React from 'react'; -const ACCESIBILITY_ROLE_VALUES: $ReadOnlyArray = [ +const ACCESIBILITY_ROLE_VALUES: ReadonlyArray = [ 'none', 'button', 'link', @@ -45,7 +45,7 @@ const ACCESIBILITY_ROLE_VALUES: $ReadOnlyArray = [ 'toolbar', ]; -const ROLE_VALUES: $ReadOnlyArray = [ +const ROLE_VALUES: ReadonlyArray = [ 'alert', 'alertdialog', 'application', @@ -128,7 +128,7 @@ function getAccessibilityProp( function getAccessibilityProps( content: React.MixedElement, - names: $ReadOnlyArray<$Keys>, + names: ReadonlyArray<$Keys>, ) { Fantom.runTask(() => { root.render(content); diff --git a/packages/react-native/src/private/animated/NativeAnimatedHelper.js b/packages/react-native/src/private/animated/NativeAnimatedHelper.js index e0d6de8be3d..647355d8283 100644 --- a/packages/react-native/src/private/animated/NativeAnimatedHelper.js +++ b/packages/react-native/src/private/animated/NativeAnimatedHelper.js @@ -103,7 +103,7 @@ function createNativeOperations(): NonNullable { methodNames.push('connectAnimatedNodeToShadowNodeFamily'); } const nativeOperations: { - [Values]: (...$ReadOnlyArray) => void, + [Values]: (...ReadonlyArray) => void, } = {}; if (isSingleOpBatching) { for (let ii = 0, length = methodNames.length; ii < length; ii++) { diff --git a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js index 504a78796cf..f6657e021e3 100644 --- a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js +++ b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js @@ -24,13 +24,13 @@ type CompositeKey = { [string]: | CompositeKeyComponent | AnimatedEvent - | $ReadOnlyArray + | ReadonlyArray | Readonly<{[string]: unknown}>, }; type CompositeKeyComponent = | AnimatedNode - | $ReadOnlyArray + | ReadonlyArray | Readonly<{[string]: CompositeKeyComponent}>; type $ReadOnlyCompositeKey = Readonly<{ @@ -38,13 +38,13 @@ type $ReadOnlyCompositeKey = Readonly<{ [string]: | $ReadOnlyCompositeKeyComponent | AnimatedEvent - | $ReadOnlyArray + | ReadonlyArray | Readonly<{[string]: unknown}>, }>; type $ReadOnlyCompositeKeyComponent = | AnimatedNode - | $ReadOnlyArray<$ReadOnlyCompositeKeyComponent | null> + | ReadonlyArray<$ReadOnlyCompositeKeyComponent | null> | Readonly<{[string]: $ReadOnlyCompositeKeyComponent}>; type AnimatedPropsMemoHook = ( @@ -160,8 +160,8 @@ export function createCompositeKeyForProps( * If `array` contains no `AnimatedNode` instances, this returns null. */ function createCompositeKeyForArray( - array: $ReadOnlyArray, -): $ReadOnlyArray<$ReadOnlyCompositeKeyComponent | null> | null { + array: ReadonlyArray, +): ReadonlyArray<$ReadOnlyCompositeKeyComponent | null> | null { let compositeKey: Array<$ReadOnlyCompositeKeyComponent | null> | null = null; for (let ii = 0, length = array.length; ii < length; ii++) { diff --git a/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js b/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js index 1115fd9201e..5b6b3474dd0 100644 --- a/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js +++ b/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js @@ -361,7 +361,7 @@ export function dispatchModeChangeEvent( * Helper to create a callback ref that records instances using WeakRefs. */ function createWeakRefCallback(): Readonly<{ - weakRefs: $ReadOnlyArray>, + weakRefs: ReadonlyArray>, callbackRef: React.RefSetter, }> { const weakRefs: Array> = []; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js index 104bec154cb..35acd8319d6 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js @@ -31,7 +31,7 @@ type AndroidSwipeRefreshLayoutNativeProps = Readonly<{ /** * The colors (at least one) that will be used to draw the refresh indicator. */ - colors?: ?$ReadOnlyArray, + colors?: ?ReadonlyArray, /** * The background color of the refresh indicator. */ diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js index a7dff668867..178951bf2b4 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js @@ -38,11 +38,11 @@ export type ElementRectangle = { interface NativeCommands { +highlightTraceUpdates: ( viewRef: React.ElementRef, - updates: $ReadOnlyArray, + updates: ReadonlyArray, ) => void; +highlightElements: ( viewRef: React.ElementRef, - elements: $ReadOnlyArray, + elements: ReadonlyArray, ) => void; +clearElementsHighlights: ( viewRef: React.ElementRef, diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js index f9a798c30ba..a27f5b3b3e4 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js @@ -124,7 +124,7 @@ type RCTModalHostViewNativeProps = Readonly<{ * See https://reactnative.dev/docs/modal#supportedorientations */ supportedOrientations?: WithDefault< - $ReadOnlyArray< + ReadonlyArray< | 'portrait' | 'portrait-upside-down' | 'landscape' diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js index c3350e6bc90..7188390e5ae 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js @@ -16,7 +16,7 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod export interface Spec extends TurboModule { +getConstants: () => {}; // Return [width, height] of image uri - +getSize: (uri: string) => Promise<$ReadOnlyArray>; + +getSize: (uri: string) => Promise>; +getSizeWithHeaders: ( uri: string, headers: Object, diff --git a/packages/react-native/src/private/styles/composeStyles.js b/packages/react-native/src/private/styles/composeStyles.js index a0e90e92a0a..bc26e3d233e 100644 --- a/packages/react-native/src/private/styles/composeStyles.js +++ b/packages/react-native/src/private/styles/composeStyles.js @@ -16,7 +16,7 @@ export default function composeStyles( style1: ?U, style2: ?V, -): ?(T | $ReadOnlyArray) { +): ?(T | ReadonlyArray) { if (style1 == null) { return style2; } diff --git a/packages/react-native/src/private/webapis/dom/events/Event.js b/packages/react-native/src/private/webapis/dom/events/Event.js index 6f616735af8..f97ead512ab 100644 --- a/packages/react-native/src/private/webapis/dom/events/Event.js +++ b/packages/react-native/src/private/webapis/dom/events/Event.js @@ -151,7 +151,7 @@ export default class Event { return this._type; } - composedPath(): $ReadOnlyArray { + composedPath(): ReadonlyArray { return getComposedPath(this).slice(); } 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 08ff4fa07c5..72baf0fc197 100644 --- a/packages/react-native/src/private/webapis/dom/events/EventTarget.js +++ b/packages/react-native/src/private/webapis/dom/events/EventTarget.js @@ -311,7 +311,7 @@ function dispatch(eventTarget: EventTarget, event: Event): void { function getEventPath( eventTarget: EventTarget, event: Event, -): $ReadOnlyArray { +): ReadonlyArray { const path = []; let target: EventTarget | null = eventTarget; diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js index 9beea5b323c..fe47914f8a3 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js @@ -17,7 +17,7 @@ import EventTarget from 'react-native/src/private/webapis/dom/events/EventTarget let event: Event; let eventTarget: EventTarget; -let eventTargets: $ReadOnlyArray; +let eventTargets: ReadonlyArray; unstable_benchmark .suite('EventTarget', { diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js index 4cc5699db46..f25173da3b1 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js @@ -24,7 +24,7 @@ function resetListenerCallOrder() { type EventRecordingListener = JestMockFn<[Event], void> & { eventData?: { callOrder: number, - composedPath: $ReadOnlyArray, + composedPath: ReadonlyArray, currentTarget: Event['currentTarget'], eventPhase: Event['eventPhase'], target: Event['target'], diff --git a/packages/react-native/src/private/webapis/dom/events/internals/EventInternals.js b/packages/react-native/src/private/webapis/dom/events/internals/EventInternals.js index 7192ca4e57c..f1680679585 100644 --- a/packages/react-native/src/private/webapis/dom/events/internals/EventInternals.js +++ b/packages/react-native/src/private/webapis/dom/events/internals/EventInternals.js @@ -43,14 +43,14 @@ export function setCurrentTarget( event[CURRENT_TARGET_KEY] = currentTarget; } -export function getComposedPath(event: Event): $ReadOnlyArray { +export function getComposedPath(event: Event): ReadonlyArray { // $FlowExpectedError[prop-missing] return event[COMPOSED_PATH_KEY]; } export function setComposedPath( event: Event, - composedPath: $ReadOnlyArray, + composedPath: ReadonlyArray, ): void { // $FlowExpectedError[prop-missing] event[COMPOSED_PATH_KEY] = composedPath; diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js index ad030b1dbce..ce816d9ed5f 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js @@ -219,7 +219,7 @@ export default class ReadOnlyElement extends ReadOnlyNode { } } -function getChildElements(node: ReadOnlyNode): $ReadOnlyArray { +function getChildElements(node: ReadOnlyNode): ReadonlyArray { // $FlowFixMe[incompatible-type] return getChildNodes( node, diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js index 9917fa7b18c..1d5fc27d75c 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js @@ -297,7 +297,7 @@ setPlatformObject(ReadOnlyNode); export function getChildNodes( node: ReadOnlyNode, filter?: (node: ReadOnlyNode) => boolean, -): $ReadOnlyArray { +): ReadonlyArray { const shadowNode = getNativeNodeReference(node); if (shadowNode == null) { @@ -319,7 +319,7 @@ export function getChildNodes( function getNodeSiblingsAndPosition( node: ReadOnlyNode, -): [$ReadOnlyArray, number] { +): [ReadonlyArray, number] { const parent = node.parentNode; if (parent == null) { // This node is the root or it's disconnected. 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 22c88974885..28f9e4419d3 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 @@ -58,7 +58,7 @@ export interface Spec extends TurboModule { +getChildNodes: ( nativeNodeReference: unknown /* NativeNodeReference */, - ) => $ReadOnlyArray /* $ReadOnlyArray */; + ) => ReadonlyArray /* $ReadOnlyArray */; +getElementById?: ( nativeNodeReference: unknown /* NativeNodeReference */, @@ -79,24 +79,24 @@ export interface Spec extends TurboModule { +getBorderWidth: ( nativeElementReference: unknown /* NativeElementReference */, - ) => $ReadOnlyArray /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */; + ) => ReadonlyArray /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */; +getBoundingClientRect: ( nativeElementReference: unknown /* NativeElementReference */, includeTransform: boolean, - ) => $ReadOnlyArray /* [x: number, y: number, width: number, height: number] */; + ) => ReadonlyArray /* [x: number, y: number, width: number, height: number] */; +getInnerSize: ( nativeElementReference: unknown /* NativeElementReference */, - ) => $ReadOnlyArray /* [width: number, height: number] */; + ) => ReadonlyArray /* [width: number, height: number] */; +getScrollPosition: ( nativeElementReference: unknown /* NativeElementReference */, - ) => $ReadOnlyArray /* [scrollLeft: number, scrollTop: number] */; + ) => ReadonlyArray /* [scrollLeft: number, scrollTop: number] */; +getScrollSize: ( nativeElementReference: unknown /* NativeElementReference */, - ) => $ReadOnlyArray /* [scrollWidth: number, scrollHeight: number] */; + ) => ReadonlyArray /* [scrollWidth: number, scrollHeight: number] */; +getTagName: ( nativeElementReference: unknown /* NativeElementReference */, @@ -127,7 +127,7 @@ export interface Spec extends TurboModule { +getOffset: ( nativeElementReference: unknown /* NativeElementReference */, - ) => $ReadOnlyArray /* [offsetParent: ?InstanceHandle, top: number, left: number] */; + ) => ReadonlyArray /* [offsetParent: ?InstanceHandle, top: number, left: number] */; /* * Special methods to handle the root node. @@ -199,7 +199,7 @@ export interface RefinedSpec { */ +getChildNodes: ( nativeNodeReference: NativeNodeReference, - ) => $ReadOnlyArray; + ) => ReadonlyArray; /** * This is a React Native implementation of `Document.prototype.getElementById` diff --git a/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js b/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js index 92c66ee75af..2688b799af6 100644 --- a/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +++ b/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js @@ -35,7 +35,7 @@ export default class HTMLCollection implements Iterable, ArrayLike { * @private This is not defined in the declaration file, so users will not see * the signature of the constructor. */ - constructor(elements: $ReadOnlyArray) { + constructor(elements: ReadonlyArray) { for (let i = 0; i < elements.length; i++) { REUSABLE_PROPERTY_DESCRIPTOR.value = elements[i]; Object.defineProperty(this, i, REUSABLE_PROPERTY_DESCRIPTOR); @@ -82,7 +82,7 @@ setPlatformObject(HTMLCollection); * `HTMLCollection.js.flow`, not here. */ export function createHTMLCollection( - elements: $ReadOnlyArray, + elements: ReadonlyArray, ): HTMLCollection { return new HTMLCollection(elements); } diff --git a/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js.flow b/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js.flow index b4374fe4d2a..b024dfc9c68 100644 --- a/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js.flow +++ b/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js.flow @@ -25,5 +25,5 @@ declare export default class HTMLCollection<+T> } declare export function createHTMLCollection( - elements: $ReadOnlyArray, + elements: ReadonlyArray, ): HTMLCollection; diff --git a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js index a2443eaccc2..4d19d1659ce 100644 --- a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js +++ b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js @@ -37,7 +37,7 @@ export default class NodeList implements Iterable, ArrayLike { * @private This is not defined in the declaration file, so users will not see * the signature of the constructor. */ - constructor(elements: $ReadOnlyArray) { + constructor(elements: ReadonlyArray) { for (let i = 0; i < elements.length; i++) { REUSABLE_PROPERTY_DESCRIPTOR.value = elements[i]; Object.defineProperty(this, i, REUSABLE_PROPERTY_DESCRIPTOR); @@ -105,6 +105,6 @@ setPlatformObject(NodeList); * We can do that because the external definition of `NodeList` lives in * `NodeList.js.flow`, not here. */ -export function createNodeList(elements: $ReadOnlyArray): NodeList { +export function createNodeList(elements: ReadonlyArray): NodeList { return new NodeList(elements); } diff --git a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow index 1c664786a4e..ee11d7060e9 100644 --- a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow +++ b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow @@ -30,5 +30,5 @@ declare export default class NodeList<+T> implements Iterable, ArrayLike { } declare export function createNodeList( - elements: $ReadOnlyArray, + elements: ReadonlyArray, ): NodeList; diff --git a/packages/react-native/src/private/webapis/geometry/DOMRectList.js b/packages/react-native/src/private/webapis/geometry/DOMRectList.js index 5da2966747a..e56ba2f053a 100644 --- a/packages/react-native/src/private/webapis/geometry/DOMRectList.js +++ b/packages/react-native/src/private/webapis/geometry/DOMRectList.js @@ -29,7 +29,7 @@ export default class DOMRectList implements Iterable { * @private This is not defined in the declaration file, so users will not see * the signature of the constructor. */ - constructor(elements: $ReadOnlyArray) { + constructor(elements: ReadonlyArray) { for (let i = 0; i < elements.length; i++) { Object.defineProperty(this, i, { value: elements[i], @@ -73,7 +73,7 @@ setPlatformObject(DOMRectList); * `DOMRectList.js.flow`, not here. */ export function createDOMRectList( - elements: $ReadOnlyArray, + elements: ReadonlyArray, ): DOMRectList { return new DOMRectList(elements); } diff --git a/packages/react-native/src/private/webapis/geometry/DOMRectList.js.flow b/packages/react-native/src/private/webapis/geometry/DOMRectList.js.flow index 863d43e1e6d..1e31dc9093c 100644 --- a/packages/react-native/src/private/webapis/geometry/DOMRectList.js.flow +++ b/packages/react-native/src/private/webapis/geometry/DOMRectList.js.flow @@ -23,5 +23,5 @@ declare export default class DOMRectList } declare export function createDOMRectList( - domRects: $ReadOnlyArray, + domRects: ReadonlyArray, ): DOMRectList; diff --git a/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js b/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js index 00a8f6cc7d6..2d723e8cd7a 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserver.js @@ -25,7 +25,7 @@ export type IntersectionObserverCallback = ( export interface IntersectionObserverInit { root?: ?ReactNativeElement; rootMargin?: string; - threshold?: number | $ReadOnlyArray; + threshold?: number | ReadonlyArray; /** * This is a React Native specific option (not spec compliant) that specifies @@ -37,7 +37,7 @@ export interface IntersectionObserverInit { * Note: If `rnRootThreshold` is set, and `threshold` is not set, * `threshold` will not default to [0] (as per spec) */ - rnRootThreshold?: number | $ReadOnlyArray; + rnRootThreshold?: number | ReadonlyArray; } /** @@ -62,10 +62,10 @@ export interface IntersectionObserverInit { */ export default class IntersectionObserver { _callback: IntersectionObserverCallback; - _thresholds: $ReadOnlyArray; + _thresholds: ReadonlyArray; _observationTargets: Set = new Set(); _intersectionObserverId: ?IntersectionObserverId; - _rootThresholds: $ReadOnlyArray | null; + _rootThresholds: ReadonlyArray | null; _root: ReactNativeElement | null; _rootMargin: string; @@ -155,7 +155,7 @@ export default class IntersectionObserver { * If no value was passed to the constructor, and no `rnRootThreshold` * is set, `0` is used. */ - get thresholds(): $ReadOnlyArray { + get thresholds(): ReadonlyArray { return this._thresholds; } @@ -166,7 +166,7 @@ export default class IntersectionObserver { * Notifications for a target are generated when any of the thresholds specified * in `rnRootThreshold` or `threshold` are crossed for that target. */ - get rnRootThresholds(): $ReadOnlyArray | null { + get rnRootThresholds(): ReadonlyArray | null { return this._rootThresholds; } @@ -317,7 +317,7 @@ setPlatformObject(IntersectionObserver); function normalizeThreshold( threshold: unknown, defaultEmpty: boolean = false, -): $ReadOnlyArray { +): ReadonlyArray { if (Array.isArray(threshold)) { if (threshold.length > 0) { return threshold @@ -354,7 +354,7 @@ function normalizeThreshold( */ function normalizeRootThreshold( rootThreshold: unknown, -): null | $ReadOnlyArray { +): null | ReadonlyArray { if (Array.isArray(rootThreshold)) { const normalizedArr = rootThreshold .map(rt => normalizeThresholdValue(rt, 'rnRootThreshold')) diff --git a/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js b/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js index ebadf4ac09b..cbe579b8274 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js @@ -15,10 +15,10 @@ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/Turbo export type NativeIntersectionObserverEntry = { intersectionObserverId: number, targetInstanceHandle: unknown, - targetRect: $ReadOnlyArray, // It's actually a tuple with x, y, width and height - rootRect: $ReadOnlyArray, // It's actually a tuple with x, y, width and height + targetRect: ReadonlyArray, // It's actually a tuple with x, y, width and height + rootRect: ReadonlyArray, // It's actually a tuple with x, y, width and height // TODO(T209328432) - Remove optionality of intersectionRect when native changes are released - intersectionRect: ?$ReadOnlyArray, // It's actually a tuple with x, y, width and height + intersectionRect: ?ReadonlyArray, // It's actually a tuple with x, y, width and height isIntersectingAboveThresholds: boolean, time: number, }; @@ -27,8 +27,8 @@ export type NativeIntersectionObserverObserveOptions = { intersectionObserverId: number, rootShadowNode?: ?unknown, targetShadowNode: unknown, - thresholds: $ReadOnlyArray, - rootThresholds?: ?$ReadOnlyArray, + thresholds: ReadonlyArray, + rootThresholds?: ?ReadonlyArray, rootMargin?: ?string, }; @@ -44,7 +44,7 @@ export interface Spec extends TurboModule { ) => void; +connect: (notifyIntersectionObserversCallback: () => void) => void; +disconnect: () => void; - +takeRecords: () => $ReadOnlyArray; + +takeRecords: () => ReadonlyArray; } export default (TurboModuleRegistry.get( diff --git a/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js b/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js index daca50a9970..9917c88a7a9 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js +++ b/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js @@ -18,7 +18,7 @@ import {setPlatformObject} from '../webidl/PlatformObjects'; import * as MutationObserverManager from './internals/MutationObserverManager'; export type MutationObserverCallback = ( - mutationRecords: $ReadOnlyArray, + mutationRecords: ReadonlyArray, observer: MutationObserver, ) => unknown; @@ -29,7 +29,7 @@ export interface MutationObserverInit { // Unsupported: +attributes?: boolean; - +attributeFilter?: $ReadOnlyArray; + +attributeFilter?: ReadonlyArray; +attributeOldValue?: boolean; +characterData?: boolean; +characterDataOldValue?: boolean; diff --git a/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js b/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js index 42f7812c21a..01da2b1fce9 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js +++ b/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js @@ -35,9 +35,9 @@ export default class MutationRecord { const target: ReactNativeElement = nativeRecord.target; this._target = target; // $FlowExpectedError[incompatible-type] the codegen doesn't support the actual type. - const addedNodes: $ReadOnlyArray = nativeRecord.addedNodes; + const addedNodes: ReadonlyArray = nativeRecord.addedNodes; this._addedNodes = createNodeList(addedNodes); - const removedNodes: $ReadOnlyArray = + const removedNodes: ReadonlyArray = // $FlowFixMe[incompatible-type] nativeRecord.removedNodes; this._removedNodes = createNodeList(removedNodes); diff --git a/packages/react-native/src/private/webapis/mutationobserver/__tests__/MutationObserver-itest.js b/packages/react-native/src/private/webapis/mutationobserver/__tests__/MutationObserver-itest.js index 2d798c5d200..5cd58243420 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/__tests__/MutationObserver-itest.js +++ b/packages/react-native/src/private/webapis/mutationobserver/__tests__/MutationObserver-itest.js @@ -35,7 +35,7 @@ function ensureReactNativeElement(value: unknown): ReactNativeElement { function ensureMutationRecordArray( value: unknown, -): $ReadOnlyArray { +): ReadonlyArray { return ensureInstance(value, Array).map((element: unknown) => ensureInstance(element, MutationRecord), ); @@ -239,7 +239,7 @@ describe('MutationObserver', () => { const node = ensureReactNativeElement(nodeRef.current); const observerCallbackCallArgs = []; - const observerCallback = (...args: $ReadOnlyArray) => { + const observerCallback = (...args: ReadonlyArray) => { observerCallbackCallArgs.push(args); }; const observer = new MutationObserver(observerCallback); diff --git a/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js b/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js index aa0823f11b0..ade4886087f 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +++ b/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js @@ -23,8 +23,8 @@ type ReadOnlyNode = unknown; export type NativeMutationRecord = { mutationObserverId: MutationObserverId, target: ReactNativeElement, - addedNodes: $ReadOnlyArray, - removedNodes: $ReadOnlyArray, + addedNodes: ReadonlyArray, + removedNodes: ReadonlyArray, ... }; @@ -47,7 +47,7 @@ export interface Spec extends TurboModule { ) => ReadOnlyNode, ) => void; +disconnect: () => void; - +takeRecords: () => $ReadOnlyArray; + +takeRecords: () => ReadonlyArray; } export default (TurboModuleRegistry.get( diff --git a/packages/react-native/src/private/webapis/performance/LongTasks.js b/packages/react-native/src/private/webapis/performance/LongTasks.js index d5267c89df7..2238444db5f 100644 --- a/packages/react-native/src/private/webapis/performance/LongTasks.js +++ b/packages/react-native/src/private/webapis/performance/LongTasks.js @@ -18,7 +18,7 @@ import {PerformanceEntry} from './PerformanceEntry'; export type PerformanceLongTaskTimingJSON = { ...PerformanceEntryJSON, - attribution: $ReadOnlyArray, + attribution: ReadonlyArray, ... }; @@ -36,7 +36,7 @@ export const TaskAttributionTiming_public: typeof TaskAttributionTiming = // $FlowExpectedError[prop-missing] TaskAttributionTiming_public.prototype = TaskAttributionTiming.prototype; -const EMPTY_ATTRIBUTION: $ReadOnlyArray = +const EMPTY_ATTRIBUTION: ReadonlyArray = Object.preventExtensions([]); export interface PerformanceLongTaskTimingInit extends PerformanceEntryInit {} @@ -46,7 +46,7 @@ export class PerformanceLongTaskTiming extends PerformanceEntry { super('longtask', init); } - get attribution(): $ReadOnlyArray { + get attribution(): ReadonlyArray { return EMPTY_ATTRIBUTION; } diff --git a/packages/react-native/src/private/webapis/performance/Performance.js b/packages/react-native/src/private/webapis/performance/Performance.js index af1d3efb981..6a492064fb4 100644 --- a/packages/react-native/src/private/webapis/performance/Performance.js +++ b/packages/react-native/src/private/webapis/performance/Performance.js @@ -53,7 +53,7 @@ export type PerformanceMeasureOptions = end?: DOMHighResTimeStamp | string, }>; -const ENTRY_TYPES_AVAILABLE_FROM_TIMELINE: $ReadOnlyArray = +const ENTRY_TYPES_AVAILABLE_FROM_TIMELINE: ReadonlyArray = ['mark', 'measure']; const NativePerformance = nullthrows(MaybeNativePerformance); diff --git a/packages/react-native/src/private/webapis/performance/PerformanceEntry.js b/packages/react-native/src/private/webapis/performance/PerformanceEntry.js index 03e4b678956..550f6b8ff8b 100644 --- a/packages/react-native/src/private/webapis/performance/PerformanceEntry.js +++ b/packages/react-native/src/private/webapis/performance/PerformanceEntry.js @@ -91,4 +91,4 @@ PerformanceEntry_public.prototype = PerformanceEntry.prototype; setPlatformObject(PerformanceEntry); -export type PerformanceEntryList = $ReadOnlyArray; +export type PerformanceEntryList = ReadonlyArray; diff --git a/packages/react-native/src/private/webapis/performance/PerformanceObserver.js b/packages/react-native/src/private/webapis/performance/PerformanceObserver.js index 375c49a42d4..c1b2a47a0ba 100644 --- a/packages/react-native/src/private/webapis/performance/PerformanceObserver.js +++ b/packages/react-native/src/private/webapis/performance/PerformanceObserver.js @@ -88,7 +88,7 @@ export interface PerformanceObserverInit { +durationThreshold?: DOMHighResTimeStamp; } -function getSupportedPerformanceEntryTypes(): $ReadOnlyArray { +function getSupportedPerformanceEntryTypes(): ReadonlyArray { return Object.freeze( NativePerformance.getSupportedPerformanceEntryTypes().map( rawToPerformanceEntryType, @@ -237,7 +237,7 @@ export class PerformanceObserver { } } - static supportedEntryTypes: $ReadOnlyArray = + static supportedEntryTypes: ReadonlyArray = getSupportedPerformanceEntryTypes(); } diff --git a/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js b/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js index 9bb167da1b1..47025dd3906 100644 --- a/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js +++ b/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js @@ -46,10 +46,10 @@ export opaque type OpaqueNativeObserverHandle = unknown; export type NativeBatchedObserverCallback = () => void; export type NativePerformanceMarkResult = number; -export type NativePerformanceMeasureResult = $ReadOnlyArray; // [startTime, duration] +export type NativePerformanceMeasureResult = ReadonlyArray; // [startTime, duration] export type PerformanceObserverInit = { - entryTypes?: $ReadOnlyArray, + entryTypes?: ReadonlyArray, type?: number, buffered?: boolean, durationThreshold?: number, @@ -69,15 +69,15 @@ export interface Spec extends TurboModule { +getMarkTime: (name: string) => ?number; +clearMarks: (entryName?: string) => void; +clearMeasures: (entryName?: string) => void; - +getEntries: () => $ReadOnlyArray; + +getEntries: () => ReadonlyArray; +getEntriesByName: ( entryName: string, entryType?: ?RawPerformanceEntryType, - ) => $ReadOnlyArray; + ) => ReadonlyArray; +getEntriesByType: ( entryType: RawPerformanceEntryType, - ) => $ReadOnlyArray; - +getEventCounts: () => $ReadOnlyArray<[string, number]>; + ) => ReadonlyArray; + +getEventCounts: () => ReadonlyArray<[string, number]>; +getSimpleMemoryInfo: () => NativeMemoryInfo; +getReactNativeStartupTiming: () => ReactNativeStartupTiming; @@ -94,9 +94,9 @@ export interface Spec extends TurboModule { +takeRecords: ( observer: OpaqueNativeObserverHandle, sort: boolean, - ) => $ReadOnlyArray; + ) => ReadonlyArray; - +getSupportedPerformanceEntryTypes: () => $ReadOnlyArray; + +getSupportedPerformanceEntryTypes: () => ReadonlyArray; +clearEventCountsForTesting: () => void; } diff --git a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js index f75ccb355b0..4a47880084f 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js @@ -57,7 +57,7 @@ export function callNativeMethodToChangeBackgroundColor( export function callNativeMethodToAddOverlays( viewRef: React.ElementRef | null, - overlayColors: $ReadOnlyArray, + overlayColors: ReadonlyArray, ) { if (!viewRef) { console.log('viewRef is null'); diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js index 8487b4e2bc0..093b8d80af7 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js @@ -14,14 +14,14 @@ import * as React from 'react'; import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type Event = Readonly<{ - values: $ReadOnlyArray, - boolValues: $ReadOnlyArray, - floats: $ReadOnlyArray, - doubles: $ReadOnlyArray, - yesNos: $ReadOnlyArray<'yep' | 'nope'>, - strings: $ReadOnlyArray, - latLons: $ReadOnlyArray<{lat: CodegenTypes.Double, lon: CodegenTypes.Double}>, - multiArrays: $ReadOnlyArray<$ReadOnlyArray>, + values: ReadonlyArray, + boolValues: ReadonlyArray, + floats: ReadonlyArray, + doubles: ReadonlyArray, + yesNos: ReadonlyArray<'yep' | 'nope'>, + strings: ReadonlyArray, + latLons: ReadonlyArray<{lat: CodegenTypes.Double, lon: CodegenTypes.Double}>, + multiArrays: ReadonlyArray>, }>; type LegacyStyleEvent = Readonly<{ @@ -31,7 +31,7 @@ type LegacyStyleEvent = Readonly<{ type NativeProps = Readonly<{ ...ViewProps, opacity?: CodegenTypes.Float, - values: $ReadOnlyArray, + values: ReadonlyArray, // Events onIntArrayChanged?: ?CodegenTypes.BubblingEventHandler, @@ -51,7 +51,7 @@ interface NativeCommands { +callNativeMethodToAddOverlays: ( viewRef: React.ElementRef, - overlayColors: $ReadOnlyArray, + overlayColors: ReadonlyArray, ) => void; +callNativeMethodToRemoveOverlays: ( diff --git a/packages/rn-tester/js/components/RNTesterExampleFilter.js b/packages/rn-tester/js/components/RNTesterExampleFilter.js index b7835692de1..4dc4c556a9a 100644 --- a/packages/rn-tester/js/components/RNTesterExampleFilter.js +++ b/packages/rn-tester/js/components/RNTesterExampleFilter.js @@ -30,7 +30,7 @@ type Props = { testID?: string, hideFilterPills?: boolean, page: 'examples_page' | 'components_page', - sections: $ReadOnlyArray>, + sections: ReadonlyArray>, ... }; @@ -81,7 +81,7 @@ class RNTesterExampleFilter extends React.Component, State> { } _renderFilteredSections( - filteredSections: $ReadOnlyArray<{ + filteredSections: ReadonlyArray<{ data: Array, key: string, title: string, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js index fa81bc61873..4ba3617667e 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js @@ -19,7 +19,7 @@ import {StyleSheet, Text, View} from 'react-native'; type Props = Readonly<{ title: string, description: string, - instructions?: $ReadOnlyArray, + instructions?: ReadonlyArray, component: React.ComponentType, }>; diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js index a704a67212d..4c71347d85b 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestEventRecorder.js @@ -102,7 +102,7 @@ export default class RNTesterPlatformTestEventRecorder { } createRecorderTestEventHandlers( - targetNames: $ReadOnlyArray, + targetNames: ReadonlyArray, callback?: (event: Object, eventType: string, targetName: string) => void, ): Readonly<{[targetName: string]: ViewProps}> { const result: {[targetName: string]: ViewProps} = {}; @@ -171,7 +171,7 @@ export default class RNTesterPlatformTestEventRecorder { export function useRecorderTestEventHandlers( eventRecorder: RNTesterPlatformTestEventRecorder, - targetNames: $ReadOnlyArray, + targetNames: ReadonlyArray, callback?: (event: Object, eventType: string, targetName: string) => void, ): Readonly<{[targetName: string]: ViewProps}> { return useMemo( diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js index 98bd0726bba..5bf85d98ba8 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js @@ -14,7 +14,7 @@ import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; type Props = Readonly<{ - instructions?: $ReadOnlyArray, + instructions?: ReadonlyArray, style?: ?ViewStyleProp, }>; export default function RNTesterPlatformTestInstructions({ diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js index b4716abc957..0b814621eb6 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js @@ -179,7 +179,7 @@ function renderTableRow({item}: ListRenderItemInfo) { type Props = Readonly<{ numPending: number, reset: () => void, - results: $ReadOnlyArray, + results: ReadonlyArray, style?: ?ViewStyleProp, }>; export default function RNTesterPlatformTestResultView( diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js index 0ecba3d2487..a17182b7e4d 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js @@ -33,7 +33,7 @@ export type PlatformTestResultStatus = 'PASS' | 'FAIL' | 'ERROR' | 'SKIPPED'; export type PlatformTestResult = Readonly<{ name: string, status: PlatformTestResultStatus, - assertions: $ReadOnlyArray, + assertions: ReadonlyArray, error: unknown | null, // null is technically unnecessary but is kept to ensure the error is described as nullable }>; diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js index 0f8c88ddc67..a4f21b2ec02 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js @@ -136,12 +136,12 @@ export type PlatformTestHarnessHookResult = Readonly<{ harness: PlatformTestHarness, numPending: number, reset: () => void, - results: $ReadOnlyArray, + results: ReadonlyArray, }>; export default function usePlatformTestHarness(): PlatformTestHarnessHookResult { const [testResults, updateTestResults] = useState< - $ReadOnlyArray, + ReadonlyArray, >([]); // Since updating the test results array can get expensive at larger sizes diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js index 419cda04fc3..7509fe8b5a9 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js @@ -212,7 +212,7 @@ export function check_PointerEvent( * view events with the same handler */ export function useTestEventHandler( - eventNames: $ReadOnlyArray, + eventNames: ReadonlyArray, handler: (event: any, eventName: string) => void, ): ViewProps { const eventProps: any = useMemo(() => { diff --git a/packages/rn-tester/js/examples/Image/ImageExample.js b/packages/rn-tester/js/examples/Image/ImageExample.js index a1da1e93132..615743285e8 100644 --- a/packages/rn-tester/js/examples/Image/ImageExample.js +++ b/packages/rn-tester/js/examples/Image/ImageExample.js @@ -87,7 +87,7 @@ const NetworkImageCallbackExample = ({ source, prefetchedSource, }: NetworkImageCallbackExampleProps): React.Node => { - const [events, setEvents] = useState<$ReadOnlyArray>([]); + const [events, setEvents] = useState>([]); const [startLoadPrefetched, setStartLoadPrefetched] = useState(false); const [mountTime, setMountTime] = useState(Date.now()); @@ -197,7 +197,7 @@ const NetworkImageCallbackExample = ({ type NetworkImageExampleState = { error: ?string, loading: boolean, - progress: $ReadOnlyArray, + progress: ReadonlyArray, }; class NetworkImageExample extends React.Component< diff --git a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingParent.js b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingParent.js index ce4f3e12bcd..09ba32a1f19 100644 --- a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingParent.js +++ b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingParent.js @@ -72,7 +72,7 @@ function IntersectionObserverCustomClippingRootExample(): React.Node { const [rootMarginValue, setRootMarginValue] = useState('0px'); const onObserve = useCallback( - (entries: $ReadOnlyArray) => { + (entries: ReadonlyArray) => { entries.forEach(entry => { setIntersectionEntry(entry); }); diff --git a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingRoot.js b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingRoot.js index 3bf9c3af192..02c832aeb24 100644 --- a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingRoot.js +++ b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverClippingRoot.js @@ -77,7 +77,7 @@ function IntersectionObserverClippingRootExample(): React.Node { }, [rootMarginInput]); const onObserve = useCallback( - (entries: $ReadOnlyArray) => { + (entries: ReadonlyArray) => { entries.forEach(entry => { setIntersectionEntry(entry); }); diff --git a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverExplicitRoot.js b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverExplicitRoot.js index f569b586523..3bddaaa610c 100644 --- a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverExplicitRoot.js +++ b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverExplicitRoot.js @@ -75,7 +75,7 @@ function IntersectionObserverExplicitRootExample(): React.Node { [position], ); const onObserve = useCallback( - (entries: $ReadOnlyArray) => { + (entries: ReadonlyArray) => { entries.forEach(entry => { setIntersectionRatio(entry.intersectionRatio); }); diff --git a/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js index cc8f8c4f296..09fea74bd42 100644 --- a/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js +++ b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js @@ -79,7 +79,7 @@ function StartupTimingExample(): React.Node { } function PerformanceObserverUserTimingExample(): React.Node { - const [entries, setEntries] = useState<$ReadOnlyArray>([]); + const [entries, setEntries] = useState>([]); useEffect(() => { const observer = new PerformanceObserver(list => { @@ -131,13 +131,13 @@ function PerformanceObserverUserTimingExample(): React.Node { function PerformanceObserverEventTimingExample(): React.Node { const [count, setCount] = useState(0); - const [entries, setEntries] = useState< - $ReadOnlyArray, - >([]); + const [entries, setEntries] = useState>( + [], + ); useEffect(() => { const observer = new PerformanceObserver(list => { - const newEntries: $ReadOnlyArray = + const newEntries: ReadonlyArray = // $FlowExpectedError[incompatible-type] This is guaranteed because we're only observing `event` entry types. list.getEntries(); setEntries(newEntries); @@ -182,7 +182,7 @@ function PerformanceObserverEventTimingExample(): React.Node { } function PerformanceObserverLongtaskExample(): React.Node { - const [entries, setEntries] = useState<$ReadOnlyArray>([]); + const [entries, setEntries] = useState>([]); useEffect(() => { const observer = new PerformanceObserver(list => { diff --git a/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js b/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js index 6926a8c9428..c05b3062f20 100644 --- a/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js +++ b/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js @@ -68,7 +68,7 @@ class Row extends React.Component< type RefreshControlExampleState = Readonly<{ isRefreshing: boolean, loaded: number, - rowData: $ReadOnlyArray, + rowData: ReadonlyArray, }>; class RefreshControlExample extends React.Component< diff --git a/packages/rn-tester/js/examples/Text/TextSharedExamples.js b/packages/rn-tester/js/examples/Text/TextSharedExamples.js index 8974df2892c..5536c744956 100644 --- a/packages/rn-tester/js/examples/Text/TextSharedExamples.js +++ b/packages/rn-tester/js/examples/Text/TextSharedExamples.js @@ -271,4 +271,4 @@ export default [ description: 'Shows the a11y behavior of Text with role="link"', render: TextWithLinkRoleExample, }, -] as $ReadOnlyArray; +] as ReadonlyArray; diff --git a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js index 5ebc81ad1e2..47849ca8405 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js @@ -748,9 +748,9 @@ const TextStylesExample = memo(() => { }); type TextStylesContainerProps = { - examples: $ReadOnlyArray<{ + examples: ReadonlyArray<{ name: string, - textStyles: $ReadOnlyArray, + textStyles: ReadonlyArray, multiline?: boolean, }>, }; @@ -793,7 +793,7 @@ function TextStylesContainer({examples}: TextStylesContainerProps) { type StyledTextInputProps = { name: string, - textStyles: $ReadOnlyArray, + textStyles: ReadonlyArray, styleOffset: number, }; diff --git a/packages/rn-tester/js/types/RNTesterTypes.js b/packages/rn-tester/js/types/RNTesterTypes.js index 08a9b4e8a9c..181861d4421 100644 --- a/packages/rn-tester/js/types/RNTesterTypes.js +++ b/packages/rn-tester/js/types/RNTesterTypes.js @@ -48,8 +48,8 @@ export type SectionData = { }; export type ExamplesList = Readonly<{ - components: $ReadOnlyArray>, - apis: $ReadOnlyArray>, + components: ReadonlyArray>, + apis: ReadonlyArray>, }>; export type ScreenTypes = 'components' | 'apis' | 'playgrounds' | null; diff --git a/packages/virtualized-lists/Lists/CellRenderMask.js b/packages/virtualized-lists/Lists/CellRenderMask.js index 6258838c116..8c7e110857e 100644 --- a/packages/virtualized-lists/Lists/CellRenderMask.js +++ b/packages/virtualized-lists/Lists/CellRenderMask.js @@ -41,7 +41,7 @@ export class CellRenderMask { } } - enumerateRegions(): $ReadOnlyArray { + enumerateRegions(): ReadonlyArray { return this._regions; } diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index 7ba53aaa075..7a48d91be4d 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -509,7 +509,7 @@ class VirtualizedList extends StateSafePureComponent< static _createRenderMask( props: VirtualizedListProps, cellsAroundViewport: {first: number, last: number}, - additionalRegions?: ?$ReadOnlyArray<{first: number, last: number}>, + additionalRegions?: ?ReadonlyArray<{first: number, last: number}>, ): CellRenderMask { const itemCount = props.getItemCount(props.data); @@ -1952,7 +1952,7 @@ class VirtualizedList extends StateSafePureComponent< _getNonViewportRenderRegions = ( props: CellMetricProps, - ): $ReadOnlyArray<{ + ): ReadonlyArray<{ first: number, last: number, }> => { diff --git a/packages/virtualized-lists/Lists/VirtualizedSectionList.js b/packages/virtualized-lists/Lists/VirtualizedSectionList.js index 408e6491be4..ff18b2222ee 100644 --- a/packages/virtualized-lists/Lists/VirtualizedSectionList.js +++ b/packages/virtualized-lists/Lists/VirtualizedSectionList.js @@ -31,7 +31,7 @@ export type SectionBase = { /** * The data for rendering items in this section. */ - data: $ReadOnlyArray, + data: ReadonlyArray, /** * Optional key to keep track of section re-ordering. If you don't plan on re-ordering sections, * the array index will be used by default. @@ -59,7 +59,7 @@ type RequiredVirtualizedSectionListProps< ItemT, SectionT = DefaultVirtualizedSectionT, > = { - sections: $ReadOnlyArray>, + sections: ReadonlyArray>, }; type OptionalVirtualizedSectionListProps< @@ -228,7 +228,7 @@ class VirtualizedSectionList< _getItem( props: VirtualizedSectionListProps, - sections: ?$ReadOnlyArray>, + sections: ?ReadonlyArray>, index: number, ): ?ItemT { if (!sections) { diff --git a/private/helloworld/lib/filesystem.js b/private/helloworld/lib/filesystem.js index baf7c19394d..9da1fce9805 100644 --- a/private/helloworld/lib/filesystem.js +++ b/private/helloworld/lib/filesystem.js @@ -52,7 +52,7 @@ export async function pauseWatchman(command: () => Promise) { export function getExistingPath( folder: string, - paths: $ReadOnlyArray, + paths: ReadonlyArray, ): string | null { for (const p of paths) { if (existsSync(path.join(folder, p))) { diff --git a/private/react-native-fantom/runner/executables/hermesc.js b/private/react-native-fantom/runner/executables/hermesc.js index cea3934a8ae..ebef91248eb 100644 --- a/private/react-native-fantom/runner/executables/hermesc.js +++ b/private/react-native-fantom/runner/executables/hermesc.js @@ -74,7 +74,7 @@ export function build(options: TesterOptions): void { } export function run( - args: $ReadOnlyArray, + args: ReadonlyArray, options: TesterOptions, ): SyncCommandResult { if (!isCI) { diff --git a/private/react-native-fantom/runner/executables/tester.js b/private/react-native-fantom/runner/executables/tester.js index bed44b2a610..634f89d6fc0 100644 --- a/private/react-native-fantom/runner/executables/tester.js +++ b/private/react-native-fantom/runner/executables/tester.js @@ -79,7 +79,7 @@ export function build(options: TesterOptions): void { } export function run( - args: $ReadOnlyArray, + args: ReadonlyArray, options: TesterOptions, ): AsyncCommandResult { if (isCI && debugCpp) { diff --git a/private/react-native-fantom/runner/getFantomTestConfigs.js b/private/react-native-fantom/runner/getFantomTestConfigs.js index de4d5caf622..b902fead1d2 100644 --- a/private/react-native-fantom/runner/getFantomTestConfigs.js +++ b/private/react-native-fantom/runner/getFantomTestConfigs.js @@ -434,7 +434,7 @@ export default function getFantomTestConfigs( function getConfigurationVariations( config: FantomTestConfig, - variations: $ReadOnlyArray<$ReadOnlyArray>, + variations: ReadonlyArray>, ): Array { if (variations.length === 0) { return [config]; diff --git a/private/react-native-fantom/runner/utils.js b/private/react-native-fantom/runner/utils.js index bcc51cb5653..65dbe6a92f1 100644 --- a/private/react-native-fantom/runner/utils.js +++ b/private/react-native-fantom/runner/utils.js @@ -26,7 +26,7 @@ export enum HermesVariant { export function getBuckOptionsForHermes( variant: HermesVariant, -): $ReadOnlyArray { +): ReadonlyArray { const baseOptions = EnvironmentOptions.enableJSMemoryInstrumentation ? ['-c hermes.memory_instrumentation=true'] : []; @@ -53,7 +53,7 @@ export function getHermesCompilerTarget(variant: HermesVariant): string { export function getBuckModesForPlatform( enableRelease: boolean = false, -): $ReadOnlyArray { +): ReadonlyArray { let modes = ['@//xplat/mode/react-native/granite']; if (enableRelease) { modes.push('@//xplat/mode/hermes/opt'); @@ -110,7 +110,7 @@ export function getBuckModesForPlatform( } // TODO: T240293839 Remove when we get rid of RN_USE_ANIMATION_BACKEND preprocessor flag -export function getConfigForAnimationBackend(): $ReadOnlyArray { +export function getConfigForAnimationBackend(): ReadonlyArray { return ['-c rn.use_animationbackend=true']; } @@ -136,7 +136,7 @@ export type SyncCommandResult = { stderr: string, }; -function maybeLogCommand(command: string, args: $ReadOnlyArray): void { +function maybeLogCommand(command: string, args: ReadonlyArray): void { if (EnvironmentOptions.logCommands) { console.log(`RUNNING \`${command} ${args.join(' ')}\``); } @@ -144,7 +144,7 @@ function maybeLogCommand(command: string, args: $ReadOnlyArray): void { export function runCommand( command: string, - args: $ReadOnlyArray, + args: ReadonlyArray, ): AsyncCommandResult { maybeLogCommand(command, args); @@ -188,7 +188,7 @@ export function runCommand( export function runCommandSync( command: string, - args: $ReadOnlyArray, + args: ReadonlyArray, ): SyncCommandResult { maybeLogCommand(command, args); diff --git a/private/react-native-fantom/src/Benchmark.js b/private/react-native-fantom/src/Benchmark.js index ddfa4f71948..ce272a765e9 100644 --- a/private/react-native-fantom/src/Benchmark.js +++ b/private/react-native-fantom/src/Benchmark.js @@ -48,7 +48,7 @@ export type TestTaskTiming = { export type BenchmarkResult = { type: string, - timings: $ReadOnlyArray, + timings: ReadonlyArray, }; type InternalTestOptions = Readonly<{ @@ -66,13 +66,13 @@ type TestWithArgOptions = interface ParameterizedTestFunction { ( - testArgs: $ReadOnlyArray, + testArgs: ReadonlyArray, name: TestWithArgName, fn: (testArg: TestArgType) => ReturnType, options?: TestWithArgOptions, ): SuiteAPI; only: ( - testArgs: $ReadOnlyArray, + testArgs: ReadonlyArray, name: TestWithArgName, fn: (testArg: TestArgType) => ReturnType, options?: TestWithArgOptions, @@ -243,7 +243,7 @@ export function suite( // $FlowFixMe[incompatible-type] const testEach: ParameterizedTestFunction = ( - testArgs: $ReadOnlyArray, + testArgs: ReadonlyArray, name: TestWithArgName, fn: (testArg: TestArgType) => ReturnType, options?: TestWithArgOptions, diff --git a/private/react-native-fantom/src/getFantomRenderedOutput.js b/private/react-native-fantom/src/getFantomRenderedOutput.js index 6bae7d91a81..61dffd9e41b 100644 --- a/private/react-native-fantom/src/getFantomRenderedOutput.js +++ b/private/react-native-fantom/src/getFantomRenderedOutput.js @@ -22,14 +22,14 @@ export type RenderOutputConfig = { type FantomJsonObject = { type: string, props: {[key: string]: string}, - children: $ReadOnlyArray, + children: ReadonlyArray, }; -type FantomJson = FantomJsonObject | $ReadOnlyArray; +type FantomJson = FantomJsonObject | ReadonlyArray; type FantomRenderedOutputConfig = { // RegExp patterns to match prop names - props?: $ReadOnlyArray, + props?: ReadonlyArray, }; class FantomRenderedOutput { @@ -133,7 +133,7 @@ export default function getFantomRenderedOutput( } function convertRawJsonToJSX( - actualJSON: FantomJsonObject | $ReadOnlyArray, + actualJSON: FantomJsonObject | ReadonlyArray, ): React.Node { let actualJSX; /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition diff --git a/scripts/js-api/build-types/buildApiSnapshot.js b/scripts/js-api/build-types/buildApiSnapshot.js index 9102075ad56..c808012ebe2 100644 --- a/scripts/js-api/build-types/buildApiSnapshot.js +++ b/scripts/js-api/build-types/buildApiSnapshot.js @@ -30,14 +30,14 @@ const osTempDir = require('temp-dir'); const {globSync} = require('tinyglobby'); const {styleText} = require('util'); -const inputFilesPostTransforms: $ReadOnlyArray> = [ +const inputFilesPostTransforms: ReadonlyArray> = [ require('./transforms/typescript/renameDefaultExportedIdentifiers'), require('./transforms/typescript/stripUnstableApis'), ]; const postTransforms = ( options: BuildApiSnapshotOptions, -): $ReadOnlyArray> => [ +): ReadonlyArray> => [ require('./transforms/typescript/simplifyTypes'), require('./transforms/typescript/sortProperties'), require('./transforms/typescript/sortUnions'), @@ -188,7 +188,7 @@ async function findPackagesWithTypedef() { async function preparePackagesInTempDir( tempDirectory: string, - packages: $ReadOnlyArray<{directory: string, name: string}>, + packages: ReadonlyArray<{directory: string, name: string}>, ) { await generateConfigFiles(tempDirectory); @@ -224,7 +224,7 @@ async function preparePackagesInTempDir( */ async function rewriteLocalImports( tempDirectory: string, - packages: $ReadOnlyArray<{directory: string, name: string}>, + packages: ReadonlyArray<{directory: string, name: string}>, ) { const definitions = globSync('**/*.d.ts', { cwd: tempDirectory, diff --git a/scripts/js-api/build-types/resolution/resolveTypeInputFile.js b/scripts/js-api/build-types/resolution/resolveTypeInputFile.js index bd965c7c79a..bbe66611330 100644 --- a/scripts/js-api/build-types/resolution/resolveTypeInputFile.js +++ b/scripts/js-api/build-types/resolution/resolveTypeInputFile.js @@ -13,7 +13,7 @@ const debug = require('debug')('build-types:resolution'); const fs = require('fs'); const path = require('path'); -const TYPEDEF_MAPPING: Record> = { +const TYPEDEF_MAPPING: Record> = { '.android.js': ['.js.flow', '.js'], '.ios.js': ['.js.flow', '.js'], '.js': ['.js.flow'], diff --git a/scripts/js-api/build-types/templates/translatedModule.d.ts-template.js b/scripts/js-api/build-types/templates/translatedModule.d.ts-template.js index 7dc0414cace..a7abf83ae12 100644 --- a/scripts/js-api/build-types/templates/translatedModule.d.ts-template.js +++ b/scripts/js-api/build-types/templates/translatedModule.d.ts-template.js @@ -17,7 +17,7 @@ function translatedModuleTemplate({ }: { source: string, originalFileName: string, - tripleSlashDirectives: $ReadOnlyArray, + tripleSlashDirectives: ReadonlyArray, }): string { return signedsource.signFile( `/** diff --git a/scripts/js-api/build-types/utils/applyBabelTransformsSeq.js b/scripts/js-api/build-types/utils/applyBabelTransformsSeq.js index 3fdff610cdc..2f7aa9c296c 100644 --- a/scripts/js-api/build-types/utils/applyBabelTransformsSeq.js +++ b/scripts/js-api/build-types/utils/applyBabelTransformsSeq.js @@ -17,7 +17,7 @@ import * as babel from '@babel/core'; */ async function applyBabelTransformsSeq( source: string, - transforms: $ReadOnlyArray>, + transforms: ReadonlyArray>, ): Promise { const parsed = await babel.parseAsync(source, { plugins: ['@babel/plugin-syntax-typescript'], diff --git a/scripts/js-api/build-types/utils/resolveCyclicImportsInDefinition.js b/scripts/js-api/build-types/utils/resolveCyclicImportsInDefinition.js index 5fb10886bd5..56f5af9e76e 100644 --- a/scripts/js-api/build-types/utils/resolveCyclicImportsInDefinition.js +++ b/scripts/js-api/build-types/utils/resolveCyclicImportsInDefinition.js @@ -13,7 +13,7 @@ import type {PluginObj} from '@babel/core'; import * as babel from '@babel/core'; import path from 'path'; -type PackageConfig = $ReadOnlyArray<{ +type PackageConfig = ReadonlyArray<{ directory: string, name: string, }>;