diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index 949a3382b9e120..74f30ba7bd15d6 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -199,7 +199,7 @@ declare module 'buffer' { declare var kMaxLength: number; declare var INSPECT_MAX_BYTES: number; - declare var constants: $ReadOnly<{ + declare var constants: Readonly<{ MAX_LENGTH: number, MAX_STRING_LENGTH: number, }>; @@ -1467,7 +1467,7 @@ declare module 'fs' { path: string, options: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, @@ -1477,7 +1477,7 @@ declare module 'fs' { ): void; declare function readdir( path: string, - options: $ReadOnly<{ + options: Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, @@ -1493,7 +1493,7 @@ declare module 'fs' { path: string, options?: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, @@ -1503,7 +1503,7 @@ declare module 'fs' { path: string, options?: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, @@ -1527,13 +1527,13 @@ declare module 'fs' { ): void; declare function openAsBlob( path: string | Buffer | URL, - options?: $ReadOnly<{ + options?: Readonly<{ type?: string, // Optional MIME type hint }>, ): Promise; declare function opendir( path: string, - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, @@ -1542,7 +1542,7 @@ declare module 'fs' { ): void; declare function opendirSync( path: string, - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, @@ -1770,7 +1770,7 @@ declare module 'fs' { ): void; declare function watchFile( filename: string, - options?: $ReadOnly<{ + options?: Readonly<{ bigint?: boolean, persistent?: boolean, interval?: number, @@ -1787,7 +1787,7 @@ declare module 'fs' { ): FSWatcher; declare function watch( filename: string, - options?: $ReadOnly<{ + options?: Readonly<{ persistent?: boolean, recursive?: boolean, encoding?: string, @@ -1835,7 +1835,7 @@ declare module 'fs' { declare function cp( src: string | URL, dest: string | URL, - options: $ReadOnly<{ + options: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean | Promise, @@ -1855,7 +1855,7 @@ declare module 'fs' { declare function cpSync( src: string | URL, dest: string | URL, - options?: $ReadOnly<{ + options?: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean, @@ -2022,7 +2022,7 @@ declare module 'fs' { chown(uid: number, guid: number): Promise; close(): Promise; createReadStream( - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, @@ -2033,7 +2033,7 @@ declare module 'fs' { }>, ): ReadStream; createWriteStream( - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, @@ -2055,12 +2055,12 @@ declare module 'fs' { ... }>; readableWebStream( - options?: $ReadOnly<{autoClose?: boolean}>, + options?: Readonly<{autoClose?: boolean}>, ): ReadableStream; readFile(options: EncodingFlag): Promise; readFile(options: string): Promise; readLines( - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, @@ -2088,7 +2088,7 @@ declare module 'fs' { ): Promise; write( buffer: Buffer | Uint8Array | DataView, - options?: $ReadOnly<{ + options?: Readonly<{ offset?: number, length?: number, position?: number, @@ -2119,7 +2119,7 @@ declare module 'fs' { cp( src: string | URL, dest: string | URL, - options?: $ReadOnly<{ + options?: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean | Promise, @@ -2171,7 +2171,7 @@ declare module 'fs' { ): Promise, opendir( path: string, - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, @@ -2192,7 +2192,7 @@ declare module 'fs' { path: FSPromisePath, options: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, @@ -2200,7 +2200,7 @@ declare module 'fs' { ) => Promise>) & (( path: FSPromisePath, - options: $ReadOnly<{ + options: Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, @@ -2249,7 +2249,7 @@ declare module 'fs' { ): Promise, watch( filename: FSPromisePath, - options?: $ReadOnly<{ + options?: Readonly<{ persistent?: boolean, recursive?: boolean, encoding?: string, diff --git a/flow-typed/npm/@octokit/rest_v22.x.x.js b/flow-typed/npm/@octokit/rest_v22.x.x.js index fafa59f524c5ae..4d3fbfccb4d25a 100644 --- a/flow-typed/npm/@octokit/rest_v22.x.x.js +++ b/flow-typed/npm/@octokit/rest_v22.x.x.js @@ -13,9 +13,9 @@ declare module '@octokit/rest' { declare class Octokit { constructor(options?: {auth?: string, ...}): this; - repos: $ReadOnly<{ + repos: Readonly<{ listReleaseAssets: ( - params: $ReadOnly<{ + params: Readonly<{ owner: string, repo: string, release_id: string, @@ -29,13 +29,13 @@ declare module '@octokit/rest' { ... }>, uploadReleaseAsset: ( - params: $ReadOnly<{ + params: Readonly<{ owner: string, repo: string, release_id: string, name: string, data: Buffer, - headers: $ReadOnly<{ + headers: Readonly<{ 'content-type': string, ... }>, diff --git a/flow-typed/npm/babel-traverse_v7.x.x.js b/flow-typed/npm/babel-traverse_v7.x.x.js index 1caf444f5298e8..344099df669978 100644 --- a/flow-typed/npm/babel-traverse_v7.x.x.js +++ b/flow-typed/npm/babel-traverse_v7.x.x.js @@ -97,7 +97,7 @@ declare module '@babel/traverse' { /** Traverse node with current scope and path. */ traverse( node: BabelNode | Array, - opts: $ReadOnly>, + opts: Readonly>, state: S, ): void; @@ -303,7 +303,7 @@ declare module '@babel/traverse' { shouldStop: boolean; removed: boolean; state: unknown; - +opts: $ReadOnly> | null; + +opts: Readonly> | null; skipKeys: null | {[key: string]: boolean}; parentPath: ?NodePath<>; context: TraversalContext; @@ -346,7 +346,7 @@ declare module '@babel/traverse' { ): TError; traverse( - visitor: $ReadOnly>, + visitor: Readonly>, state: TState, ): void; @@ -1444,7 +1444,7 @@ declare module '@babel/traverse' { | VisitNodeFunction | VisitNodeObject; - declare export type Visitor = $ReadOnly<{ + declare export type Visitor = Readonly<{ enter?: VisitNodeFunction, exit?: VisitNodeFunction, @@ -1872,7 +1872,7 @@ declare module '@babel/traverse' { explode(visitor: Visitor): Visitor, verify(visitor: Visitor): void, merge( - visitors: Array<$ReadOnly>>, + visitors: Array>>, states: Array, wrapper?: ?Function, ): Array>, @@ -1891,7 +1891,7 @@ declare module '@babel/traverse' { declare export type Traverse = { ( parent?: BabelNode | Array, - opts?: $ReadOnly>, + opts?: Readonly>, scope?: ?Scope, state: TState, parentPath?: ?NodePath, @@ -1909,7 +1909,7 @@ declare module '@babel/traverse' { node( node: BabelNode, - opts: $ReadOnly>, + opts: Readonly>, scope: Scope, state: TState, parentPath: NodePath<>, diff --git a/flow-typed/npm/babel_v7.x.x.js b/flow-typed/npm/babel_v7.x.x.js index 3e574ffb473625..a1f665cd5bcf79 100644 --- a/flow-typed/npm/babel_v7.x.x.js +++ b/flow-typed/npm/babel_v7.x.x.js @@ -10,7 +10,7 @@ 'use strict'; -type _BabelSourceMap = $ReadOnly<{ +type _BabelSourceMap = Readonly<{ file?: string, mappings: string, names: Array, @@ -28,9 +28,9 @@ type _BabelSourceMapSegment = { ... }; -export type BabelSourceLocation = $ReadOnly<{ - start: $ReadOnly<{line: number, column: number}>, - end: $ReadOnly<{line: number, column: number}>, +export type BabelSourceLocation = Readonly<{ + start: Readonly<{line: number, column: number}>, + end: Readonly<{line: number, column: number}>, }>; declare module '@babel/parser' { @@ -330,7 +330,7 @@ declare module '@babel/core' { constructor( options: BabelCoreOptions, - input: $ReadOnly<{ast: BabelNode, code: string, inputMap: any}>, + input: Readonly<{ast: BabelNode, code: string, inputMap: any}>, ): File; getMetadata(): void; @@ -1079,7 +1079,7 @@ declare module '@babel/core' { declare type ValidatedOptions = BabelCoreOptions; declare class PartialConfig { - +options: $ReadOnly; + +options: Readonly; +babelrc: string | void; +babelignore: string | void; +config: string | void; diff --git a/flow-typed/npm/electron-packager_v18.x.x.js b/flow-typed/npm/electron-packager_v18.x.x.js index f77d694e7aca90..4ac8b158eb5c9a 100644 --- a/flow-typed/npm/electron-packager_v18.x.x.js +++ b/flow-typed/npm/electron-packager_v18.x.x.js @@ -46,7 +46,7 @@ declare module '@electron/packager' { declare export type OsxUniversalOptions = $FlowFixMe; - declare export type Win32MetadataOptions = $ReadOnly<{ + declare export type Win32MetadataOptions = Readonly<{ CompanyName?: string, FileDescription?: string, OriginalFilename?: string, diff --git a/flow-typed/npm/execa_v5.x.x.js b/flow-typed/npm/execa_v5.x.x.js index 65e2ef8c9d3d31..db3f61779d191b 100644 --- a/flow-typed/npm/execa_v5.x.x.js +++ b/flow-typed/npm/execa_v5.x.x.js @@ -91,25 +91,25 @@ declare module 'execa' { ( file: string, args?: $ReadOnlyArray, - options?: $ReadOnly, + options?: Readonly, ): ExecaPromise; - (file: string, options?: $ReadOnly): ExecaPromise; + (file: string, options?: Readonly): ExecaPromise; - command(command: string, options?: $ReadOnly): ExecaPromise; - commandSync(command: string, options?: $ReadOnly): ExecaPromise; + command(command: string, options?: Readonly): ExecaPromise; + commandSync(command: string, options?: Readonly): ExecaPromise; node( path: string, args?: $ReadOnlyArray, - options?: $ReadOnly, + options?: Readonly, ): void; sync( file: string, args?: $ReadOnlyArray, - options?: $ReadOnly, + options?: Readonly, ): SyncResult; - sync(file: string, options?: $ReadOnly): SyncResult; + sync(file: string, options?: Readonly): SyncResult; } declare module.exports: Execa; diff --git a/flow-typed/npm/jsonc-parser_v2.2.x.js b/flow-typed/npm/jsonc-parser_v2.2.x.js index 50316cb13e9139..51eadf91b48a63 100644 --- a/flow-typed/npm/jsonc-parser_v2.2.x.js +++ b/flow-typed/npm/jsonc-parser_v2.2.x.js @@ -22,7 +22,7 @@ declare module 'jsonc-parser' { /** * The scanner object, representing a JSON scanner at a position in the input string. */ - export type JSONScanner = $ReadOnly<{ + export type JSONScanner = Readonly<{ /** * Sets the scan position to a new offset. A call to 'scan' is needed to get the first token. */ @@ -351,7 +351,7 @@ declare module 'jsonc-parser' { /** * Options used by {@linkcode format} when computing the formatting edit operations */ - export type FormattingOptions = $ReadOnly<{ + export type FormattingOptions = Readonly<{ /** * If indentation is based on spaces (`insertSpaces` = true), the number of spaces that make an indent. */ diff --git a/flow-typed/npm/open_v7.x.x.js b/flow-typed/npm/open_v7.x.x.js index 19629e3c4f3041..25f62fae217915 100644 --- a/flow-typed/npm/open_v7.x.x.js +++ b/flow-typed/npm/open_v7.x.x.js @@ -11,7 +11,7 @@ declare module 'open' { import type {ChildProcess} from 'child_process'; - declare export type Options = $ReadOnly<{ + declare export type Options = Readonly<{ wait?: boolean, background?: boolean, newInstance?: boolean, diff --git a/flow-typed/npm/serve-static_v1.x.x.js b/flow-typed/npm/serve-static_v1.x.x.js index 5ea71ddda7e352..d04a56fe4a8482 100644 --- a/flow-typed/npm/serve-static_v1.x.x.js +++ b/flow-typed/npm/serve-static_v1.x.x.js @@ -12,7 +12,7 @@ declare module 'serve-static' { import type {NextHandleFunction} from 'connect'; import type http from 'http'; - declare export type Options = $ReadOnly<{ + declare export type Options = Readonly<{ /** * Enable or disable accepting ranged requests, defaults to true. Disabling * this will not send `Accept-Ranges` and ignore the contents of the diff --git a/flow-typed/npm/tinybench_v4.1.x.js b/flow-typed/npm/tinybench_v4.1.x.js index 56412034a9d641..2b6bbba9bafade 100644 --- a/flow-typed/npm/tinybench_v4.1.x.js +++ b/flow-typed/npm/tinybench_v4.1.x.js @@ -11,7 +11,7 @@ declare module 'tinybench' { declare export class Task extends EventTarget { name: string; - result: void | $ReadOnly; + result: void | Readonly; runs: number; reset(): void; @@ -108,13 +108,13 @@ declare module 'tinybench' { declare export class Bench extends EventTarget { concurrency: null | 'task' | 'bench'; name?: string; - opts: $ReadOnly; + opts: Readonly; threshold: number; constructor(options?: BenchOptions): this; // $FlowExpectedError[unsafe-getters-setters] - get results(): Array<$ReadOnly>; + get results(): Array>; // $FlowExpectedError[unsafe-getters-setters] get tasks(): Array; diff --git a/flow-typed/npm/typescript_v5.x.x.js b/flow-typed/npm/typescript_v5.x.x.js index 3e5efa0afc623f..c89c7a5141e115 100644 --- a/flow-typed/npm/typescript_v5.x.x.js +++ b/flow-typed/npm/typescript_v5.x.x.js @@ -18,25 +18,25 @@ declare module 'typescript' { Bundler = 'Bundler', } - declare type SourceFile = $ReadOnly<{ + declare type SourceFile = Readonly<{ fileName: string, text: string, ... }>; - declare type Diagnostic = $ReadOnly<{ + declare type Diagnostic = Readonly<{ file?: SourceFile, start?: number, messageText: string, ... }>; - declare type EmitResult = $ReadOnly<{ + declare type EmitResult = Readonly<{ diagnostics: Array, ... }>; - declare type Program = $ReadOnly<{ + declare type Program = Readonly<{ emit: () => EmitResult, ... }>; @@ -47,7 +47,7 @@ declare module 'typescript' { getLineAndCharacterOfPosition( file: SourceFile, start?: number, - ): $ReadOnly<{line: number, character: number}>, + ): Readonly<{line: number, character: number}>, convertCompilerOptionsFromJson( jsonOptions: any, basePath: string, diff --git a/flow-typed/npm/undici_v5.x.x.js b/flow-typed/npm/undici_v5.x.x.js index 89a4a42fb5d465..9076fb91bee3e5 100644 --- a/flow-typed/npm/undici_v5.x.x.js +++ b/flow-typed/npm/undici_v5.x.x.js @@ -15,7 +15,7 @@ declare interface undici$Agent$Options { } declare module 'undici' { - declare export type RequestOptions = $ReadOnly<{ + declare export type RequestOptions = Readonly<{ dispatcher?: Dispatcher, method?: string, headers?: HeadersInit, diff --git a/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js b/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js index ced3d4b92a89ee..51c0a66e4e36b5 100644 --- a/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js +++ b/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js @@ -8,7 +8,7 @@ * @format */ -export type PackagerAsset = $ReadOnly<{ +export type PackagerAsset = Readonly<{ httpServerLocation: string, name: string, type: string, diff --git a/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js b/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js index 4baaaf942fe9d3..14affb2664a5d9 100644 --- a/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js +++ b/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js @@ -12,7 +12,7 @@ import type {TerminalReporter} from 'metro'; import {styleText} from 'util'; -type PageDescription = $ReadOnly<{ +type PageDescription = Readonly<{ id: string, title: string, description: string, diff --git a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js index 24cf6f9a56e2d8..fd43a0e8e01183 100644 --- a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js +++ b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js @@ -45,7 +45,7 @@ export default function attachKeyHandlers({ reporter, }: { devServerUrl: string, - messageSocket: $ReadOnly<{ + messageSocket: Readonly<{ broadcast: (type: string, params?: Record | null) => void, ... }>, diff --git a/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js b/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js index 6a8e5e2227250c..869052a047ac24 100644 --- a/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js +++ b/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js @@ -18,7 +18,7 @@ type LoggerFn = (...message: $ReadOnlyArray) => void; */ export default function createDevMiddlewareLogger( reporter: TerminalReporter, -): $ReadOnly<{ +): Readonly<{ info: LoggerFn, error: LoggerFn, warn: LoggerFn, diff --git a/packages/community-cli-plugin/src/utils/loadMetroConfig.js b/packages/community-cli-plugin/src/utils/loadMetroConfig.js index 36d11175f632ed..8b5883a3148a95 100644 --- a/packages/community-cli-plugin/src/utils/loadMetroConfig.js +++ b/packages/community-cli-plugin/src/utils/loadMetroConfig.js @@ -20,7 +20,7 @@ const debug = require('debug')('ReactNative:CommunityCliPlugin'); export type {Config}; -export type ConfigLoadingContext = $ReadOnly<{ +export type ConfigLoadingContext = Readonly<{ root: Config['root'], reactNativePath: Config['reactNativePath'], platforms: Config['platforms'], diff --git a/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js b/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js index bf68f735c0506d..41693cc14bcae0 100644 --- a/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js +++ b/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js @@ -19,7 +19,7 @@ const {BrowserWindow, Menu, app, shell, ipcMain} = require('electron') as any; const appSettings = new SettingsStore(); const windowMetadata = new WeakMap< typeof BrowserWindow, - $ReadOnly<{ + Readonly<{ windowKey: string, }>, >(); diff --git a/packages/debugger-shell/src/electron/SettingsStore.js b/packages/debugger-shell/src/electron/SettingsStore.js index d85363b3e40754..b79b262e314e72 100644 --- a/packages/debugger-shell/src/electron/SettingsStore.js +++ b/packages/debugger-shell/src/electron/SettingsStore.js @@ -14,7 +14,7 @@ const {app} = require('electron') as any; const fs = require('fs'); const path = require('path'); -type Options = $ReadOnly<{ +type Options = Readonly<{ name?: string, defaults?: Object, }>; diff --git a/packages/debugger-shell/src/node/index.flow.js b/packages/debugger-shell/src/node/index.flow.js index 7824db67a563a3..5b23b9fa401d28 100644 --- a/packages/debugger-shell/src/node/index.flow.js +++ b/packages/debugger-shell/src/node/index.flow.js @@ -31,7 +31,7 @@ async function unstable_spawnDebuggerShellWithArgs( mode = 'detached', flavor = process.env.RNDT_DEV === '1' ? 'dev' : 'prebuilt', prebuiltBinaryPath, - }: $ReadOnly<{ + }: Readonly<{ // In 'syncAndExit' mode, the current process will block until the spawned process exits, and then it will exit // with the same exit code as the spawned process. // In 'detached' mode, the spawned process will be detached from the current process and the current process will @@ -97,7 +97,7 @@ async function unstable_spawnDebuggerShellWithArgs( }); } -export type DebuggerShellPreparationResult = $ReadOnly<{ +export type DebuggerShellPreparationResult = Readonly<{ code: | 'success' | 'not_implemented' diff --git a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js index 4b5c68445314ac..3d12d534541243 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js +++ b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js @@ -21,18 +21,18 @@ import {createDebuggerMock} from './InspectorDebuggerUtils'; import {createDeviceMock} from './InspectorDeviceUtils'; import until from 'wait-for-expect'; -export type CdpMessageFromTarget = $ReadOnly<{ +export type CdpMessageFromTarget = Readonly<{ method: string, id?: number, params?: JSONSerializable, }>; -export type CdpResponseFromTarget = $ReadOnly<{ +export type CdpResponseFromTarget = Readonly<{ id: number, result: JSONSerializable, }>; -export type CdpMessageToTarget = $ReadOnly<{ +export type CdpMessageToTarget = Readonly<{ method: string, id: number, params?: JSONSerializable, @@ -108,7 +108,7 @@ export async function sendFromDebuggerToTarget( } export async function createAndConnectTarget( - serverRef: $ReadOnly<{ + serverRef: Readonly<{ serverBaseUrl: string, serverBaseWsUrl: string, ... @@ -119,7 +119,7 @@ export async function createAndConnectTarget( debuggerHostHeader = null, deviceId = null, deviceHostHeader = null, - }: $ReadOnly<{ + }: Readonly<{ debuggerHostHeader?: ?string, deviceId?: ?string, deviceHostHeader?: ?string, diff --git a/packages/dev-middleware/src/__tests__/ResourceUtils.js b/packages/dev-middleware/src/__tests__/ResourceUtils.js index 3c36166a4e382e..780f7f06bb1ffd 100644 --- a/packages/dev-middleware/src/__tests__/ResourceUtils.js +++ b/packages/dev-middleware/src/__tests__/ResourceUtils.js @@ -8,7 +8,7 @@ * @format */ -export function withAbortSignalForEachTest(): $ReadOnly<{signal: AbortSignal}> { +export function withAbortSignalForEachTest(): Readonly<{signal: AbortSignal}> { const ref: {signal: AbortSignal} = { // $FlowFixMe[unsafe-getters-setters] get signal() { diff --git a/packages/dev-middleware/src/__tests__/ServerUtils.js b/packages/dev-middleware/src/__tests__/ServerUtils.js index 71de93c4875895..8c9c190158fc9b 100644 --- a/packages/dev-middleware/src/__tests__/ServerUtils.js +++ b/packages/dev-middleware/src/__tests__/ServerUtils.js @@ -25,7 +25,7 @@ type CreateServerOptions = { }; type ConnectApp = ReturnType; -export function withServerForEachTest(options: CreateServerOptions): $ReadOnly<{ +export function withServerForEachTest(options: CreateServerOptions): Readonly<{ serverBaseUrl: string, serverBaseWsUrl: string, app: ConnectApp, diff --git a/packages/dev-middleware/src/createDevMiddleware.js b/packages/dev-middleware/src/createDevMiddleware.js index 72d1bdd52de000..fd1e93109b135c 100644 --- a/packages/dev-middleware/src/createDevMiddleware.js +++ b/packages/dev-middleware/src/createDevMiddleware.js @@ -23,7 +23,7 @@ import connect from 'connect'; import path from 'path'; import serveStaticMiddleware from 'serve-static'; -type Options = $ReadOnly<{ +type Options = Readonly<{ /** * The base URL to the dev server, as reachable from the machine on which * dev-middleware is hosted. Typically `http://localhost:${metroPort}`. @@ -70,7 +70,7 @@ type Options = $ReadOnly<{ unstable_trackInspectorProxyEventLoopPerf?: boolean, }>; -type DevMiddlewareAPI = $ReadOnly<{ +type DevMiddlewareAPI = Readonly<{ middleware: NextHandleFunction, websocketEndpoints: {[path: string]: ws$WebSocketServer}, }>; diff --git a/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js b/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js index 1c3dd473b7c118..52a9f549fe0a62 100644 --- a/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js +++ b/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js @@ -10,19 +10,19 @@ import type {JSONSerializable, Page} from './types'; -type ExposedDevice = $ReadOnly<{ +type ExposedDevice = Readonly<{ appId: string, id: string, name: string, sendMessage: (message: JSONSerializable) => void, }>; -type ExposedDebugger = $ReadOnly<{ +type ExposedDebugger = Readonly<{ userAgent: string | null, sendMessage: (message: JSONSerializable) => void, }>; -export type CustomMessageHandlerConnection = $ReadOnly<{ +export type CustomMessageHandlerConnection = Readonly<{ page: Page, device: ExposedDevice, debugger: ExposedDebugger, diff --git a/packages/dev-middleware/src/inspector-proxy/Device.js b/packages/dev-middleware/src/inspector-proxy/Device.js index 20d6ede32fc21a..4af39f070ee76e 100644 --- a/packages/dev-middleware/src/inspector-proxy/Device.js +++ b/packages/dev-middleware/src/inspector-proxy/Device.js @@ -68,7 +68,7 @@ type DebuggerConnection = { const REACT_NATIVE_RELOADABLE_PAGE_ID = '-1'; -export type DeviceOptions = $ReadOnly<{ +export type DeviceOptions = Readonly<{ id: string, name: string, app: string, @@ -302,7 +302,7 @@ export default class Device { { debuggerRelativeBaseUrl, userAgent, - }: $ReadOnly<{ + }: Readonly<{ debuggerRelativeBaseUrl: URL, userAgent: string | null, }>, diff --git a/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js b/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js index a86877b07c9d81..8ad4b68f1d3149 100644 --- a/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js +++ b/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js @@ -21,19 +21,19 @@ type PendingCommand = { metadata: RequestMetadata, }; -type DeviceMetadata = $ReadOnly<{ +type DeviceMetadata = Readonly<{ appId: string, deviceId: string, deviceName: string, }>; -type RequestMetadata = $ReadOnly<{ +type RequestMetadata = Readonly<{ pageId: string | null, frontendUserAgent: string | null, prefersFuseboxFrontend: boolean | null, }>; -type ResponseMetadata = $ReadOnly<{ +type ResponseMetadata = Readonly<{ pageId: string | null, frontendUserAgent: string | null, prefersFuseboxFrontend: boolean | null, @@ -68,7 +68,7 @@ class DeviceEventReporter { } logRequest( - req: $ReadOnly<{id: number, method: string, ...}>, + req: Readonly<{id: number, method: string, ...}>, origin: 'debugger' | 'proxy', metadata: RequestMetadata, ): void { @@ -164,7 +164,7 @@ class DeviceEventReporter { logConnection( connectedEntity: 'debugger', - metadata: $ReadOnly<{ + metadata: Readonly<{ pageId: string, frontendUserAgent: string | null, }>, diff --git a/packages/dev-middleware/src/inspector-proxy/types.js b/packages/dev-middleware/src/inspector-proxy/types.js index d60dd37a17cc0f..d30125ffdf6704 100644 --- a/packages/dev-middleware/src/inspector-proxy/types.js +++ b/packages/dev-middleware/src/inspector-proxy/types.js @@ -12,7 +12,7 @@ * A capability flag disables a specific feature/hack in the InspectorProxy * layer by indicating that the target supports one or more modern CDP features. */ -export type TargetCapabilityFlags = $ReadOnly<{ +export type TargetCapabilityFlags = Readonly<{ /** * The target supports a stable page representation across reloads. * @@ -43,7 +43,7 @@ export type TargetCapabilityFlags = $ReadOnly<{ // each new instance of VM and can appear when user reloads React Native // application. -export type PageFromDevice = $ReadOnly<{ +export type PageFromDevice = Readonly<{ id: string, title: string, /** Sent from modern targets only */ @@ -54,15 +54,15 @@ export type PageFromDevice = $ReadOnly<{ capabilities?: TargetCapabilityFlags, }>; -export type Page = $ReadOnly<{ +export type Page = Readonly<{ ...PageFromDevice, capabilities: NonNullable, }>; // Chrome Debugger Protocol message/event passed between device and debugger. -export type WrappedEvent = $ReadOnly<{ +export type WrappedEvent = Readonly<{ event: 'wrappedEvent', - payload: $ReadOnly<{ + payload: Readonly<{ pageId: string, wrappedEvent: string, }>, @@ -70,16 +70,16 @@ export type WrappedEvent = $ReadOnly<{ // Request sent from Inspector Proxy to Device when new debugger is connected // to particular page. -export type ConnectRequest = $ReadOnly<{ +export type ConnectRequest = Readonly<{ event: 'connect', - payload: $ReadOnly<{pageId: string}>, + payload: Readonly<{pageId: string}>, }>; // Request sent from Inspector Proxy to Device to notify that debugger is // disconnected. -export type DisconnectRequest = $ReadOnly<{ +export type DisconnectRequest = Readonly<{ event: 'disconnect', - payload: $ReadOnly<{pageId: string}>, + payload: Readonly<{pageId: string}>, }>; // Request sent from Inspector Proxy to Device to get a list of pages. @@ -105,7 +105,7 @@ export type MessageToDevice = | DisconnectRequest; // Page description object that is sent in response to /json HTTP request from debugger. -export type PageDescription = $ReadOnly<{ +export type PageDescription = Readonly<{ id: string, title: string, appId: string, @@ -121,7 +121,7 @@ export type PageDescription = $ReadOnly<{ vm?: string, // React Native specific metadata - reactNative: $ReadOnly<{ + reactNative: Readonly<{ logicalDeviceId: string, capabilities: Page['capabilities'], }>, @@ -131,7 +131,7 @@ export type JsonPagesListResponse = Array; // Response to /json/version HTTP request from the debugger specifying browser type and // Chrome protocol version. -export type JsonVersionResponse = $ReadOnly<{ +export type JsonVersionResponse = Readonly<{ Browser: string, 'Protocol-Version': string, }>; diff --git a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js index 5de43b399b5963..f274449c7b28e5 100644 --- a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js +++ b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js @@ -27,7 +27,7 @@ import url from 'url'; const LEGACY_SYNTHETIC_PAGE_TITLE = 'React Native Experimental (Improved Chrome Reloads)'; -type Options = $ReadOnly<{ +type Options = Readonly<{ serverBaseUrl: string, logger?: Logger, browserLauncher: BrowserLauncher, diff --git a/packages/dev-middleware/src/types/Experiments.js b/packages/dev-middleware/src/types/Experiments.js index 582e44120ca83f..5219f3e7bfc8c4 100644 --- a/packages/dev-middleware/src/types/Experiments.js +++ b/packages/dev-middleware/src/types/Experiments.js @@ -8,7 +8,7 @@ * @format */ -export type Experiments = $ReadOnly<{ +export type Experiments = Readonly<{ /** * Enables the handling of GET requests in the /open-debugger endpoint, * in addition to POST requests. GET requests respond by redirecting to diff --git a/packages/dev-middleware/src/types/Logger.js b/packages/dev-middleware/src/types/Logger.js index 48720dea29009a..09f6205ee2bd9b 100644 --- a/packages/dev-middleware/src/types/Logger.js +++ b/packages/dev-middleware/src/types/Logger.js @@ -8,7 +8,7 @@ * @format */ -export type Logger = $ReadOnly<{ +export type Logger = Readonly<{ error: (...message: Array) => void, info: (...message: Array) => void, warn: (...message: Array) => void, diff --git a/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js b/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js index a00f54bf5444d4..a46e12254c904e 100644 --- a/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js +++ b/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js @@ -17,7 +17,7 @@ export default function getDevToolsFrontendUrl( experiments: Experiments, webSocketDebuggerUrl: string, devServerUrl: string, - options?: $ReadOnly<{ + options?: Readonly<{ relative?: boolean, launchId?: string, telemetryInfo?: string, @@ -65,7 +65,7 @@ export default function getDevToolsFrontendUrl( function getWsParam({ webSocketDebuggerUrl, devServerUrl, -}: $ReadOnly<{ +}: Readonly<{ webSocketDebuggerUrl: string, devServerUrl: string, }>): { diff --git a/packages/metro-config/src/index.flow.js b/packages/metro-config/src/index.flow.js index 4deebfa891dfe4..6bba33bd975a6c 100644 --- a/packages/metro-config/src/index.flow.js +++ b/packages/metro-config/src/index.flow.js @@ -64,7 +64,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT { require.resolve('react-native/Libraries/Core/InitializeCore'), ], getPolyfills: () => require('@react-native/js-polyfills')(), - isThirdPartyModule({path: modulePath}: $ReadOnly<{path: string, ...}>) { + isThirdPartyModule({path: modulePath}: Readonly<{path: string, ...}>) { return ( INTERNAL_CALLSITES_REGEX.test(modulePath) || /(?:^|[/\\])node_modules[/\\]/.test(modulePath) @@ -75,7 +75,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT { port: Number(process.env.RCT_METRO_PORT) || 8081, }, symbolicator: { - customizeFrame: (frame: $ReadOnly<{file: ?string, ...}>) => { + customizeFrame: (frame: Readonly<{file: ?string, ...}>) => { const collapse = Boolean( frame.file != null && INTERNAL_CALLSITES_REGEX.test(frame.file), ); diff --git a/packages/new-app-screen/src/NewAppScreen.js b/packages/new-app-screen/src/NewAppScreen.js index 69c265508ed387..379bfe8d62f142 100644 --- a/packages/new-app-screen/src/NewAppScreen.js +++ b/packages/new-app-screen/src/NewAppScreen.js @@ -24,9 +24,9 @@ import { } from 'react-native'; import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser'; -export type NewAppScreenProps = $ReadOnly<{ +export type NewAppScreenProps = Readonly<{ templateFileName?: string, - safeAreaInsets?: $ReadOnly<{ + safeAreaInsets?: Readonly<{ top: number, bottom: number, left: number, diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 472d9d3084ab74..7013735b3dc254 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -12,9 +12,9 @@ export type PlatformType = 'iOS' | 'android'; -export type SchemaType = $ReadOnly<{ +export type SchemaType = Readonly<{ libraryName?: string, - modules: $ReadOnly<{ + modules: Readonly<{ [hasteModuleName: string]: ComponentSchema | NativeModuleSchema, }>, }>; @@ -22,41 +22,41 @@ export type SchemaType = $ReadOnly<{ /** * Component Type Annotations */ -export type DoubleTypeAnnotation = $ReadOnly<{ +export type DoubleTypeAnnotation = Readonly<{ type: 'DoubleTypeAnnotation', }>; -export type FloatTypeAnnotation = $ReadOnly<{ +export type FloatTypeAnnotation = Readonly<{ type: 'FloatTypeAnnotation', }>; -export type NumberTypeAnnotation = $ReadOnly<{ +export type NumberTypeAnnotation = Readonly<{ type: 'NumberTypeAnnotation', }>; -export type BooleanTypeAnnotation = $ReadOnly<{ +export type BooleanTypeAnnotation = Readonly<{ type: 'BooleanTypeAnnotation', }>; -export type Int32TypeAnnotation = $ReadOnly<{ +export type Int32TypeAnnotation = Readonly<{ type: 'Int32TypeAnnotation', }>; -export type NumberLiteralTypeAnnotation = $ReadOnly<{ +export type NumberLiteralTypeAnnotation = Readonly<{ type: 'NumberLiteralTypeAnnotation', value: number, }>; -export type StringTypeAnnotation = $ReadOnly<{ +export type StringTypeAnnotation = Readonly<{ type: 'StringTypeAnnotation', }>; -export type StringLiteralTypeAnnotation = $ReadOnly<{ +export type StringLiteralTypeAnnotation = Readonly<{ type: 'StringLiteralTypeAnnotation', value: string, }>; -export type BooleanLiteralTypeAnnotation = $ReadOnly<{ +export type BooleanLiteralTypeAnnotation = Readonly<{ type: 'BooleanLiteralTypeAnnotation', value: boolean, }>; @@ -64,51 +64,51 @@ export type BooleanLiteralTypeAnnotation = $ReadOnly<{ export type StringLiteralUnionTypeAnnotation = UnionTypeAnnotation; -export type VoidTypeAnnotation = $ReadOnly<{ +export type VoidTypeAnnotation = Readonly<{ type: 'VoidTypeAnnotation', }>; -export type ObjectTypeAnnotation<+T> = $ReadOnly<{ +export type ObjectTypeAnnotation<+T> = Readonly<{ type: 'ObjectTypeAnnotation', properties: $ReadOnlyArray>, // metadata for objects that generated from interfaces baseTypes?: $ReadOnlyArray, }>; -export type UnionTypeAnnotation<+T> = $ReadOnly<{ +export type UnionTypeAnnotation<+T> = Readonly<{ type: 'UnionTypeAnnotation', types: $ReadOnlyArray, }>; -export type MixedTypeAnnotation = $ReadOnly<{ +export type MixedTypeAnnotation = Readonly<{ type: 'MixedTypeAnnotation', }>; -export type EventEmitterTypeAnnotation = $ReadOnly<{ +export type EventEmitterTypeAnnotation = Readonly<{ type: 'EventEmitterTypeAnnotation', typeAnnotation: NativeModuleEventEmitterTypeAnnotation | $FlowFixMe, }>; -type FunctionTypeAnnotation<+P, +R> = $ReadOnly<{ +type FunctionTypeAnnotation<+P, +R> = Readonly<{ type: 'FunctionTypeAnnotation', params: $ReadOnlyArray>, returnTypeAnnotation: R, }>; -export type NamedShape<+T> = $ReadOnly<{ +export type NamedShape<+T> = Readonly<{ name: string, optional: boolean, typeAnnotation: T, }>; -export type ComponentSchema = $ReadOnly<{ +export type ComponentSchema = Readonly<{ type: 'Component', - components: $ReadOnly<{ + components: Readonly<{ [componentName: string]: ComponentShape, }>, }>; -export type ComponentShape = $ReadOnly<{ +export type ComponentShape = Readonly<{ ...OptionsShape, extendsProps: $ReadOnlyArray, events: $ReadOnlyArray, @@ -116,7 +116,7 @@ export type ComponentShape = $ReadOnly<{ commands: $ReadOnlyArray>, }>; -export type OptionsShape = $ReadOnly<{ +export type OptionsShape = Readonly<{ // Use to generate only interfaces of components (C++ Props, C++ EventEmitters, JVM interfaces) and not their implementation. // This is useful for components that have a custom implementation of ShadowNode, ComponentDescriptor, State. interfaceOnly?: boolean, @@ -134,17 +134,17 @@ export type OptionsShape = $ReadOnly<{ generateOptionalObjectProperties?: boolean, }>; -export type ExtendsPropsShape = $ReadOnly<{ +export type ExtendsPropsShape = Readonly<{ type: 'ReactNativeBuiltInType', knownTypeName: 'ReactNativeCoreViewProps', }>; -export type EventTypeShape = $ReadOnly<{ +export type EventTypeShape = Readonly<{ name: string, bubblingType: 'direct' | 'bubble', optional: boolean, paperTopLevelNameDeprecated?: string, - typeAnnotation: $ReadOnly<{ + typeAnnotation: Readonly<{ type: 'EventTypeAnnotation', argument?: ObjectTypeAnnotation, }>, @@ -168,7 +168,7 @@ export type ComponentArrayTypeAnnotation = ArrayTypeAnnotation< | FloatTypeAnnotation | Int32TypeAnnotation | MixedTypeAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, @@ -191,38 +191,38 @@ export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation< | MixedTypeAnnotation, >; -export type ArrayTypeAnnotation<+T> = $ReadOnly<{ +export type ArrayTypeAnnotation<+T> = Readonly<{ type: 'ArrayTypeAnnotation', elementType: T, }>; export type PropTypeAnnotation = - | $ReadOnly<{ + | Readonly<{ type: 'BooleanTypeAnnotation', default: boolean | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringTypeAnnotation', default: string | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'DoubleTypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'FloatTypeAnnotation', default: number | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32TypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32EnumTypeAnnotation', default: number, options: $ReadOnlyArray, @@ -232,7 +232,7 @@ export type PropTypeAnnotation = | ComponentArrayTypeAnnotation | MixedTypeAnnotation; -export type ReservedPropTypeAnnotation = $ReadOnly<{ +export type ReservedPropTypeAnnotation = Readonly<{ type: 'ReservedPropTypeAnnotation', name: | 'ColorPrimitive' @@ -257,7 +257,7 @@ export type CommandParamTypeAnnotation = | StringTypeAnnotation | ComponentCommandArrayTypeAnnotation; -export type ReservedTypeAnnotation = $ReadOnly<{ +export type ReservedTypeAnnotation = Readonly<{ type: 'ReservedTypeAnnotation', name: 'RootTag', // Union with more custom types. }>; @@ -269,12 +269,12 @@ export type Nullable<+T: NativeModuleTypeAnnotation> = | NullableTypeAnnotation | T; -export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = $ReadOnly<{ +export type NullableTypeAnnotation<+T: NativeModuleTypeAnnotation> = Readonly<{ type: 'NullableTypeAnnotation', typeAnnotation: T, }>; -export type NativeModuleSchema = $ReadOnly<{ +export type NativeModuleSchema = Readonly<{ type: 'NativeModule', aliasMap: NativeModuleAliasMap, enumMap: NativeModuleEnumMap, @@ -286,7 +286,7 @@ export type NativeModuleSchema = $ReadOnly<{ excludedPlatforms?: $ReadOnlyArray, }>; -type NativeModuleSpec = $ReadOnly<{ +type NativeModuleSpec = Readonly<{ eventEmitters: $ReadOnlyArray, methods: $ReadOnlyArray, }>; @@ -298,11 +298,11 @@ export type NativeModulePropertyShape = NamedShape< Nullable, >; -export type NativeModuleEnumMap = $ReadOnly<{ +export type NativeModuleEnumMap = Readonly<{ [enumName: string]: NativeModuleEnumDeclarationWithMembers, }>; -export type NativeModuleAliasMap = $ReadOnly<{ +export type NativeModuleAliasMap = Readonly<{ [aliasName: string]: NativeModuleObjectTypeAnnotation, }>; @@ -330,7 +330,7 @@ export type UnsafeAnyTypeAnnotation = { type: 'AnyTypeAnnotation', }; -export type NativeModuleNumberTypeAnnotation = $ReadOnly<{ +export type NativeModuleNumberTypeAnnotation = Readonly<{ type: 'NumberTypeAnnotation', }>; @@ -343,7 +343,7 @@ export type NativeModuleEnumMemberType = | 'NumberTypeAnnotation' | 'StringTypeAnnotation'; -export type NativeModuleEnumDeclaration = $ReadOnly<{ +export type NativeModuleEnumDeclaration = Readonly<{ name: string, type: 'EnumDeclaration', memberType: NativeModuleEnumMemberType, @@ -356,7 +356,7 @@ export type NativeModuleEnumDeclarationWithMembers = { members: $ReadOnlyArray, }; -export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{ +export type NativeModuleGenericObjectTypeAnnotation = Readonly<{ type: 'GenericObjectTypeAnnotation', // a dictionary type is codegen as "Object" // but we know all its members are in the same type @@ -364,12 +364,12 @@ export type NativeModuleGenericObjectTypeAnnotation = $ReadOnly<{ dictionaryValueType?: Nullable, }>; -export type NativeModuleTypeAliasTypeAnnotation = $ReadOnly<{ +export type NativeModuleTypeAliasTypeAnnotation = Readonly<{ type: 'TypeAliasTypeAnnotation', name: string, }>; -export type NativeModulePromiseTypeAnnotation = $ReadOnly<{ +export type NativeModulePromiseTypeAnnotation = Readonly<{ type: 'PromiseTypeAnnotation', elementType: VoidTypeAnnotation | Nullable, }>; @@ -386,7 +386,7 @@ export type NativeModuleUnionTypeAnnotationMemberType = export type NativeModuleUnionTypeAnnotation = UnionTypeAnnotation; -export type NativeModuleMixedTypeAnnotation = $ReadOnly<{ +export type NativeModuleMixedTypeAnnotation = Readonly<{ type: 'MixedTypeAnnotation', }>; diff --git a/packages/react-native-codegen/src/generators/RNCodegen.js b/packages/react-native-codegen/src/generators/RNCodegen.js index 33f86c7f80eb1d..5e439abd8f4851 100644 --- a/packages/react-native-codegen/src/generators/RNCodegen.js +++ b/packages/react-native-codegen/src/generators/RNCodegen.js @@ -82,11 +82,11 @@ export type GenerateFunction = ( includeGetDebugPropsImplementation?: boolean, ) => FilesOutput; -export type LibraryGeneratorsFunctions = $ReadOnly<{ +export type LibraryGeneratorsFunctions = Readonly<{ [string]: Array, }>; -export type LibraryOptions = $ReadOnly<{ +export type LibraryOptions = Readonly<{ libraryName: string, schema: SchemaType, outputDirectory: string, @@ -97,7 +97,7 @@ export type LibraryOptions = $ReadOnly<{ libraryGenerators?: LibraryGeneratorsFunctions, }>; -export type SchemasOptions = $ReadOnly<{ +export type SchemasOptions = Readonly<{ schemas: {[string]: SchemaType}, outputDirectory: string, supportedApplePlatforms?: {[string]: {[string]: boolean}}, @@ -118,12 +118,12 @@ export type LibraryGenerators = export type SchemasGenerators = 'providerIOS'; -export type LibraryConfig = $ReadOnly<{ +export type LibraryConfig = Readonly<{ generators: Array, test?: boolean, }>; -export type SchemasConfig = $ReadOnly<{ +export type SchemasConfig = Readonly<{ generators: Array, test?: boolean, }>; diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js index 7ebe0e337a7a90..75f1d8cc9ed8db 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js @@ -25,7 +25,7 @@ const {IncludeTemplate, generateEventStructName} = require('./CppHelpers'); // File path -> contents type FilesOutput = Map; -type ComponentCollection = $ReadOnly<{ +type ComponentCollection = Readonly<{ [component: string]: ComponentShape, ... }>; diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index b947b727f5a7c4..3f1ec849071d46 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -31,7 +31,7 @@ const nullthrows = require('nullthrows'); type FilesOutput = Map; type StructsMap = Map; -type ComponentCollection = $ReadOnly<{ +type ComponentCollection = Readonly<{ [component: string]: ComponentShape, ... }>; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js index c9669a0c311459..39bca081570ce8 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js @@ -40,39 +40,39 @@ export type PojoTypeAliasAnnotation = { }; export type PojoTypeAnnotation = - | $ReadOnly<{ + | Readonly<{ type: 'BooleanTypeAnnotation', default: boolean | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringTypeAnnotation', default: string | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'DoubleTypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'FloatTypeAnnotation', default: number | null, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32TypeAnnotation', default: number, }> - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, }> - | $ReadOnly<{ + | Readonly<{ type: 'Int32EnumTypeAnnotation', default: number, options: $ReadOnlyArray, }> | ReservedPropTypeAnnotation | PojoTypeAliasAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'ArrayTypeAnnotation', elementType: | BooleanTypeAnnotation @@ -81,14 +81,14 @@ export type PojoTypeAnnotation = | FloatTypeAnnotation | Int32TypeAnnotation | MixedTypeAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'StringEnumTypeAnnotation', default: string, options: $ReadOnlyArray, }> | PojoTypeAliasAnnotation | ReservedPropTypeAnnotation - | $ReadOnly<{ + | Readonly<{ type: 'ArrayTypeAnnotation', elementType: PojoTypeAliasAnnotation, }>, diff --git a/packages/react-native-codegen/src/generators/components/GenerateTests.js b/packages/react-native-codegen/src/generators/components/GenerateTests.js index 2a00f4b1304290..668f05c43cc9ae 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateTests.js +++ b/packages/react-native-codegen/src/generators/components/GenerateTests.js @@ -18,7 +18,7 @@ const {getImports} = require('./CppHelpers'); type FilesOutput = Map; type PropValueType = string | number | boolean; -type TestCase = $ReadOnly<{ +type TestCase = Readonly<{ propName: string, propValue: ?PropValueType, testName?: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js index 9c85b82a59cb85..b92240bd9c7534 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js @@ -163,14 +163,14 @@ const ModuleSpecClassDeclarationTemplate = ({ moduleEventEmitters, moduleFunctions, methods, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, moduleName: string, structs: string, enums: string, moduleEventEmitters: EventEmitterCpp[], moduleFunctions: string[], - methods: $ReadOnlyArray<$ReadOnly<{methodName: string, paramCount: number}>>, + methods: $ReadOnlyArray>, }>) => { return `${enums}${structs} template @@ -196,7 +196,7 @@ ${moduleFunctions.join('\n\n')} const FileTemplate = ({ modules, -}: $ReadOnly<{ +}: Readonly<{ modules: string[], }>) => { return `/** diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index 1093787a153212..55e14262fa06b5 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -30,7 +30,7 @@ const {createAliasResolver, getModules} = require('./Utils'); type FilesOutput = Map; function FileTemplate( - config: $ReadOnly<{ + config: Readonly<{ packageName: string, className: string, jsName: string, @@ -92,7 +92,7 @@ function EventEmitterTemplate( } function MethodTemplate( - config: $ReadOnly<{ + config: Readonly<{ abstract: boolean, methodBody: ?string, methodJavaAnnotation: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js index 691c5a30c2e51d..65315adae2f0c5 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js @@ -42,7 +42,7 @@ const HostFunctionTemplate = ({ propertyName, jniSignature, jsReturnType, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, propertyName: string, jniSignature: string, @@ -58,7 +58,7 @@ const ModuleClassConstructorTemplate = ({ hasteModuleName, eventEmitters, methods, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, eventEmitters: $ReadOnlyArray, methods: $ReadOnlyArray<{ @@ -94,7 +94,7 @@ ${methods const ModuleLookupTemplate = ({ moduleName, hasteModuleName, -}: $ReadOnly<{moduleName: string, hasteModuleName: string}>) => { +}: Readonly<{moduleName: string, hasteModuleName: string}>) => { return ` if (moduleName == "${moduleName}") { return std::make_shared<${hasteModuleName}SpecJSI>(params); }`; @@ -105,7 +105,7 @@ const FileTemplate = ({ include, modules, moduleLookups, -}: $ReadOnly<{ +}: Readonly<{ libraryName: string, include: string, modules: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js index 0d0ee29bcffc02..92a4c0dac76458 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js @@ -18,7 +18,7 @@ type FilesOutput = Map; const ModuleClassDeclarationTemplate = ({ hasteModuleName, -}: $ReadOnly<{hasteModuleName: string}>) => { +}: Readonly<{hasteModuleName: string}>) => { return `/** * JNI C++ class for module '${hasteModuleName}' */ @@ -32,7 +32,7 @@ public: const HeaderFileTemplate = ({ modules, libraryName, -}: $ReadOnly<{modules: string, libraryName: string}>) => { +}: Readonly<{modules: string, libraryName: string}>) => { return ` /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -64,7 +64,7 @@ std::shared_ptr ${libraryName}_ModuleProvider(const std::string &mo const CMakeListsTemplate = ({ libraryName, targetName, -}: $ReadOnly<{libraryName: string, targetName: string}>) => { +}: Readonly<{libraryName: string, targetName: string}>) => { return `# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js index 646a283e55a2f7..036d4203d16084 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js @@ -44,13 +44,13 @@ const { type StructContext = 'CONSTANTS' | 'REGULAR'; -export type RegularStruct = $ReadOnly<{ +export type RegularStruct = Readonly<{ context: 'REGULAR', name: string, properties: $ReadOnlyArray, }>; -export type ConstantsStruct = $ReadOnly<{ +export type ConstantsStruct = Readonly<{ context: 'CONSTANTS', name: string, properties: $ReadOnlyArray, @@ -58,7 +58,7 @@ export type ConstantsStruct = $ReadOnly<{ export type Struct = RegularStruct | ConstantsStruct; -export type StructProperty = $ReadOnly<{ +export type StructProperty = Readonly<{ name: string, optional: boolean, typeAnnotation: Nullable, @@ -200,7 +200,7 @@ class StructCollector { ): void { // $FlowFixMe[missing-type-arg] const properties = objectTypeAnnotation.properties.map< - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: Nullable, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js index d281e5c750123e..dcf0cf50f0138e 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js @@ -26,7 +26,7 @@ const StructTemplate = ({ hasteModuleName, structName, builderInputProps, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, builderInputProps: string, @@ -65,7 +65,7 @@ const MethodTemplate = ({ hasteModuleName, structName, properties, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, properties: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js index 69565672d46716..37b7ae4a515635 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js @@ -26,7 +26,7 @@ const StructTemplate = ({ hasteModuleName, structName, structProperties, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, structProperties: string, @@ -53,7 +53,7 @@ const MethodTemplate = ({ structName, propertyName, safePropertyName, -}: $ReadOnly<{ +}: Readonly<{ returnType: string, returnValue: string, hasteModuleName: string, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js index d5b38f45357a2e..3656fcef740ec4 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js @@ -15,7 +15,7 @@ import type {Struct} from '../StructCollector'; const {serializeConstantsStruct} = require('./serializeConstantsStruct'); const {serializeRegularStruct} = require('./serializeRegularStruct'); -export type StructSerilizationOutput = $ReadOnly<{ +export type StructSerilizationOutput = Readonly<{ methods: string, declaration: string, }>; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js index defe5722f29a03..8d93d9ad29c210 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js @@ -27,7 +27,7 @@ const ModuleDeclarationTemplate = ({ structDeclarations, eventEmitters, protocolMethods, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structDeclarations: string, eventEmitters: string, @@ -63,7 +63,7 @@ const HeaderFileTemplate = ({ moduleDeclarations, structInlineMethods, assumeNonnull, -}: $ReadOnly<{ +}: Readonly<{ headerFileName: string, moduleDeclarations: string, structInlineMethods: string, @@ -118,7 +118,7 @@ const HeaderFileTemplate = ({ const SourceFileTemplate = ({ headerFileName, moduleImplementations, -}: $ReadOnly<{ +}: Readonly<{ headerFileName: string, moduleImplementations: string, }>) => `/** diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js index c48a8b20e95f1d..6abb268696001d 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js @@ -33,13 +33,13 @@ const ProtocolMethodTemplate = ({ returnObjCType, methodName, params, -}: $ReadOnly<{ +}: Readonly<{ returnObjCType: string, methodName: string, params: string, }>) => `- (${returnObjCType})${methodName}${params};`; -export type StructParameterRecord = $ReadOnly<{ +export type StructParameterRecord = Readonly<{ paramIndex: number, structName: string, }>; @@ -53,7 +53,7 @@ type ReturnJSType = | 'NumberKind' | 'StringKind'; -export type MethodSerializationOutput = $ReadOnly<{ +export type MethodSerializationOutput = Readonly<{ methodName: string, protocolMethod: string, selector: string, @@ -186,7 +186,7 @@ function getParamObjCType( structName: string, structCollector: StructCollector, resolveAlias: AliasResolver, -): $ReadOnly<{objCType: string, isStruct: boolean}> { +): Readonly<{objCType: string, isStruct: boolean}> { const {name: paramName, typeAnnotation: nullableTypeAnnotation} = param; const [typeAnnotation, nullable] = unwrapNullable(nullableTypeAnnotation); const isRequired = !param.optional && !nullable; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js index d4b80dcb054c29..bc24adee3acf85 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js @@ -27,7 +27,7 @@ const ModuleTemplate = ({ moduleName, eventEmitters, methodSerializationOutputs, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structs: $ReadOnlyArray, moduleName: string, @@ -96,7 +96,7 @@ namespace facebook::react { const RCTCxxConvertCategoryTemplate = ({ hasteModuleName, structName, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, structName: string, }>) => `@implementation RCTCxxConvert (${hasteModuleName}_${structName}) @@ -111,7 +111,7 @@ const InlineHostFunctionTemplate = ({ methodName, returnJSType, selector, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, methodName: string, returnJSType: string, @@ -126,7 +126,7 @@ const MethodMapEntryTemplate = ({ methodName, structParamRecords, argCount, -}: $ReadOnly<{ +}: Readonly<{ hasteModuleName: string, methodName: string, structParamRecords: $ReadOnlyArray, diff --git a/packages/react-native-codegen/src/generators/modules/Utils.js b/packages/react-native-codegen/src/generators/modules/Utils.js index efb39462a27576..ce6b633984172d 100644 --- a/packages/react-native-codegen/src/generators/modules/Utils.js +++ b/packages/react-native-codegen/src/generators/modules/Utils.js @@ -36,7 +36,7 @@ function createAliasResolver(aliasMap: NativeModuleAliasMap): AliasResolver { function getModules( schema: SchemaType, -): $ReadOnly<{[hasteModuleName: string]: NativeModuleSchema}> { +): Readonly<{[hasteModuleName: string]: NativeModuleSchema}> { return Object.keys(schema.modules).reduce<{[string]: NativeModuleSchema}>( (modules, hasteModuleName: string) => { const module = schema.modules[hasteModuleName]; diff --git a/packages/react-native-codegen/src/parsers/flow/components/commands.js b/packages/react-native-codegen/src/parsers/flow/components/commands.js index df8f54d901d766..72468977218390 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -28,7 +28,7 @@ function buildCommandSchema( property: EventTypeAST, types: TypeDeclarationMap, parser: Parser, -): $ReadOnly<{ +): Readonly<{ name: string, optional: boolean, typeAnnotation: { diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js index edfb10de5b018e..952d65b300cf02 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js @@ -419,7 +419,7 @@ describe('Flow Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, @@ -954,7 +954,7 @@ describe('Flow Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, diff --git a/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js b/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js index 7a1207841defdb..7e0f61bd3e0f7c 100644 --- a/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js +++ b/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js @@ -16,7 +16,7 @@ const hermesParser = require('hermes-parser'); function parseFlowAndThrowErrors( code: string, - options: $ReadOnly<{filename?: ?string}> = {}, + options: Readonly<{filename?: ?string}> = {}, ): ESTreeProgram { let ast; try { diff --git a/packages/react-native-codegen/src/parsers/parsers-commons.js b/packages/react-native-codegen/src/parsers/parsers-commons.js index b72c9a2c158925..1d4f2cf42572dc 100644 --- a/packages/react-native-codegen/src/parsers/parsers-commons.js +++ b/packages/react-native-codegen/src/parsers/parsers-commons.js @@ -77,7 +77,7 @@ const { } = require('./utils'); const invariant = require('invariant'); -export type CommandOptions = $ReadOnly<{ +export type CommandOptions = Readonly<{ supportedCommands: $ReadOnlyArray, }>; diff --git a/packages/react-native-codegen/src/parsers/schema.js b/packages/react-native-codegen/src/parsers/schema.js index 08ab1ceb6c9718..fab007d762a6f1 100644 --- a/packages/react-native-codegen/src/parsers/schema.js +++ b/packages/react-native-codegen/src/parsers/schema.js @@ -20,7 +20,7 @@ import type { SchemaType, } from '../CodegenSchema.js'; -export type ComponentSchemaBuilderConfig = $ReadOnly<{ +export type ComponentSchemaBuilderConfig = Readonly<{ filename: string, componentName: string, extendsProps: $ReadOnlyArray, diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js index 6f0eeeb6b55ad8..f454e4a8bdd78b 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js @@ -495,7 +495,7 @@ describe('TypeScript Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, @@ -1029,7 +1029,7 @@ describe('TypeScript Module Parser', () => { propName: string, propType: string, ): [ - $ReadOnly<{ + Readonly<{ name: string, optional: boolean, typeAnnotation: NativeModuleBaseTypeAnnotation, diff --git a/packages/react-native-codegen/src/parsers/utils.js b/packages/react-native-codegen/src/parsers/utils.js index c96b7eee825514..851450b0b1815a 100644 --- a/packages/react-native-codegen/src/parsers/utils.js +++ b/packages/react-native-codegen/src/parsers/utils.js @@ -16,12 +16,12 @@ const path = require('path'); export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe}; export type TypeResolutionStatus = - | $ReadOnly<{ + | Readonly<{ type: 'alias' | 'enum', successful: true, name: string, }> - | $ReadOnly<{ + | Readonly<{ successful: false, }>; @@ -66,7 +66,7 @@ function createParserErrorCapturer(): [ function verifyPlatforms( hasteModuleName: string, moduleName: string, -): $ReadOnly<{ +): Readonly<{ cxxOnly: boolean, excludedPlatforms: Array<'iOS' | 'android'>, }> { diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow index ad22b2384641bc..f683d900a60b04 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow @@ -27,7 +27,7 @@ import type { import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, bool: boolean, string: string, @@ -49,12 +49,12 @@ type NativeProps = $ReadOnly<{ stringUnion?: WithDefault<'foo' | 'bar', 'bar'>, intUnion?: WithDefault<1 | 2, 1>, - nestedObject: $ReadOnly<{ + nestedObject: Readonly<{ string: string, color: ColorValue, }>, - nestedObjectChanged: $ReadOnly<{ + nestedObjectChanged: Readonly<{ string: boolean, color: ColorValue, }>, @@ -66,14 +66,14 @@ type NativeProps = $ReadOnly<{ >, arrayNestedObject: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ string: string, color: ColorValue, }>, >, arrayNestedObjectChange: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ string: boolean, color: ColorValue, }>, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow index 1c55d96e879261..6aab7e7baa5bd8 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow @@ -19,7 +19,7 @@ import type { import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow index eac4e7902729f1..cc0c2cd9857ed9 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow @@ -19,7 +19,7 @@ import type { import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow index a0c2bf47be817c..f3eac473837f51 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow index 4a52639b60d70b..7006bb983320b4 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow @@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow index 8159b7a528f94b..a96a01407cb2ea 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow @@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow index 38e623fb18dd1c..a50fa6d6d8c4dd 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow @@ -15,7 +15,7 @@ import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow index f959d0f86429a4..25c2367b7264d0 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow index 96804c612acfef..e12e8910ac53d7 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow index 75b5c1372701ce..9176e3dac70283 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow @@ -19,7 +19,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, bool: boolean, string: string, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow index 39500471106f0d..3db5c80ccf8788 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, sizes?: WithDefault<$ReadOnlyArray<'small' | 'large' | 'huge'>, 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow index be895fab47d3c1..571f3ea77a7ac5 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow index 6d0eca01b9b261..640e75ec0f029f 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: Int32, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow index becf8076edc3e8..603796543b7e06 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow index 6420c82668cada..f984ef5f3e1944 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow @@ -18,12 +18,12 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, height?: WithDefault, - pins: $ReadOnly<{ + pins: Readonly<{ x: Float, y: Float, color?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow index 31cd0865d830f9..9f4eb4de26e2a0 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow @@ -18,12 +18,12 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, height?: WithDefault, - pins: $ReadOnly<{ + pins: Readonly<{ x: Float, y: Float, color: string, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow index 085a98f9e270a9..e6a54c4f22a8a9 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow @@ -18,12 +18,12 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, height?: WithDefault, - pins: $ReadOnly<{ + pins: Readonly<{ x: Float, y: Float, }>, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow index 17748d1f58d53e..7d251a902361cd 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, size?: WithDefault<'small' | 'huge' | 'large', 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow index 6127034224ddc7..bb82078775e675 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow @@ -14,7 +14,7 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, size?: WithDefault<'small' | 'large', 'small'>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow index 3c95a27944ea66..4615e09adc1121 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, text: string, backgroundColor?: WithDefault, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow index cccaf9a22f2999..1695477144ddd1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow @@ -13,7 +13,7 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...ViewProps, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow index 32b27c558c5177..29342b33c5fd82 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo export interface Spec extends TurboModule { +exampleFunction: (a: string, b: number) => void; - +getConstants: () => $ReadOnly<{ + +getConstants: () => Readonly<{ constant?: string, }>; } diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow index a1ae7696fe1da5..603030e24bb156 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo export interface Spec extends TurboModule { +exampleFunction: (a: string, b: number) => void; - +getConstants: () => $ReadOnly<{ + +getConstants: () => Readonly<{ constant: string, }>; } diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow index 878d2267f2d59c..fb537117b543b0 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo export interface Spec extends TurboModule { +exampleFunction: (a: string, b: number) => void; - +getConstants: () => $ReadOnly<{}>; + +getConstants: () => Readonly<{}>; } export default (TurboModuleRegistry.getEnforcing( diff --git a/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js b/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js index 312c726d9071ae..464b632c78eab6 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroid.android.js @@ -20,12 +20,12 @@ import * as React from 'react'; import {useCallback, useImperativeHandle, useRef} from 'react'; type PopupMenuSelectionEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ item: number, }>, >; -type PopupMenuDismissEvent = NativeSyntheticEvent<$ReadOnly<{}>>; +type PopupMenuDismissEvent = NativeSyntheticEvent>; export type PopupMenuAndroidInstance = { +show: () => void, diff --git a/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js b/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js index 2961eb8f361fdf..67b642eda15008 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js @@ -19,13 +19,13 @@ import * as React from 'react'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type PopupMenuSelectionEvent = $ReadOnly<{ +type PopupMenuSelectionEvent = Readonly<{ item: Int32, }>; -type PopupMenuDismissEvent = $ReadOnly<{}>; +type PopupMenuDismissEvent = Readonly<{}>; -type NativeProps = $ReadOnly<{ +type NativeProps = Readonly<{ ...ViewProps, //Props diff --git a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js index 84e274c1834349..78b6cda1bf1187 100644 --- a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -16,7 +16,7 @@ import RCTActionSheetManager from './NativeActionSheetManager'; const processColor = require('../StyleSheet/processColor').default; const invariant = require('invariant'); -export type ActionSheetIOSOptions = $ReadOnly<{ +export type ActionSheetIOSOptions = Readonly<{ title?: ?string, message?: ?string, options: Array, @@ -30,7 +30,7 @@ export type ActionSheetIOSOptions = $ReadOnly<{ disabledButtonIndices?: Array, }>; -export type ShareActionSheetIOSOptions = $ReadOnly<{ +export type ShareActionSheetIOSOptions = Readonly<{ message?: ?string, url?: ?string, subject?: ?string, @@ -42,7 +42,7 @@ export type ShareActionSheetIOSOptions = $ReadOnly<{ userInterfaceStyle?: ?string, }>; -export type ShareActionSheetError = $ReadOnly<{ +export type ShareActionSheetError = Readonly<{ domain: string, code: string, userInfo?: ?Object, diff --git a/packages/react-native/Libraries/Animated/AnimatedImplementation.js b/packages/react-native/Libraries/Animated/AnimatedImplementation.js index 610e68ef8bb9d4..fa51e5ea1fd795 100644 --- a/packages/react-native/Libraries/Animated/AnimatedImplementation.js +++ b/packages/react-native/Libraries/Animated/AnimatedImplementation.js @@ -89,7 +89,7 @@ const diffClampImpl = function ( const _combineCallbacks = function ( callback: ?EndCallback, - config: $ReadOnly<{...AnimationConfig, ...}>, + config: Readonly<{...AnimationConfig, ...}>, ) { if (callback && config.onComplete) { return (...args: Array) => { diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js index 6a4c856dcda146..53982c18134a2c 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js @@ -581,7 +581,7 @@ test('AnimatedValue.interpolate', () => { let _interpolatedValueX; const viewRef = createRef(); - function MyApp({outputRangeX}: $ReadOnly<{outputRangeX: number}>) { + function MyApp({outputRangeX}: Readonly<{outputRangeX: number}>) { const valueX = useAnimatedValue(0.5, {useNativeDriver: true}); _valueX = valueX; const offset = outputRangeX - 1; diff --git a/packages/react-native/Libraries/Animated/animations/Animation.js b/packages/react-native/Libraries/Animated/animations/Animation.js index 3dd0b14a84db63..b071a89661b1f1 100644 --- a/packages/react-native/Libraries/Animated/animations/Animation.js +++ b/packages/react-native/Libraries/Animated/animations/Animation.js @@ -24,7 +24,7 @@ export type EndResult = { }; export type EndCallback = (result: EndResult) => void; -export type AnimationConfig = $ReadOnly<{ +export type AnimationConfig = Readonly<{ isInteraction?: boolean, useNativeDriver: boolean, platformConfig?: PlatformConfig, @@ -98,7 +98,7 @@ export default class Animation { this.__active = false; } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ platformConfig: ?PlatformConfig, ... }> { diff --git a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js index 30c532ee4c1930..35eb106f5a2b9b 100644 --- a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js @@ -14,11 +14,11 @@ import type {AnimationConfig, EndCallback} from './Animation'; import Animation from './Animation'; -export type DecayAnimationConfig = $ReadOnly<{ +export type DecayAnimationConfig = Readonly<{ ...AnimationConfig, velocity: | number - | $ReadOnly<{ + | Readonly<{ x: number, y: number, ... @@ -27,7 +27,7 @@ export type DecayAnimationConfig = $ReadOnly<{ ... }>; -export type DecayAnimationConfigSingle = $ReadOnly<{ +export type DecayAnimationConfigSingle = Readonly<{ ...AnimationConfig, velocity: number, deceleration?: number, @@ -52,7 +52,7 @@ export default class DecayAnimation extends Animation { this._platformConfig = config.platformConfig; } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ deceleration: number, iterations: number, platformConfig: ?PlatformConfig, diff --git a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js index 1a28de90748f4f..cb70e4454117ed 100644 --- a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js @@ -19,7 +19,7 @@ import * as SpringConfig from '../SpringConfig'; import Animation from './Animation'; import invariant from 'invariant'; -export type SpringAnimationConfig = $ReadOnly<{ +export type SpringAnimationConfig = Readonly<{ ...AnimationConfig, toValue: | number @@ -44,7 +44,7 @@ export type SpringAnimationConfig = $ReadOnly<{ restSpeedThreshold?: number, velocity?: | number - | $ReadOnly<{ + | Readonly<{ x: number, y: number, ... @@ -60,7 +60,7 @@ export type SpringAnimationConfig = $ReadOnly<{ ... }>; -export type SpringAnimationConfigSingle = $ReadOnly<{ +export type SpringAnimationConfigSingle = Readonly<{ ...AnimationConfig, toValue: number, overshootClamping?: boolean, @@ -78,7 +78,7 @@ export type SpringAnimationConfigSingle = $ReadOnly<{ ... }>; -opaque type SpringAnimationInternalState = $ReadOnly<{ +opaque type SpringAnimationInternalState = Readonly<{ lastPosition: number, lastVelocity: number, lastTime: number, @@ -168,7 +168,7 @@ export default class SpringAnimation extends Animation { invariant(this._mass > 0, 'Mass value must be greater than 0'); } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ damping: number, initialVelocity: number, iterations: number, diff --git a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js index 0589855753f566..96946862b21f21 100644 --- a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js @@ -18,12 +18,12 @@ import type {AnimationConfig, EndCallback} from './Animation'; import AnimatedColor from '../nodes/AnimatedColor'; import Animation from './Animation'; -export type TimingAnimationConfig = $ReadOnly<{ +export type TimingAnimationConfig = Readonly<{ ...AnimationConfig, toValue: | number | AnimatedValue - | $ReadOnly<{ + | Readonly<{ x: number, y: number, ... @@ -38,7 +38,7 @@ export type TimingAnimationConfig = $ReadOnly<{ ... }>; -export type TimingAnimationConfigSingle = $ReadOnly<{ +export type TimingAnimationConfigSingle = Readonly<{ ...AnimationConfig, toValue: number, easing?: (value: number) => number, @@ -80,7 +80,7 @@ export default class TimingAnimation extends Animation { this._platformConfig = config.platformConfig; } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ type: 'frames', frames: $ReadOnlyArray, toValue: number, diff --git a/packages/react-native/Libraries/Animated/createAnimatedComponent.js b/packages/react-native/Libraries/Animated/createAnimatedComponent.js index 58743588007d3c..470e745d5afa2a 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -61,7 +61,7 @@ type NonAnimatedProps = | 'testID' | 'disabled' | 'accessibilityLabel'; -type PassThroughProps = $ReadOnly<{ +type PassThroughProps = Readonly<{ passthroughAnimatedPropExplicitValues?: ViewProps | null, }>; @@ -99,7 +99,7 @@ export default function createAnimatedComponent< >( Component: TInstance, ): AnimatedComponentType< - $ReadOnly>, + Readonly>, React.ElementRef, > { return unstable_createAnimatedComponentWithAllowlist(Component, null); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js index fa3c4df59c102d..b0de039b402692 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js @@ -22,7 +22,7 @@ import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes'; import AnimatedValue, {flushValue} from './AnimatedValue'; import AnimatedWithChildren from './AnimatedWithChildren'; -export type AnimatedColorConfig = $ReadOnly<{ +export type AnimatedColorConfig = Readonly<{ ...AnimatedNodeConfig, useNativeDriver: boolean, }>; @@ -112,7 +112,7 @@ function isRgbaAnimatedValue(value: any): boolean { export function getRgbaValueAndNativeColor( value: RgbaValue | ColorValue, -): $ReadOnly<{ +): Readonly<{ rgbaValue: RgbaValue, nativeColor?: NativeColorValue, }> { diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js index 0372262d11d8ca..aa3d9c3edcac34 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -34,7 +34,7 @@ export type InterpolationConfigSupportedOutputType = export type InterpolationConfigType< OutputT: InterpolationConfigSupportedOutputType, -> = $ReadOnly<{ +> = Readonly<{ ...AnimatedNodeConfig, inputRange: $ReadOnlyArray, outputRange: $ReadOnlyArray, diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js index 9cf3b990d18c48..fa1d59b3b7a606 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js @@ -15,7 +15,7 @@ import invariant from 'invariant'; type ValueListenerCallback = (state: {value: number, ...}) => unknown; -export type AnimatedNodeConfig = $ReadOnly<{ +export type AnimatedNodeConfig = Readonly<{ debugID?: string, unstable_disableBatchingForNativeCreate?: boolean, }>; @@ -34,7 +34,7 @@ export default class AnimatedNode { _platformConfig: ?PlatformConfig = undefined; constructor( - config?: ?$ReadOnly<{ + config?: ?Readonly<{ ...AnimatedNodeConfig, ... }>, diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js index 95bb12f18d848c..0064816bf36a38 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js @@ -23,7 +23,7 @@ export function isPlainObject( value: unknown, /* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype and ReactElement checks preserve the type refinement of `value`. */ -): value is $ReadOnly<{[string]: unknown}> { +): value is Readonly<{[string]: unknown}> { const proto = value !== null && typeof value === 'object' ? Object.getPrototypeOf(value) diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js index 308de24556adb1..6c63964b7c679c 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js @@ -24,7 +24,7 @@ import AnimatedObject from './AnimatedObject'; import AnimatedStyle from './AnimatedStyle'; import invariant from 'invariant'; -export type AnimatedPropsAllowlist = $ReadOnly<{ +export type AnimatedPropsAllowlist = Readonly<{ style?: ?AnimatedStyleAllowlist, [key: string]: true | AnimatedStyleAllowlist, }>; @@ -358,6 +358,6 @@ export default class AnimatedProps extends AnimatedNode { // this shim when they do. // $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; -const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean = +const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = // $FlowFixMe[method-unbinding] Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js index 1e9c1837703cac..a5a9c3887a775b 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js @@ -19,7 +19,7 @@ import AnimatedObject from './AnimatedObject'; import AnimatedTransform from './AnimatedTransform'; import AnimatedWithChildren from './AnimatedWithChildren'; -export type AnimatedStyleAllowlist = $ReadOnly<{[string]: true}>; +export type AnimatedStyleAllowlist = Readonly<{[string]: true}>; type FlatStyle = {[string]: unknown}; type FlatStyleForWeb = [unknown, TStyle]; @@ -253,6 +253,6 @@ export default class AnimatedStyle extends AnimatedWithChildren { // this shim when they do. // $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; -const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean = +const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = // $FlowFixMe[method-unbinding] Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js index 7d28e936f90d86..1d8ec17bdbba29 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js @@ -24,7 +24,7 @@ import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHe import AnimatedInterpolation from './AnimatedInterpolation'; import AnimatedWithChildren from './AnimatedWithChildren'; -export type AnimatedValueConfig = $ReadOnly<{ +export type AnimatedValueConfig = Readonly<{ ...AnimatedNodeConfig, useNativeDriver: boolean, }>; diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js b/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js index 304d65a733d494..acc969ad2d20b6 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js @@ -17,7 +17,7 @@ import AnimatedValue from './AnimatedValue'; import AnimatedWithChildren from './AnimatedWithChildren'; import invariant from 'invariant'; -export type AnimatedValueXYConfig = $ReadOnly<{ +export type AnimatedValueXYConfig = Readonly<{ ...AnimatedNodeConfig, useNativeDriver: boolean, }>; diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 0e9fd477a7476a..de86dba65518cd 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -26,7 +26,7 @@ const GRAY = '#999999'; type IndicatorSize = number | 'small' | 'large'; -type ActivityIndicatorIOSProps = $ReadOnly<{ +type ActivityIndicatorIOSProps = Readonly<{ /** Whether the indicator should hide when not animating. @@ -34,7 +34,7 @@ type ActivityIndicatorIOSProps = $ReadOnly<{ */ hidesWhenStopped?: ?boolean, }>; -export type ActivityIndicatorProps = $ReadOnly<{ +export type ActivityIndicatorProps = Readonly<{ ...ViewProps, ...ActivityIndicatorIOSProps, diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 84eedcf168cfc3..71c947adf4df65 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -27,7 +27,7 @@ import View from './View/View'; import invariant from 'invariant'; import * as React from 'react'; -export type ButtonProps = $ReadOnly<{ +export type ButtonProps = Readonly<{ /** Text to display inside the button. On Android the given title will be converted to the uppercased form. diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js index c6ef94eca4ff46..e100c6006eed46 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js @@ -22,12 +22,12 @@ import * as React from 'react'; export type DrawerStates = 'Idle' | 'Dragging' | 'Settling'; export type DrawerSlideEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ offset: number, }>, >; -export type DrawerLayoutAndroidProps = $ReadOnly<{ +export type DrawerLayoutAndroidProps = Readonly<{ ...ViewProps, /** diff --git a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js index 58379250a49746..a17be856521c70 100644 --- a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js +++ b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js @@ -25,7 +25,7 @@ export type KeyboardEventEasing = | 'linear' | 'keyboard'; -export type KeyboardMetrics = $ReadOnly<{ +export type KeyboardMetrics = Readonly<{ screenX: number, screenY: number, width: number, @@ -40,13 +40,13 @@ type BaseKeyboardEvent = { endCoordinates: KeyboardMetrics, }; -export type AndroidKeyboardEvent = $ReadOnly<{ +export type AndroidKeyboardEvent = Readonly<{ ...BaseKeyboardEvent, duration: 0, easing: 'keyboard', }>; -export type IOSKeyboardEvent = $ReadOnly<{ +export type IOSKeyboardEvent = Readonly<{ ...BaseKeyboardEvent, startCoordinates: KeyboardMetrics, isEventFromThisApp: boolean, diff --git a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 6eca1569f30248..4f1cd85848f09d 100644 --- a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -26,7 +26,7 @@ import Keyboard from './Keyboard'; import * as React from 'react'; import {createRef} from 'react'; -export type KeyboardAvoidingViewProps = $ReadOnly<{ +export type KeyboardAvoidingViewProps = Readonly<{ ...ViewProps, /** diff --git a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js index ab3afcfc27f533..027428146a06ae 100644 --- a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js +++ b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js @@ -12,7 +12,7 @@ import StyleSheet from '../../StyleSheet/StyleSheet'; import LayoutConformanceNativeComponent from './LayoutConformanceNativeComponent'; import * as React from 'react'; -export type LayoutConformanceProps = $ReadOnly<{ +export type LayoutConformanceProps = Readonly<{ /** * strict: Layout in accordance with W3C spec, even when breaking * compatibility: Layout with the same behavior as previous versions of React Native diff --git a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js index 698bee769952cf..226bc5c0e3993d 100644 --- a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +++ b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js @@ -13,7 +13,7 @@ import type {ViewProps} from '../View/ViewPropTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; -type Props = $ReadOnly<{ +type Props = Readonly<{ mode: 'strict' | 'compatibility', ...ViewProps, }>; diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index 687baf982d52d6..c1a71a9a3fa41c 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -29,11 +29,11 @@ import {memo, useMemo, useRef, useState} from 'react'; export type {PressableAndroidRippleConfig}; -export type PressableStateCallbackType = $ReadOnly<{ +export type PressableStateCallbackType = Readonly<{ pressed: boolean, }>; -type PressableBaseProps = $ReadOnly<{ +type PressableBaseProps = Readonly<{ /** * Whether a press gesture can be interrupted by a parent gesture such as a * scroll event. Defaults to true. @@ -156,7 +156,7 @@ type PressableBaseProps = $ReadOnly<{ unstable_pressDelay?: ?number, }>; -export type PressableProps = $ReadOnly<{ +export type PressableProps = Readonly<{ // Pressability may override `onMouseEnter` and `onMouseLeave` to // implement `onHoverIn` and `onHoverOut` in a platform-agnostic way. // Hover events should be used instead of mouse events. diff --git a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js index c8851fe94fc457..dc64193200ce4d 100644 --- a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js +++ b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js @@ -19,7 +19,7 @@ import invariant from 'invariant'; import * as React from 'react'; import {useMemo} from 'react'; -type NativeBackgroundProp = $ReadOnly<{ +type NativeBackgroundProp = Readonly<{ type: 'RippleAndroid', color: ?number, borderless: boolean, @@ -40,13 +40,13 @@ export type PressableAndroidRippleConfig = { export default function useAndroidRippleForView( rippleConfig: ?PressableAndroidRippleConfig, viewRef: {current: null | React.ElementRef}, -): ?$ReadOnly<{ +): ?Readonly<{ onPressIn: (event: GestureResponderEvent) => void, onPressMove: (event: GestureResponderEvent) => void, onPressOut: (event: GestureResponderEvent) => void, viewProps: - | $ReadOnly<{nativeBackgroundAndroid: NativeBackgroundProp}> - | $ReadOnly<{nativeForegroundAndroid: NativeBackgroundProp}>, + | Readonly<{nativeBackgroundAndroid: NativeBackgroundProp}> + | Readonly<{nativeForegroundAndroid: NativeBackgroundProp}>, }> { const {color, borderless, radius, foreground} = rippleConfig ?? {}; diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js index 8f20e23a52c38d..e565e0bf7281d7 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js @@ -35,7 +35,7 @@ type IndeterminateProgressBarAndroidStyleAttrProp = { indeterminate: true, }; -type ProgressBarAndroidBaseProps = $ReadOnly<{ +type ProgressBarAndroidBaseProps = Readonly<{ /** * Whether to show the ProgressBar (true, the default) or hide it (false). */ @@ -51,12 +51,12 @@ type ProgressBarAndroidBaseProps = $ReadOnly<{ }>; export type ProgressBarAndroidProps = - | $ReadOnly<{ + | Readonly<{ ...ViewProps, ...ProgressBarAndroidBaseProps, ...DeterminateProgressBarAndroidStyleAttrProp, }> - | $ReadOnly<{ + | Readonly<{ ...ViewProps, ...ProgressBarAndroidBaseProps, ...IndeterminateProgressBarAndroidStyleAttrProp, diff --git a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js index 4c6947a1fbc0d1..53b5231bc7f8d9 100644 --- a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js +++ b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js @@ -21,7 +21,7 @@ import * as React from 'react'; const Platform = require('../../Utilities/Platform').default; -export type RefreshControlPropsIOS = $ReadOnly<{ +export type RefreshControlPropsIOS = Readonly<{ /** * The color of the refresh indicator. */ @@ -36,7 +36,7 @@ export type RefreshControlPropsIOS = $ReadOnly<{ title?: ?string, }>; -export type RefreshControlPropsAndroid = $ReadOnly<{ +export type RefreshControlPropsAndroid = Readonly<{ /** * Whether the pull to refresh functionality is enabled. */ @@ -55,7 +55,7 @@ export type RefreshControlPropsAndroid = $ReadOnly<{ size?: ?('default' | 'large'), }>; -type RefreshControlBaseProps = $ReadOnly<{ +type RefreshControlBaseProps = Readonly<{ /** * Called when the view starts refreshing. */ @@ -72,7 +72,7 @@ type RefreshControlBaseProps = $ReadOnly<{ progressViewOffset?: ?number, }>; -export type RefreshControlProps = $ReadOnly<{ +export type RefreshControlProps = Readonly<{ ...ViewProps, ...RefreshControlPropsIOS, ...RefreshControlPropsAndroid, diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index fdb830dc6e6244..d247ac706d2b63 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -174,7 +174,7 @@ export interface PublicScrollViewInstance type InnerViewInstance = React.ElementRef; -export type ScrollViewPropsIOS = $ReadOnly<{ +export type ScrollViewPropsIOS = Readonly<{ /** * Controls whether iOS should automatically adjust the content inset * for scroll views that are placed behind a navigation bar or @@ -330,7 +330,7 @@ export type ScrollViewPropsIOS = $ReadOnly<{ ), }>; -export type ScrollViewPropsAndroid = $ReadOnly<{ +export type ScrollViewPropsAndroid = Readonly<{ /** * Enables nested scrolling for Android API level 21+. * Nested scrolling is supported by default on iOS @@ -391,11 +391,11 @@ export type ScrollViewPropsAndroid = $ReadOnly<{ }>; type StickyHeaderComponentType = component( - ref?: React.RefSetter<$ReadOnly void}>>, + ref?: React.RefSetter void}>>, ...ScrollViewStickyHeaderProps ); -type ScrollViewBaseProps = $ReadOnly<{ +type ScrollViewBaseProps = Readonly<{ /** * These styles will be applied to the scroll view content container which * wraps all of the child views. Example: @@ -514,7 +514,7 @@ type ScrollViewBaseProps = $ReadOnly<{ * whether content is "visible" or not. * */ - maintainVisibleContentPosition?: ?$ReadOnly<{ + maintainVisibleContentPosition?: ?Readonly<{ minIndexForVisible: number, autoscrollToTopThreshold?: ?number, }>, @@ -673,7 +673,7 @@ type ScrollViewBaseProps = $ReadOnly<{ scrollViewRef?: React.RefSetter, }>; -export type ScrollViewProps = $ReadOnly<{ +export type ScrollViewProps = Readonly<{ ...Omit, ...ScrollViewPropsIOS, ...ScrollViewPropsAndroid, @@ -686,7 +686,7 @@ type ScrollViewState = { const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16; -export type ScrollViewComponentStatics = $ReadOnly<{ +export type ScrollViewComponentStatics = Readonly<{ Context: typeof ScrollViewContext, }>; diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js index 1feee6999541c0..05a2eb18690d26 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js @@ -19,7 +19,7 @@ import type { } from '../../Types/CoreEventTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -export type ScrollViewNativeProps = $ReadOnly<{ +export type ScrollViewNativeProps = Readonly<{ ...ViewProps, alwaysBounceHorizontal?: ?boolean, alwaysBounceVertical?: ?boolean, @@ -46,7 +46,7 @@ export type ScrollViewNativeProps = $ReadOnly<{ indicatorStyle?: ?('default' | 'black' | 'white'), isInvertedVirtualizedList?: ?boolean, keyboardDismissMode?: ?('none' | 'on-drag' | 'interactive'), - maintainVisibleContentPosition?: ?$ReadOnly<{ + maintainVisibleContentPosition?: ?Readonly<{ minIndexForVisible: number, autoscrollToTopThreshold?: ?number, }>, diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index af9b9866464a58..72a249831a6192 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -25,7 +25,7 @@ import { useState, } from 'react'; -export type ScrollViewStickyHeaderProps = $ReadOnly<{ +export type ScrollViewStickyHeaderProps = Readonly<{ children?: React.Node, nextHeaderLayoutY: ?number, onLayout: (event: LayoutChangeEvent) => void, diff --git a/packages/react-native/Libraries/Components/StaticRenderer.js b/packages/react-native/Libraries/Components/StaticRenderer.js index a7ae823ef71dc3..da36f13053372d 100644 --- a/packages/react-native/Libraries/Components/StaticRenderer.js +++ b/packages/react-native/Libraries/Components/StaticRenderer.js @@ -12,7 +12,7 @@ import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ /** * Indicates whether the render function needs to be called again */ diff --git a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js index 5cbc674ecf34ed..396ed4047e28e8 100644 --- a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js +++ b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js @@ -55,7 +55,7 @@ export type StatusBarAnimation = $Keys<{ ... }>; -export type StatusBarPropsAndroid = $ReadOnly<{ +export type StatusBarPropsAndroid = Readonly<{ /** * The background color of the status bar. * @@ -76,7 +76,7 @@ export type StatusBarPropsAndroid = $ReadOnly<{ translucent?: ?boolean, }>; -export type StatusBarPropsIOS = $ReadOnly<{ +export type StatusBarPropsIOS = Readonly<{ /** * If the network activity indicator should be visible. * @@ -92,7 +92,7 @@ export type StatusBarPropsIOS = $ReadOnly<{ showHideTransition?: ?('fade' | 'slide' | 'none'), }>; -type StatusBarBaseProps = $ReadOnly<{ +type StatusBarBaseProps = Readonly<{ /** * If the status bar is hidden. */ @@ -108,7 +108,7 @@ type StatusBarBaseProps = $ReadOnly<{ barStyle?: ?('default' | 'light-content' | 'dark-content'), }>; -export type StatusBarProps = $ReadOnly<{ +export type StatusBarProps = Readonly<{ ...StatusBarPropsAndroid, ...StatusBarPropsIOS, ...StatusBarBaseProps, diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index 1047396d6b58fa..8d3c5530cf56a5 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -48,7 +48,7 @@ export type SwitchPropsIOS = { tintColor?: ?ColorValue, }; -type SwitchChangeEventData = $ReadOnly<{ +type SwitchChangeEventData = Readonly<{ target: number, value: boolean, }>; @@ -82,7 +82,7 @@ type SwitchPropsBase = { color of the background exposed by the shrunken track, use [`ios_backgroundColor`](https://reactnative.dev/docs/switch#ios_backgroundColor). */ - trackColor?: ?$ReadOnly<{ + trackColor?: ?Readonly<{ false?: ?ColorValue, true?: ?ColorValue, }>, @@ -109,7 +109,7 @@ type SwitchPropsBase = { onValueChange?: ?(value: boolean) => Promise | void, }; -export type SwitchProps = $ReadOnly<{ +export type SwitchProps = Readonly<{ ...ViewProps, ...SwitchPropsIOS, ...SwitchPropsBase, diff --git a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index 8cc136961bc009..c3016749841ec5 100644 --- a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -63,7 +63,7 @@ export type ReturnKeyType = export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline'; -export type AndroidTextInputNativeProps = $ReadOnly<{ +export type AndroidTextInputNativeProps = Readonly<{ // This allows us to inherit everything from ViewProps except for style (see below) // This must be commented for Fabric codegen to work. ...Omit, @@ -339,13 +339,13 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * Callback that is called when the text input is blurred. * `target` is the reactTag of the element */ - onBlur?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>, + onBlur?: ?BubblingEventHandler>, /** * Callback that is called when the text input is focused. * `target` is the reactTag of the element */ - onFocus?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>, + onFocus?: ?BubblingEventHandler>, /** * Callback that is called when the text input's text changes. @@ -353,7 +353,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * TODO: differentiate between onChange and onChangeText */ onChange?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, eventCount: Int32, text: string}>, + Readonly<{target: Int32, eventCount: Int32, text: string}>, >, /** @@ -362,7 +362,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * TODO: differentiate between onChange and onChangeText */ onChangeText?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, eventCount: Int32, text: string}>, + Readonly<{target: Int32, eventCount: Int32, text: string}>, >, /** @@ -373,18 +373,16 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * Only called for multiline text inputs. */ onContentSizeChange?: ?DirectEventHandler< - $ReadOnly<{ + Readonly<{ target: Int32, - contentSize: $ReadOnly<{width: Double, height: Double}>, + contentSize: Readonly<{width: Double, height: Double}>, }>, >, /** * Callback that is called when text input ends. */ - onEndEditing?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, text: string}>, - >, + onEndEditing?: ?BubblingEventHandler>, /** * Callback that is called when the text input selection is changed. @@ -392,9 +390,9 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * `{ nativeEvent: { selection: { start, end } } }`. */ onSelectionChange?: ?DirectEventHandler< - $ReadOnly<{ + Readonly<{ target: Int32, - selection: $ReadOnly<{start: Double, end: Double}>, + selection: Readonly<{start: Double, end: Double}>, }>, >, @@ -403,7 +401,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * Invalid if `multiline={true}` is specified. */ onSubmitEditing?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, text: string}>, + Readonly<{target: Int32, text: string}>, >, /** @@ -413,7 +411,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * the typed-in character otherwise including `' '` for space. * Fires before `onChange` callbacks. */ - onKeyPress?: ?BubblingEventHandler<$ReadOnly<{target: Int32, key: string}>>, + onKeyPress?: ?BubblingEventHandler>, /** * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. @@ -421,28 +419,28 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * is not provided for performance reasons. */ onScroll?: ?DirectEventHandler< - $ReadOnly<{ + Readonly<{ target: Int32, responderIgnoreScroll: boolean, - contentInset: $ReadOnly<{ + contentInset: Readonly<{ top: Double, // always 0 on Android bottom: Double, // always 0 on Android left: Double, // always 0 on Android right: Double, // always 0 on Android }>, - contentOffset: $ReadOnly<{ + contentOffset: Readonly<{ x: Double, y: Double, }>, - contentSize: $ReadOnly<{ + contentSize: Readonly<{ width: Double, // always 0 on Android height: Double, // always 0 on Android }>, - layoutMeasurement: $ReadOnly<{ + layoutMeasurement: Readonly<{ width: Double, height: Double, }>, - velocity: $ReadOnly<{ + velocity: Readonly<{ x: Double, // always 0 on Android y: Double, // always 0 on Android }>, @@ -479,7 +477,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ - selection?: ?$ReadOnly<{ + selection?: ?Readonly<{ start: Int32, end?: ?Int32, }>, @@ -582,7 +580,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ textShadowRadius?: ?Float, textDecorationLine?: ?string, fontStyle?: ?string, - textShadowOffset?: ?$ReadOnly<{width?: ?Double, height?: ?Double}>, + textShadowOffset?: ?Readonly<{width?: ?Double, height?: ?Double}>, lineHeight?: ?Float, textTransform?: ?string, color?: ?Int32, diff --git a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js index d80716cbf313f6..20ec3003d5c500 100644 --- a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js +++ b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js @@ -76,7 +76,7 @@ import * as React from 'react'; * For an example, look at InputAccessoryViewExample.js in RNTester. */ -export type InputAccessoryViewProps = $ReadOnly<{ +export type InputAccessoryViewProps = Readonly<{ +children: React.Node, /** * An ID which is used to associate this `InputAccessoryView` to diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index 8438a0eac100c1..27063a5dd9d478 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -25,7 +25,7 @@ import * as React from 'react'; /** * @see TextInputProps.onChange */ -type TextInputChangeEventData = $ReadOnly<{ +type TextInputChangeEventData = Readonly<{ eventCount: number, target: number, text: string, @@ -35,10 +35,10 @@ export type TextInputChangeEvent = NativeSyntheticEvent; export type TextInputEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ eventCount: number, previousText: string, - range: $ReadOnly<{ + range: Readonly<{ start: number, end: number, }>, @@ -47,9 +47,9 @@ export type TextInputEvent = NativeSyntheticEvent< }>, >; -type TextInputContentSizeChangeEventData = $ReadOnly<{ +type TextInputContentSizeChangeEventData = Readonly<{ target: number, - contentSize: $ReadOnly<{ + contentSize: Readonly<{ width: number, height: number, }>, @@ -73,17 +73,17 @@ export type TextInputBlurEvent = BlurEvent; */ export type TextInputFocusEvent = FocusEvent; -type TargetEvent = $ReadOnly<{ +type TargetEvent = Readonly<{ target: number, ... }>; -export type Selection = $ReadOnly<{ +export type Selection = Readonly<{ start: number, end: number, }>; -type TextInputSelectionChangeEventData = $ReadOnly<{ +type TextInputSelectionChangeEventData = Readonly<{ ...TargetEvent, selection: Selection, ... @@ -95,7 +95,7 @@ type TextInputSelectionChangeEventData = $ReadOnly<{ export type TextInputSelectionChangeEvent = NativeSyntheticEvent; -type TextInputKeyPressEventData = $ReadOnly<{ +type TextInputKeyPressEventData = Readonly<{ ...TargetEvent, key: string, target?: ?number, @@ -109,7 +109,7 @@ type TextInputKeyPressEventData = $ReadOnly<{ export type TextInputKeyPressEvent = NativeSyntheticEvent; -type TextInputEndEditingEventData = $ReadOnly<{ +type TextInputEndEditingEventData = Readonly<{ ...TargetEvent, eventCount: number, text: string, @@ -122,7 +122,7 @@ type TextInputEndEditingEventData = $ReadOnly<{ export type TextInputEndEditingEvent = NativeSyntheticEvent; -type TextInputSubmitEditingEventData = $ReadOnly<{ +type TextInputSubmitEditingEventData = Readonly<{ ...TargetEvent, eventCount: number, text: string, @@ -266,7 +266,7 @@ export type EnterKeyHintTypeOptions = type PasswordRules = string; -export type TextInputIOSProps = $ReadOnly<{ +export type TextInputIOSProps = Readonly<{ /** * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. * @platform ios @@ -403,7 +403,7 @@ export type TextInputIOSProps = $ReadOnly<{ smartInsertDelete?: ?boolean, }>; -export type TextInputAndroidProps = $ReadOnly<{ +export type TextInputAndroidProps = Readonly<{ /** * When provided it will set the color of the cursor (or "caret") in the component. * Unlike the behavior of `selectionColor` the cursor color will be set independently @@ -512,7 +512,7 @@ export type TextInputAndroidProps = $ReadOnly<{ underlineColorAndroid?: ?ColorValue, }>; -type TextInputBaseProps = $ReadOnly<{ +type TextInputBaseProps = Readonly<{ /** * When provided, the text input will only accept drag and drop events for the specified * types. If null or not provided, the text input will accept all types of drag and drop events. @@ -946,7 +946,7 @@ type TextInputBaseProps = $ReadOnly<{ * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ - selection?: ?$ReadOnly<{ + selection?: ?Readonly<{ start: number, end?: ?number, }>, @@ -1031,7 +1031,7 @@ type TextInputBaseProps = $ReadOnly<{ textAlign?: ?('left' | 'center' | 'right'), }>; -export type TextInputProps = $ReadOnly<{ +export type TextInputProps = Readonly<{ ...Omit, ...TextInputIOSProps, ...TextInputAndroidProps, @@ -1167,8 +1167,8 @@ type InternalTextInput = component( ...TextInputProps ); -export type TextInputComponentStatics = $ReadOnly<{ - State: $ReadOnly<{ +export type TextInputComponentStatics = Readonly<{ + State: Readonly<{ currentlyFocusedInput: () => ?HostInstance, currentlyFocusedField: () => ?number, focusTextInput: (textField: ?HostInstance) => void, diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index f42f8ed0464fbd..a7d9beb175698b 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -120,7 +120,7 @@ export type { TextInputSubmitEditingEvent, }; -type TextInputStateType = $ReadOnly<{ +type TextInputStateType = Readonly<{ /** * @deprecated Use currentlyFocusedInput * Returns the ID of the currently focused text field, if one exists @@ -965,7 +965,7 @@ TextInput.State = { focusTextInput: TextInputState.focusTextInput, }; -export type TextInputComponentStatics = $ReadOnly<{ +export type TextInputComponentStatics = Readonly<{ State: TextInputStateType, }>; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js index 7974a77cb9fc1d..3370b442d15b89 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js @@ -19,7 +19,7 @@ import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -type TouchableBounceProps = $ReadOnly<{ +type TouchableBounceProps = Readonly<{ ...React.ElementConfig, onPressAnimationComplete?: ?() => void, @@ -31,7 +31,7 @@ type TouchableBounceProps = $ReadOnly<{ hostRef: React.RefSetter>, }>; -type TouchableBounceState = $ReadOnly<{ +type TouchableBounceState = Readonly<{ pressability: Pressability, scale: Animated.Value, }>; @@ -226,10 +226,10 @@ export default (function TouchableBounceWrapper({ ...props }: { ref: React.RefSetter, - ...$ReadOnly>, + ...Readonly>, }) { return ; } as component( ref?: React.RefSetter, - ...props: $ReadOnly> + ...props: Readonly> )); diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index ba1518a85e8429..0064e996238ad7 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -22,7 +22,7 @@ import Platform from '../../Utilities/Platform'; import * as React from 'react'; import {cloneElement} from 'react'; -type AndroidProps = $ReadOnly<{ +type AndroidProps = Readonly<{ nextFocusDown?: ?number, nextFocusForward?: ?number, nextFocusLeft?: ?number, @@ -30,14 +30,14 @@ type AndroidProps = $ReadOnly<{ nextFocusUp?: ?number, }>; -type IOSProps = $ReadOnly<{ +type IOSProps = Readonly<{ /** * @deprecated Use `focusable` instead */ hasTVPreferredFocus?: ?boolean, }>; -type TouchableHighlightBaseProps = $ReadOnly<{ +type TouchableHighlightBaseProps = Readonly<{ /** * Determines what the opacity of the wrapped view should be when touch is active. */ @@ -63,19 +63,19 @@ type TouchableHighlightBaseProps = $ReadOnly<{ hostRef?: React.RefSetter>, }>; -export type TouchableHighlightProps = $ReadOnly<{ +export type TouchableHighlightProps = Readonly<{ ...TouchableWithoutFeedbackProps, ...AndroidProps, ...IOSProps, ...TouchableHighlightBaseProps, }>; -type ExtraStyles = $ReadOnly<{ +type ExtraStyles = Readonly<{ child: ViewStyleProp, underlay: ViewStyleProp, }>; -type TouchableHighlightState = $ReadOnly<{ +type TouchableHighlightState = Readonly<{ pressability: Pressability, extraStyles: ?ExtraStyles, }>; @@ -412,13 +412,13 @@ class TouchableHighlightImpl extends React.Component< const TouchableHighlight: component( ref?: React.RefSetter>, - ...props: $ReadOnly> + ...props: Readonly> ) = ({ ref: hostRef, ...props }: { ref?: React.RefSetter>, - ...$ReadOnly>, + ...Readonly>, }) => ; TouchableHighlight.displayName = 'TouchableHighlight'; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js index a929ba2f23a2a3..6a0b5e12ee6bfc 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -69,7 +69,7 @@ type TouchableNativeFeedbackTVProps = { nextFocusUp?: ?number, }; -export type TouchableNativeFeedbackProps = $ReadOnly<{ +export type TouchableNativeFeedbackProps = Readonly<{ ...TouchableWithoutFeedbackProps, ...TouchableNativeFeedbackTVProps, /** @@ -87,14 +87,14 @@ export type TouchableNativeFeedbackProps = $ReadOnly<{ * type is available on Android API level 21+ */ background?: ?( - | $ReadOnly<{ + | Readonly<{ type: 'ThemeAttrAndroid', attribute: | 'selectableItemBackground' | 'selectableItemBackgroundBorderless', rippleRadius: ?number, }> - | $ReadOnly<{ + | Readonly<{ type: 'RippleAndroid', color: ?number, borderless: boolean, @@ -114,7 +114,7 @@ export type TouchableNativeFeedbackProps = $ReadOnly<{ useForeground?: ?boolean, }>; -type TouchableNativeFeedbackState = $ReadOnly<{ +type TouchableNativeFeedbackState = Readonly<{ pressability: Pressability, }>; @@ -138,7 +138,7 @@ class TouchableNativeFeedback extends React.Component< * * @param rippleRadius The radius of ripple effect */ - static SelectableBackground: (rippleRadius?: ?number) => $ReadOnly<{ + static SelectableBackground: (rippleRadius?: ?number) => Readonly<{ attribute: 'selectableItemBackground', type: 'ThemeAttrAndroid', rippleRadius: ?number, @@ -155,7 +155,7 @@ class TouchableNativeFeedback extends React.Component< * * @param rippleRadius The radius of ripple effect */ - static SelectableBackgroundBorderless: (rippleRadius?: ?number) => $ReadOnly<{ + static SelectableBackgroundBorderless: (rippleRadius?: ?number) => Readonly<{ attribute: 'selectableItemBackgroundBorderless', type: 'ThemeAttrAndroid', rippleRadius: ?number, @@ -180,7 +180,7 @@ class TouchableNativeFeedback extends React.Component< color: string, borderless: boolean, rippleRadius?: ?number, - ) => $ReadOnly<{ + ) => Readonly<{ borderless: boolean, color: ?number, rippleRadius: ?number, diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 9733b42c7aa4c1..72d7ad49f2f974 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -21,7 +21,7 @@ import flattenStyle from '../../StyleSheet/flattenStyle'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -export type TouchableOpacityTVProps = $ReadOnly<{ +export type TouchableOpacityTVProps = Readonly<{ /** * *(Apple TV only)* TV preferred focus (see documentation for the View component). * @@ -66,7 +66,7 @@ export type TouchableOpacityTVProps = $ReadOnly<{ nextFocusUp?: ?number, }>; -type TouchableOpacityBaseProps = $ReadOnly<{ +type TouchableOpacityBaseProps = Readonly<{ /** * Determines what the opacity of the wrapped view should be when touch is active. * Defaults to 0.2 @@ -77,13 +77,13 @@ type TouchableOpacityBaseProps = $ReadOnly<{ hostRef?: ?React.RefSetter>, }>; -export type TouchableOpacityProps = $ReadOnly<{ +export type TouchableOpacityProps = Readonly<{ ...TouchableWithoutFeedbackProps, ...TouchableOpacityTVProps, ...TouchableOpacityBaseProps, }>; -type TouchableOpacityState = $ReadOnly<{ +type TouchableOpacityState = Readonly<{ anim: Animated.Value, pressability: Pressability, }>; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 159e39e5b1c02b..adb099c2721344 100755 --- a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -36,7 +36,7 @@ export type TouchableWithoutFeedbackPropsAndroid = { touchSoundDisabled?: ?boolean, }; -export type TouchableWithoutFeedbackProps = $ReadOnly< +export type TouchableWithoutFeedbackProps = Readonly< { children?: ?React.Node, /** diff --git a/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js b/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js index f7b32329e444ad..d07fff980a1326 100644 --- a/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js +++ b/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js @@ -14,7 +14,7 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; import StyleSheet from '../../StyleSheet/StyleSheet'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ style?: ?ViewStyleProp, children?: React.Node, ... diff --git a/packages/react-native/Libraries/Components/View/ViewAccessibility.js b/packages/react-native/Libraries/Components/View/ViewAccessibility.js index 09d0b4c1977224..3c99c03925e8a4 100644 --- a/packages/react-native/Libraries/Components/View/ViewAccessibility.js +++ b/packages/react-native/Libraries/Components/View/ViewAccessibility.js @@ -154,7 +154,7 @@ export type AccessibilityActionName = | 'escape'; // the info associated with an accessibility action -export type AccessibilityActionInfo = $ReadOnly<{ +export type AccessibilityActionInfo = Readonly<{ name: AccessibilityActionName | string, label?: string, ... @@ -162,7 +162,7 @@ export type AccessibilityActionInfo = $ReadOnly<{ // The info included in the event sent to onAccessibilityAction export type AccessibilityActionEvent = NativeSyntheticEvent< - $ReadOnly<{actionName: string, ...}>, + Readonly<{actionName: string, ...}>, >; export type AccessibilityState = { @@ -189,7 +189,7 @@ export type AccessibilityState = { ... }; -export type AccessibilityValue = $ReadOnly<{ +export type AccessibilityValue = Readonly<{ /** * The minimum value of this component's range. (should be an integer) */ @@ -211,7 +211,7 @@ export type AccessibilityValue = $ReadOnly<{ text?: Stringish, }>; -export type AccessibilityPropsAndroid = $ReadOnly<{ +export type AccessibilityPropsAndroid = Readonly<{ /** * Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props, * the text is read aloud. The value should should match the nativeID of the related element. @@ -268,7 +268,7 @@ export type AccessibilityPropsAndroid = $ReadOnly<{ screenReaderFocusable?: boolean, }>; -export type AccessibilityPropsIOS = $ReadOnly<{ +export type AccessibilityPropsIOS = Readonly<{ /** * Prevents view from being inverted if set to true and color inversion is turned on. * @@ -338,7 +338,7 @@ export type AccessibilityPropsIOS = $ReadOnly<{ accessibilityRespondsToUserInteraction?: ?boolean, }>; -export type AccessibilityProps = $ReadOnly<{ +export type AccessibilityProps = Readonly<{ ...AccessibilityPropsAndroid, ...AccessibilityPropsIOS, /** diff --git a/packages/react-native/Libraries/Components/View/ViewPropTypes.js b/packages/react-native/Libraries/Components/View/ViewPropTypes.js index 8046e9d13e3171..a20d8f246ea543 100644 --- a/packages/react-native/Libraries/Components/View/ViewPropTypes.js +++ b/packages/react-native/Libraries/Components/View/ViewPropTypes.js @@ -33,7 +33,7 @@ import * as React from 'react'; export type ViewLayout = LayoutRectangle; export type ViewLayoutEvent = LayoutChangeEvent; -type DirectEventProps = $ReadOnly<{ +type DirectEventProps = Readonly<{ /** * When `accessible` is true, the system will try to invoke this function * when the user performs an accessibility custom action. @@ -79,13 +79,13 @@ type DirectEventProps = $ReadOnly<{ onAccessibilityEscape?: ?() => unknown, }>; -type MouseEventProps = $ReadOnly<{ +type MouseEventProps = Readonly<{ onMouseEnter?: ?(event: MouseEvent) => void, onMouseLeave?: ?(event: MouseEvent) => void, }>; // Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use) -type PointerEventProps = $ReadOnly<{ +type PointerEventProps = Readonly<{ onClick?: ?(event: PointerEvent) => void, onClickCapture?: ?(event: PointerEvent) => void, onPointerEnter?: ?(event: PointerEvent) => void, @@ -110,21 +110,21 @@ type PointerEventProps = $ReadOnly<{ onLostPointerCaptureCapture?: ?(e: PointerEvent) => void, }>; -type FocusEventProps = $ReadOnly<{ +type FocusEventProps = Readonly<{ onBlur?: ?(event: BlurEvent) => void, onBlurCapture?: ?(event: BlurEvent) => void, onFocus?: ?(event: FocusEvent) => void, onFocusCapture?: ?(event: FocusEvent) => void, }>; -type KeyEventProps = $ReadOnly<{ +type KeyEventProps = Readonly<{ onKeyDown?: ?(event: KeyDownEvent) => void, onKeyDownCapture?: ?(event: KeyDownEvent) => void, onKeyUp?: ?(event: KeyUpEvent) => void, onKeyUpCapture?: ?(event: KeyUpEvent) => void, }>; -type TouchEventProps = $ReadOnly<{ +type TouchEventProps = Readonly<{ onTouchCancel?: ?(e: GestureResponderEvent) => void, onTouchCancelCapture?: ?(e: GestureResponderEvent) => void, onTouchEnd?: ?(e: GestureResponderEvent) => void, @@ -140,7 +140,7 @@ type TouchEventProps = $ReadOnly<{ * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`, * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion. */ -export type GestureResponderHandlers = $ReadOnly<{ +export type GestureResponderHandlers = Readonly<{ /** * Does this view want to "claim" touch responsiveness? This is called for * every touch move on the `View` when it is not the responder. @@ -257,12 +257,12 @@ export type GestureResponderHandlers = $ReadOnly<{ onStartShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean, }>; -type AndroidDrawableThemeAttr = $ReadOnly<{ +type AndroidDrawableThemeAttr = Readonly<{ type: 'ThemeAttrAndroid', attribute: string, }>; -type AndroidDrawableRipple = $ReadOnly<{ +type AndroidDrawableRipple = Readonly<{ type: 'RippleAndroid', color?: ?number, borderless?: ?boolean, @@ -271,7 +271,7 @@ type AndroidDrawableRipple = $ReadOnly<{ type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple; -export type ViewPropsAndroid = $ReadOnly<{ +export type ViewPropsAndroid = Readonly<{ nativeBackgroundAndroid?: ?AndroidDrawable, nativeForegroundAndroid?: ?AndroidDrawable, @@ -356,7 +356,7 @@ export type ViewPropsAndroid = $ReadOnly<{ onClick?: ?(event: GestureResponderEvent) => unknown, }>; -export type TVViewPropsIOS = $ReadOnly<{ +export type TVViewPropsIOS = Readonly<{ /** * *(Apple TV only)* When set to true, this view will be focusable * and navigable using the Apple TV remote. @@ -401,7 +401,7 @@ export type TVViewPropsIOS = $ReadOnly<{ tvParallaxMagnification?: number, }>; -export type ViewPropsIOS = $ReadOnly<{ +export type ViewPropsIOS = Readonly<{ /** * Whether this `View` should be rendered as a bitmap before compositing. * @@ -412,7 +412,7 @@ export type ViewPropsIOS = $ReadOnly<{ shouldRasterizeIOS?: ?boolean, }>; -type ViewBaseProps = $ReadOnly<{ +type ViewBaseProps = Readonly<{ children?: React.Node, style?: ?ViewStyleProp, @@ -508,7 +508,7 @@ type ViewBaseProps = $ReadOnly<{ experimental_accessibilityOrder?: ?Array, }>; -export type ViewProps = $ReadOnly<{ +export type ViewProps = Readonly<{ ...DirectEventProps, ...GestureResponderHandlers, ...MouseEventProps, diff --git a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js b/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js index e8911cebdd290f..b89ba3102d5445 100644 --- a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js +++ b/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js @@ -10,25 +10,25 @@ 'use strict'; -type HermesStackLocationNative = $ReadOnly<{ +type HermesStackLocationNative = Readonly<{ type: 'NATIVE', }>; -type HermesStackLocationSource = $ReadOnly<{ +type HermesStackLocationSource = Readonly<{ type: 'SOURCE', sourceUrl: string, line1Based: number, column1Based: number, }>; -type HermesStackLocationInternalBytecode = $ReadOnly<{ +type HermesStackLocationInternalBytecode = Readonly<{ type: 'INTERNAL_BYTECODE', sourceUrl: string, line1Based: number, virtualOffset0Based: number, }>; -type HermesStackLocationBytecode = $ReadOnly<{ +type HermesStackLocationBytecode = Readonly<{ type: 'BYTECODE', sourceUrl: string, line1Based: number, @@ -41,20 +41,20 @@ type HermesStackLocation = | HermesStackLocationInternalBytecode | HermesStackLocationBytecode; -type HermesStackEntryFrame = $ReadOnly<{ +type HermesStackEntryFrame = Readonly<{ type: 'FRAME', location: HermesStackLocation, functionName: string, }>; -type HermesStackEntrySkipped = $ReadOnly<{ +type HermesStackEntrySkipped = Readonly<{ type: 'SKIPPED', count: number, }>; type HermesStackEntry = HermesStackEntryFrame | HermesStackEntrySkipped; -export type HermesParsedStack = $ReadOnly<{ +export type HermesParsedStack = Readonly<{ message: string, entries: $ReadOnlyArray, }>; diff --git a/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js b/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js index 52fa4fe225659e..0ec71a33b7b262 100644 --- a/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js +++ b/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js @@ -14,7 +14,7 @@ import type {StackFrame} from '../NativeExceptionsManager'; const getDevServer = require('./getDevServer').default; -export type CodeFrame = $ReadOnly<{ +export type CodeFrame = Readonly<{ content: string, location: ?{ row: number, @@ -24,7 +24,7 @@ export type CodeFrame = $ReadOnly<{ fileName: string, }>; -export type SymbolicatedStackTrace = $ReadOnly<{ +export type SymbolicatedStackTrace = Readonly<{ stack: Array, codeFrame: ?CodeFrame, }>; diff --git a/packages/react-native/Libraries/Core/RawEventEmitter.js b/packages/react-native/Libraries/Core/RawEventEmitter.js index eb71bffb0192be..fd7d726a114172 100644 --- a/packages/react-native/Libraries/Core/RawEventEmitter.js +++ b/packages/react-native/Libraries/Core/RawEventEmitter.js @@ -12,7 +12,7 @@ import type {IEventEmitter} from '../vendor/emitter/EventEmitter'; import EventEmitter from '../vendor/emitter/EventEmitter'; -export type RawEventEmitterEvent = $ReadOnly<{ +export type RawEventEmitterEvent = Readonly<{ eventName: string, // We expect, but do not/cannot require, that nativeEvent is an object // with the properties: key, elementType (string), type (string), tag (numeric), diff --git a/packages/react-native/Libraries/Core/setUpSegmentFetcher.js b/packages/react-native/Libraries/Core/setUpSegmentFetcher.js index 54d9e37a6a0c33..f56430ac5a0db6 100644 --- a/packages/react-native/Libraries/Core/setUpSegmentFetcher.js +++ b/packages/react-native/Libraries/Core/setUpSegmentFetcher.js @@ -19,7 +19,7 @@ export type FetchSegmentFunction = typeof __fetchSegment; function __fetchSegment( segmentId: number, - options: $ReadOnly<{ + options: Readonly<{ otaBuildNumber: ?string, requestedModuleName: string, segmentHash: string, diff --git a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js index ff353ed6031db8..5a996da4f319b4 100644 --- a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js @@ -45,9 +45,9 @@ type UnsafeNativeEventObject = Object; * can theoretically listen to `RCTDeviceEventEmitter` (although discouraged). */ export default class NativeEventEmitter< - TEventToArgsMap: $ReadOnly< + TEventToArgsMap: Readonly< Record>, - > = $ReadOnly>>, + > = 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 36d44553775c67..9bfe9ee44e7664 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/AssetSourceResolver.js b/packages/react-native/Libraries/Image/AssetSourceResolver.js index 29950f1535eee9..cb665428333f7c 100644 --- a/packages/react-native/Libraries/Image/AssetSourceResolver.js +++ b/packages/react-native/Libraries/Image/AssetSourceResolver.js @@ -22,7 +22,7 @@ export type ResolvedAssetSource = { type AssetDestPathResolver = 'android' | 'generic'; // From @react-native/assets-registry -type PackagerAsset = $ReadOnly<{ +type PackagerAsset = Readonly<{ __packager_asset: boolean, fileSystemLocation: string, httpServerLocation: string, diff --git a/packages/react-native/Libraries/Image/ImageProps.js b/packages/react-native/Libraries/Image/ImageProps.js index 697084e3f1151b..2acab590b8d676 100644 --- a/packages/react-native/Libraries/Image/ImageProps.js +++ b/packages/react-native/Libraries/Image/ImageProps.js @@ -38,7 +38,7 @@ type ImageProgressEventDataIOS = { * @see ImagePropsIOS.onProgress */ export type ImageProgressEventIOS = NativeSyntheticEvent< - $ReadOnly, + Readonly, >; type ImageErrorEventData = { @@ -46,7 +46,7 @@ type ImageErrorEventData = { }; export type ImageErrorEvent = NativeSyntheticEvent< - $ReadOnly, + Readonly, >; type ImageLoadEventData = { @@ -57,11 +57,9 @@ type ImageLoadEventData = { }, }; -export type ImageLoadEvent = NativeSyntheticEvent< - $ReadOnly, ->; +export type ImageLoadEvent = NativeSyntheticEvent>; -export type ImagePropsIOS = $ReadOnly<{ +export type ImagePropsIOS = Readonly<{ /** * A static image to display while loading the image source. * @@ -82,13 +80,13 @@ export type ImagePropsIOS = $ReadOnly<{ onProgress?: ?(event: ImageProgressEventIOS) => void, }>; -export type ImagePropsAndroid = $ReadOnly<{ +export type ImagePropsAndroid = Readonly<{ /** * similarly to `source`, this property represents the resource used to render * the loading indicator for the image, displayed until image is ready to be * displayed, typically after when it got downloaded from network. */ - loadingIndicatorSource?: ?(number | $ReadOnly), + loadingIndicatorSource?: ?(number | Readonly), progressiveRenderingEnabled?: ?boolean, fadeDuration?: ?number, @@ -127,7 +125,7 @@ export type ImagePropsAndroid = $ReadOnly<{ resizeMultiplier?: ?number, }>; -export type ImagePropsBase = $ReadOnly<{ +export type ImagePropsBase = Readonly<{ ...Omit, /** * When true, indicates the image is an accessibility element. @@ -333,7 +331,7 @@ export type ImagePropsBase = $ReadOnly<{ children?: empty, }>; -export type ImageProps = $ReadOnly<{ +export type ImageProps = Readonly<{ ...ImagePropsIOS, ...ImagePropsAndroid, ...ImagePropsBase, @@ -344,7 +342,7 @@ export type ImageProps = $ReadOnly<{ style?: ?ImageStyleProp, }>; -export type ImageBackgroundProps = $ReadOnly<{ +export type ImageBackgroundProps = Readonly<{ ...ImageProps, children?: React.Node, diff --git a/packages/react-native/Libraries/Image/ImageSource.js b/packages/react-native/Libraries/Image/ImageSource.js index 4418051ee761cf..12df755a0dc13b 100644 --- a/packages/react-native/Libraries/Image/ImageSource.js +++ b/packages/react-native/Libraries/Image/ImageSource.js @@ -104,7 +104,7 @@ type ImageSourceProperties = { export function getImageSourceProperties( imageSource: ImageURISource, -): $ReadOnly { +): Readonly { const object: ImageSourceProperties = {}; if (imageSource.body != null) { object.body = imageSource.body; diff --git a/packages/react-native/Libraries/Image/ImageTypes.flow.js b/packages/react-native/Libraries/Image/ImageTypes.flow.js index 265f4a9baf9f4c..6058d6367bd790 100644 --- a/packages/react-native/Libraries/Image/ImageTypes.flow.js +++ b/packages/react-native/Libraries/Image/ImageTypes.flow.js @@ -23,7 +23,7 @@ export type ImageSize = { export type ImageResolvedAssetSource = ResolvedAssetSource; -type ImageComponentStaticsIOS = $ReadOnly<{ +type ImageComponentStaticsIOS = Readonly<{ getSize(uri: string): Promise, getSize( uri: string, @@ -60,7 +60,7 @@ type ImageComponentStaticsIOS = $ReadOnly<{ resolveAssetSource(source: ImageSource): ?ImageResolvedAssetSource, }>; -type ImageComponentStaticsAndroid = $ReadOnly<{ +type ImageComponentStaticsAndroid = Readonly<{ ...ImageComponentStaticsIOS, abortPrefetch(requestId: number): void, }>; diff --git a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js index 6ad7da9a8db642..f5236d2101c15d 100644 --- a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js +++ b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js @@ -26,7 +26,7 @@ import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIg import codegenNativeCommands from '../Utilities/codegenNativeCommands'; import Platform from '../Utilities/Platform'; -type ImageHostComponentProps = $ReadOnly<{ +type ImageHostComponentProps = Readonly<{ ...ImageProps, ...ViewProps, @@ -37,9 +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 3bcdb390522ea5..9f4f62beb0b766 100644 --- a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js +++ b/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js @@ -18,10 +18,10 @@ import type {ImageResizeMode} from './ImageResizeMode'; import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; -type RCTTextInlineImageNativeProps = $ReadOnly<{ +type RCTTextInlineImageNativeProps = Readonly<{ ...ViewProps, resizeMode?: ?ImageResizeMode, - src?: ?$ReadOnlyArray>, + src?: ?$ReadOnlyArray>, tintColor?: ?ColorValue, headers?: ?{[string]: string}, }>; diff --git a/packages/react-native/Libraries/Image/nativeImageSource.js b/packages/react-native/Libraries/Image/nativeImageSource.js index 04835eea300d52..a7bf9396e053d9 100644 --- a/packages/react-native/Libraries/Image/nativeImageSource.js +++ b/packages/react-native/Libraries/Image/nativeImageSource.js @@ -12,7 +12,7 @@ import type {ImageURISource} from './ImageSource'; import Platform from '../Utilities/Platform'; -type NativeImageSourceSpec = $ReadOnly<{ +type NativeImageSourceSpec = Readonly<{ android?: string, ios?: string, default?: string, diff --git a/packages/react-native/Libraries/Interaction/PanResponder.js b/packages/react-native/Libraries/Interaction/PanResponder.js index 49f604598cba4d..dc6ea6f46da2d9 100644 --- a/packages/react-native/Libraries/Interaction/PanResponder.js +++ b/packages/react-native/Libraries/Interaction/PanResponder.js @@ -204,7 +204,7 @@ export type GestureResponderHandlerMethods = { onStartShouldSetResponderCapture: (event: GestureResponderEvent) => boolean, }; -export type PanResponderCallbacks = $ReadOnly<{ +export type PanResponderCallbacks = Readonly<{ onMoveShouldSetPanResponder?: ?ActiveCallback, onMoveShouldSetPanResponderCapture?: ?ActiveCallback, onStartShouldSetPanResponder?: ?ActiveCallback, diff --git a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js index 3b79cf4f2b0ace..28fc16055df612 100644 --- a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js @@ -31,11 +31,11 @@ export type { // Reexport type export type {LayoutAnimationConfig} from '../Renderer/shims/ReactNativeTypes'; -export type LayoutAnimationTypes = $ReadOnly<{ +export type LayoutAnimationTypes = Readonly<{ [type in LayoutAnimationType]: type, }>; -export type LayoutAnimationProperties = $ReadOnly<{ +export type LayoutAnimationProperties = Readonly<{ [prop in LayoutAnimationProperty]: prop, }>; diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index 2f2851bf67ca74..44257b7c91b6c4 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -38,7 +38,7 @@ type RequiredFlatListProps = { * An array (or array-like list) of items to render. Other data types can be * used by targeting VirtualizedList directly. */ - data: ?$ReadOnly<$ArrayLike>, + data: ?Readonly<$ArrayLike>, }; type OptionalFlatListProps = { /** @@ -93,7 +93,7 @@ type OptionalFlatListProps = { * specify `ItemSeparatorComponent`. */ getItemLayout?: ( - data: ?$ReadOnly<$ArrayLike>, + data: ?Readonly<$ArrayLike>, index: number, ) => { length: number, diff --git a/packages/react-native/Libraries/Lists/SectionListModern.js b/packages/react-native/Libraries/Lists/SectionListModern.js index 2d89633c868010..01de31a98f5e1d 100644 --- a/packages/react-native/Libraries/Lists/SectionListModern.js +++ b/packages/react-native/Libraries/Lists/SectionListModern.js @@ -101,7 +101,7 @@ type OptionalProps = { removeClippedSubviews?: boolean, }; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...Omit< VirtualizedSectionListProps, 'getItem' | 'getItemCount' | 'renderItem' | 'keyExtractor', diff --git a/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js b/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js index a730c73faa31f8..9a54004221fc5f 100644 --- a/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js +++ b/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js @@ -20,7 +20,7 @@ function testPropPropagatedToMountingLayer({ value, defaultValue, renderChildrenForValue, -}: $ReadOnly<{ +}: Readonly<{ propName: string, value: TValue, defaultValue: TValue, @@ -29,7 +29,7 @@ function testPropPropagatedToMountingLayer({ describe(propName, () => { it('is propagated to the mounting layer', () => { const root = Fantom.createRoot(); - const props: FlatListProps<$ReadOnly<{}>> = { + const props: FlatListProps> = { // $FlowFixMe[incompatible-type] [propName]: value, }; @@ -53,7 +53,7 @@ function testPropPropagatedToMountingLayer({ it(`default value is ${JSON.stringify(defaultValue) ?? 'null'}`, () => { const root = Fantom.createRoot(); - const props: FlatListProps<$ReadOnly<{}>> = { + const props: FlatListProps> = { // $FlowFixMe[incompatible-type] [propName]: defaultValue, }; diff --git a/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js b/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js index 157e2fa3d172ce..065d6ddf0383f2 100644 --- a/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js +++ b/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js @@ -36,7 +36,7 @@ describe('FlatList', () => { expect(component).toMatchSnapshot(); }); it('renders simple list using ListItemComponent', async () => { - function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) { + function ListItemComponent({item}: Readonly<{item: {key: string}}>) { return ; } const component = await create( @@ -48,7 +48,7 @@ describe('FlatList', () => { expect(component).toMatchSnapshot(); }); it('renders simple list using ListItemComponent (multiple columns)', async () => { - function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) { + function ListItemComponent({item}: Readonly<{item: {key: string}}>) { return ; } const component = await create( @@ -137,7 +137,7 @@ describe('FlatList', () => { jest.resetModules(); jest.unmock('../../Components/ScrollView/ScrollView'); - function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) { + function ListItemComponent({item}: Readonly<{item: {key: string}}>) { return ; } const listRef = createRef>(); diff --git a/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js b/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js index 4aa7fc48a3e4ba..fb4bdb3f7d8d12 100644 --- a/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js +++ b/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js @@ -99,7 +99,7 @@ describe('SectionList', () => { }); }); -function propStr(props: $ReadOnly<{[string]: $FlowFixMe}>) { +function propStr(props: Readonly<{[string]: $FlowFixMe}>) { return Object.keys(props) .map(k => { const propObj = props[k] || {}; diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js index 639e97af40df15..a874864a746af4 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js @@ -26,7 +26,7 @@ import {parseLogBoxException} from './parseLogBoxLog'; import * as React from 'react'; export type LogBoxLogs = Set; -export type LogData = $ReadOnly<{ +export type LogData = Readonly<{ level: LogLevel, message: Message, category: Category, @@ -36,7 +36,7 @@ export type LogData = $ReadOnly<{ }>; export type Observer = ( - $ReadOnly<{ + Readonly<{ logs: LogBoxLogs, isDisabled: boolean, selectedLogIndex: number, @@ -45,7 +45,7 @@ export type Observer = ( export type IgnorePattern = string | RegExp; -export type Subscription = $ReadOnly<{ +export type Subscription = Readonly<{ unsubscribe: () => void, }>; @@ -61,7 +61,7 @@ export type WarningInfo = { export type WarningFilter = (format: string) => WarningInfo; -type AppInfo = $ReadOnly<{ +type AppInfo = Readonly<{ appVersion: string, engine: string, onPress?: ?() => void, @@ -427,8 +427,8 @@ function observeNext(observer: Observer): Subscription { }; } -type LogBoxStateSubscriptionProps = $ReadOnly<{}>; -type LogBoxStateSubscriptionState = $ReadOnly<{ +type LogBoxStateSubscriptionProps = Readonly<{}>; +type LogBoxStateSubscriptionState = Readonly<{ logs: LogBoxLogs, isDisabled: boolean, hasError: boolean, @@ -436,7 +436,7 @@ type LogBoxStateSubscriptionState = $ReadOnly<{ }>; type SubscribedComponent = React.ComponentType< - $ReadOnly<{ + Readonly<{ logs: $ReadOnlyArray, isDisabled: boolean, selectedLogIndex: number, diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js b/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js index 81390e059d92e6..e68004677fe8db 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js @@ -55,7 +55,7 @@ function convertStackToComponentStack(stack: Stack): ComponentStack { return componentStack; } -export type LogBoxLogData = $ReadOnly<{ +export type LogBoxLogData = Readonly<{ level: LogLevel, type?: ?string, message: Message, @@ -83,23 +83,23 @@ class LogBoxLog { isComponentError: boolean; extraData: unknown | void; symbolicated: - | $ReadOnly<{error: null, stack: null, status: 'NONE'}> - | $ReadOnly<{error: null, stack: null, status: 'PENDING'}> - | $ReadOnly<{error: null, stack: Stack, status: 'COMPLETE'}> - | $ReadOnly<{error: Error, stack: null, status: 'FAILED'}> = { + | Readonly<{error: null, stack: null, status: 'NONE'}> + | Readonly<{error: null, stack: null, status: 'PENDING'}> + | Readonly<{error: null, stack: Stack, status: 'COMPLETE'}> + | Readonly<{error: Error, stack: null, status: 'FAILED'}> = { error: null, stack: null, status: 'NONE', }; symbolicatedComponentStack: - | $ReadOnly<{error: null, componentStack: null, status: 'NONE'}> - | $ReadOnly<{error: null, componentStack: null, status: 'PENDING'}> - | $ReadOnly<{ + | Readonly<{error: null, componentStack: null, status: 'NONE'}> + | Readonly<{error: null, componentStack: null, status: 'PENDING'}> + | Readonly<{ error: null, componentStack: ComponentStack, status: 'COMPLETE', }> - | $ReadOnly<{error: Error, componentStack: null, status: 'FAILED'}> = { + | Readonly<{error: Error, componentStack: null, status: 'FAILED'}> = { error: null, componentStack: null, status: 'NONE', 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 a3b265b0468a8c..42a3a3a67ecc4b 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js @@ -18,7 +18,7 @@ jest.mock('../LogBoxSymbolication', () => { return {__esModule: true, symbolicate: jest.fn(), deleteStack: jest.fn()}; }); -type CodeCodeFrame = $ReadOnly<{ +type CodeCodeFrame = Readonly<{ content: string, location: ?{ row: number, diff --git a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js index cde538517b086f..2d8e7f54627028 100644 --- a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js +++ b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js @@ -107,7 +107,7 @@ export type ExtendedExceptionData = ExceptionData & { ... }; export type Category = string; -export type CodeFrame = $ReadOnly<{ +export type CodeFrame = Readonly<{ content: string, location: ?{ row: number, @@ -121,10 +121,10 @@ export type CodeFrame = $ReadOnly<{ // it is not integrated into the LogBox UI. collapse?: boolean, }>; -export type Message = $ReadOnly<{ +export type Message = Readonly<{ content: string, substitutions: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ length: number, offset: number, }>, @@ -136,7 +136,7 @@ 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, }> { diff --git a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js index 3ccf93a68bde02..0e496ec9536b32 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js @@ -16,7 +16,7 @@ import * as LogBoxData from './Data/LogBoxData'; import LogBoxInspector from './UI/LogBoxInspector'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ 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 a3fa687c4c6c78..3eaae63de9d153 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js @@ -16,7 +16,7 @@ import LogBoxLog from './Data/LogBoxLog'; import LogBoxLogNotification from './UI/LogBoxNotification'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ logs: $ReadOnlyArray, selectedLogIndex: number, isDisabled?: ?boolean, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js index 8534d14ca4f81e..6e4da80afbf7ff 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js @@ -19,9 +19,9 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ id?: string, - backgroundColor: $ReadOnly<{ + backgroundColor: Readonly<{ default: string, pressed: string, }>, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js index be889b06fd58e8..ac6a5816176e3a 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js @@ -20,7 +20,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useEffect} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onDismiss: () => void, onChangeSelectedIndex: (index: number) => void, onMinimize: () => void, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js index 0b4606cfd19277..7703d4483e1fc2 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js @@ -23,7 +23,7 @@ import LogBoxInspectorSection from './LogBoxInspectorSection'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ componentCodeFrame: ?CodeFrame, codeFrame: ?CodeFrame, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js index c3a7b692106d92..9f599c07e7d8c3 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js @@ -17,7 +17,7 @@ import LogBoxInspectorFooterButton from './LogBoxInspectorFooterButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onDismiss: () => void, onMinimize: () => void, level?: ?LogLevel, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js index e75d7a23e83bbb..c1ecc8fb6d5cdc 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js @@ -16,7 +16,7 @@ import LogBoxButton from './LogBoxButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type ButtonProps = $ReadOnly<{ +type ButtonProps = Readonly<{ id: string, onPress: () => void, text: string, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js index c6aa7937e29553..653a67a5a343a0 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js @@ -20,7 +20,7 @@ import LogBoxInspectorHeaderButton from './LogBoxInspectorHeaderButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onSelectIndex: (selectedIndex: number) => void, selectedIndex: number, total: number, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js index 75c801868c8cbc..95db580e6af2f3 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js @@ -38,7 +38,7 @@ const backgroundForLevel = (level: LogLevel) => })[level]; export default function LogBoxInspectorHeaderButton( - props: $ReadOnly<{ + props: Readonly<{ id: string, disabled: boolean, image: ImageSource, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js index 65259c1edba8c0..fd50a1375b65eb 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js @@ -18,7 +18,7 @@ import LogBoxMessage from './LogBoxMessage'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ collapsed: boolean, message: Message, level: LogLevel, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js index d9e0b1a59d5b2b..5ab475c12560d3 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js @@ -21,7 +21,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ log: LogBoxLog, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js index 2b3d7bcedd9c54..93db5d98790205 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js @@ -14,7 +14,7 @@ import Text from '../../Text/Text'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ heading: string, children: React.Node, action?: ?React.Node, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js index 9826f1c9471b08..96e93c500e22d4 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js @@ -19,7 +19,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useEffect, useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onPress?: ?(event: GestureResponderEvent) => void, status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING', }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js index b3aa786f55c970..afced59c0299e8 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js @@ -19,7 +19,7 @@ import LogBoxButton from './LogBoxButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ frame: StackFrame, onPress?: ?(event: GestureResponderEvent) => void, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js index 48c1b849332cfa..249658f2468356 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js @@ -24,7 +24,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ log: LogBoxLog, onRetry: () => void, }>; @@ -139,7 +139,7 @@ function StackFrameList(props: { } function StackFrameFooter( - props: $ReadOnly<{message: string, onPress: () => void}>, + props: Readonly<{message: string, onPress: () => void}>, ) { return ( diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js b/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js index c3149438e54775..8d646c3705236c 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js @@ -20,7 +20,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useEffect} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ log: LogBoxLog, totalLogCount: number, level: 'warn' | 'error', diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index eb0e1a925413b0..6900fffe7bc2b1 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -59,7 +59,7 @@ const ModalEventEmitter = // destroyed before the callback is fired. let uniqueModalIdentifier = 0; -type OrientationChangeEvent = $ReadOnly<{ +type OrientationChangeEvent = Readonly<{ orientation: 'portrait' | 'landscape', }>; @@ -383,7 +383,7 @@ const styles = StyleSheet.create({ }, }); -type ModalRefProps = $ReadOnly<{ +type ModalRefProps = Readonly<{ ref?: React.RefSetter, }>; diff --git a/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js b/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js index f2e621660b23b6..65f2012cd4bd66 100644 --- a/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +++ b/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js @@ -10,7 +10,7 @@ 'use strict'; -export type RCTNetworkingEventDefinitions = $ReadOnly<{ +export type RCTNetworkingEventDefinitions = Readonly<{ didSendNetworkData: [ [ number, // requestId diff --git a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js index 8fe33fb73e4acb..f59845e9e3417b 100644 --- a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -31,7 +31,7 @@ const PERMISSION_REQUEST_RESULT = Object.freeze({ NEVER_ASK_AGAIN: 'never_ask_again', }); -type PermissionsType = $ReadOnly<{ +type PermissionsType = Readonly<{ READ_CALENDAR: 'android.permission.READ_CALENDAR', WRITE_CALENDAR: 'android.permission.WRITE_CALENDAR', CAMERA: 'android.permission.CAMERA', @@ -134,7 +134,7 @@ const PERMISSIONS = Object.freeze({ */ class PermissionsAndroidImpl { PERMISSIONS: PermissionsType = PERMISSIONS; - RESULTS: $ReadOnly<{ + RESULTS: Readonly<{ DENIED: 'denied', GRANTED: 'granted', NEVER_ASK_AGAIN: 'never_ask_again', diff --git a/packages/react-native/Libraries/Pressability/Pressability.js b/packages/react-native/Libraries/Pressability/Pressability.js index 7c43691bde53e7..e2a06655eb7e68 100644 --- a/packages/react-native/Libraries/Pressability/Pressability.js +++ b/packages/react-native/Libraries/Pressability/Pressability.js @@ -27,7 +27,7 @@ import PressabilityPerformanceEventEmitter from './PressabilityPerformanceEventE import {type PressabilityTouchSignal as TouchSignal} from './PressabilityTypes.js'; import invariant from 'invariant'; -export type PressabilityConfig = $ReadOnly<{ +export type PressabilityConfig = Readonly<{ /** * Whether a press gesture can be interrupted by a parent gesture such as a * scroll event. Defaults to true. @@ -137,7 +137,7 @@ export type PressabilityConfig = $ReadOnly<{ blockNativeResponder?: ?boolean, }>; -export type EventHandlers = $ReadOnly<{ +export type EventHandlers = Readonly<{ onBlur: (event: BlurEvent) => void, onClick: (event: GestureResponderEvent) => void, onFocus: (event: FocusEvent) => void, @@ -378,13 +378,13 @@ export default class Pressability { _pressDelayTimeout: ?TimeoutID = null; _pressOutDelayTimeout: ?TimeoutID = null; _responderID: ?number | HostInstance = null; - _responderRegion: ?$ReadOnly<{ + _responderRegion: ?Readonly<{ bottom: number, left: number, right: number, top: number, }> = null; - _touchActivatePosition: ?$ReadOnly<{ + _touchActivatePosition: ?Readonly<{ pageX: number, pageY: number, }>; @@ -830,7 +830,7 @@ export default class Pressability { _isTouchWithinResponderRegion( touch: GestureResponderEvent['nativeEvent'], - responderRegion: $ReadOnly<{ + responderRegion: Readonly<{ bottom: number, left: number, right: number, diff --git a/packages/react-native/Libraries/Pressability/PressabilityDebug.js b/packages/react-native/Libraries/Pressability/PressabilityDebug.js index 87bf772d64186d..90b83e49e51c9d 100644 --- a/packages/react-native/Libraries/Pressability/PressabilityDebug.js +++ b/packages/react-native/Libraries/Pressability/PressabilityDebug.js @@ -15,7 +15,7 @@ import normalizeColor from '../StyleSheet/normalizeColor'; import {type RectOrSize, normalizeRect} from '../StyleSheet/Rect'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ color: ColorValue, hitSlop: ?RectOrSize, }>; diff --git a/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js b/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js index 9270b01c53e4f3..1d9070e9968185 100644 --- a/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +++ b/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js @@ -10,7 +10,7 @@ import {type PressabilityTouchSignal as TouchSignal} from './PressabilityTypes.js'; -export type PressabilityPerformanceEvent = $ReadOnly<{ +export type PressabilityPerformanceEvent = Readonly<{ signal: TouchSignal, nativeTimestamp: number, }>; diff --git a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js index be84bbdac94728..431429183d7779 100644 --- a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js +++ b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js @@ -170,7 +170,7 @@ const createMockMouseEvent = (registrationName: string) => { const createMockPressEvent = ( nameOrOverrides: | string - | $ReadOnly<{ + | Readonly<{ registrationName: string, pageX: number, pageY: number, diff --git a/packages/react-native/Libraries/ReactNative/AppContainer.js b/packages/react-native/Libraries/ReactNative/AppContainer.js index 697be80873ff56..58bc7319e44c4f 100644 --- a/packages/react-native/Libraries/ReactNative/AppContainer.js +++ b/packages/react-native/Libraries/ReactNative/AppContainer.js @@ -13,7 +13,7 @@ import type {RootTag} from './RootTag'; import * as React from 'react'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ children?: React.Node, fabric?: boolean, rootTag: number | RootTag, diff --git a/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js b/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js index 419424df2cdd57..a2db296f50bb75 100644 --- a/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js +++ b/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js @@ -29,7 +29,7 @@ export type AppConfig = { ... }; export type AppParameters = { - initialProps: $ReadOnly<{[string]: unknown, ...}>, + initialProps: Readonly<{[string]: unknown, ...}>, rootTag: RootTag, fabric?: boolean, }; diff --git a/packages/react-native/Libraries/StyleSheet/PointPropType.js b/packages/react-native/Libraries/StyleSheet/PointPropType.js index 2dd4a7158a5891..1baba417fd5e00 100644 --- a/packages/react-native/Libraries/StyleSheet/PointPropType.js +++ b/packages/react-native/Libraries/StyleSheet/PointPropType.js @@ -10,7 +10,7 @@ 'use strict'; -export type PointProp = $ReadOnly<{ +export type PointProp = Readonly<{ x: number, y: number, ... diff --git a/packages/react-native/Libraries/StyleSheet/Rect.js b/packages/react-native/Libraries/StyleSheet/Rect.js index 6345337bd383c9..343a39e2938d7a 100644 --- a/packages/react-native/Libraries/StyleSheet/Rect.js +++ b/packages/react-native/Libraries/StyleSheet/Rect.js @@ -8,7 +8,7 @@ * @format */ -export type Rect = $ReadOnly<{ +export type Rect = Readonly<{ bottom?: ?number, left?: ?number, right?: ?number, diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js index a2df7a02b6736e..89942fe1227626 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js @@ -188,7 +188,7 @@ export default { * An identity function for creating style sheets. */ // $FlowFixMe[unsupported-variance-annotation] - create<+S: ____Styles_Internal>(obj: S): $ReadOnly { + create<+S: ____Styles_Internal>(obj: S): Readonly { // TODO: This should return S as the return type. But first, // we need to codemod all the callsites that are typing this // return value as a number (even though it was opaque). diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow index 031ca32d823d86..79bc7e261f5044 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow @@ -13,7 +13,7 @@ import type {____Styles_Internal} from './StyleSheetTypes'; import composeStyles from '../../src/private/styles/composeStyles'; import flattenStyle from './flattenStyle'; -type AbsoluteFillStyle = $ReadOnly<{ +type AbsoluteFillStyle = Readonly<{ position: 'absolute', left: 0, right: 0, @@ -102,4 +102,4 @@ declare export const setStyleAttributePreprocessor: ( // $FlowFixMe[unsupported-variance-annotation] declare export const create: <+S: ____Styles_Internal>( obj: S & ____Styles_Internal, -) => $ReadOnly; +) => Readonly; diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index 0ba483758fb303..6757e059f1eaa7 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -55,7 +55,7 @@ export type CursorValue = 'auto' | 'pointer'; * These properties are a subset of our styles that are consumed by the layout * algorithm and affect the positioning and sizing of views. */ -type ____LayoutStyle_Internal = $ReadOnly<{ +type ____LayoutStyle_Internal = Readonly<{ /** `display` sets the display type of this component. * * It works similarly to `display` in CSS, but only support 'flex' and 'none'. @@ -675,7 +675,7 @@ type ____LayoutStyle_Internal = $ReadOnly<{ * To add a drop shadow to a view use the [`elevation` property](docs/viewstyleproptypes.html#elevation) (Android 5.0+). * To customize the color use the [`shadowColor` property](docs/shadow-props.html#shadowColor) (Android 9.0+). */ -export type ____ShadowStyle_InternalCore = $ReadOnly<{ +export type ____ShadowStyle_InternalCore = Readonly<{ /** * Sets the drop shadow color * @platform ios @@ -685,7 +685,7 @@ export type ____ShadowStyle_InternalCore = $ReadOnly<{ * Sets the drop shadow offset * @platform ios */ - shadowOffset?: $ReadOnly<{ + shadowOffset?: Readonly<{ width?: number, height?: number, }>, @@ -701,7 +701,7 @@ export type ____ShadowStyle_InternalCore = $ReadOnly<{ shadowRadius?: number, }>; -export type ____ShadowStyle_Internal = $ReadOnly<{ +export type ____ShadowStyle_Internal = Readonly<{ ...____ShadowStyle_InternalCore, ...____ShadowStyle_InternalOverrides, }>; @@ -843,7 +843,7 @@ type ____BlendMode_Internal = | 'color' | 'luminosity'; -export type ____ViewStyle_InternalBase = $ReadOnly<{ +export type ____ViewStyle_InternalBase = Readonly<{ backfaceVisibility?: 'visible' | 'hidden', backgroundColor?: ____ColorValue_Internal, borderColor?: ____ColorValue_Internal, @@ -900,14 +900,14 @@ export type ____ViewStyle_InternalBase = $ReadOnly<{ isolation?: 'auto' | 'isolate', }>; -export type ____ViewStyle_InternalCore = $ReadOnly<{ +export type ____ViewStyle_InternalCore = Readonly<{ ...$Exact<____LayoutStyle_Internal>, ...$Exact<____ShadowStyle_Internal>, ...$Exact<____TransformStyle_Internal>, ...____ViewStyle_InternalBase, }>; -export type ____ViewStyle_Internal = $ReadOnly<{ +export type ____ViewStyle_Internal = Readonly<{ ...____ViewStyle_InternalCore, ...____ViewStyle_InternalOverrides, }>; @@ -999,14 +999,14 @@ export type ____FontVariant_Internal = export type ____FontVariantArray_Internal = $ReadOnlyArray<____FontVariant_Internal>; -type ____TextStyle_InternalBase = $ReadOnly<{ +type ____TextStyle_InternalBase = Readonly<{ color?: ____ColorValue_Internal, fontFamily?: string, fontSize?: number, fontStyle?: 'normal' | 'italic', fontWeight?: ____FontWeight_Internal, fontVariant?: ____FontVariantArray_Internal | string, - textShadowOffset?: $ReadOnly<{ + textShadowOffset?: Readonly<{ width: number, height: number, }>, @@ -1030,17 +1030,17 @@ type ____TextStyle_InternalBase = $ReadOnly<{ writingDirection?: 'auto' | 'ltr' | 'rtl', }>; -export type ____TextStyle_InternalCore = $ReadOnly<{ +export type ____TextStyle_InternalCore = Readonly<{ ...$Exact<____ViewStyle_Internal>, ...____TextStyle_InternalBase, }>; -export type ____TextStyle_Internal = $ReadOnly<{ +export type ____TextStyle_Internal = Readonly<{ ...____TextStyle_InternalCore, ...____TextStyle_InternalOverrides, }>; -export type ____ImageStyle_InternalCore = $ReadOnly<{ +export type ____ImageStyle_InternalCore = Readonly<{ ...$Exact<____ViewStyle_Internal>, resizeMode?: ImageResizeMode, objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none', @@ -1049,12 +1049,12 @@ export type ____ImageStyle_InternalCore = $ReadOnly<{ overflow?: 'visible' | 'hidden', }>; -export type ____ImageStyle_Internal = $ReadOnly<{ +export type ____ImageStyle_Internal = Readonly<{ ...____ImageStyle_InternalCore, ...____ImageStyle_InternalOverrides, }>; -export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{ +export type ____DangerouslyImpreciseStyle_InternalCore = Readonly<{ ...$Exact<____TextStyle_Internal>, resizeMode?: ImageResizeMode, objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none', @@ -1062,7 +1062,7 @@ export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{ overlayColor?: ColorValue, }>; -export type ____DangerouslyImpreciseStyle_Internal = $ReadOnly<{ +export type ____DangerouslyImpreciseStyle_Internal = Readonly<{ ...____DangerouslyImpreciseStyle_InternalCore, ...____DangerouslyImpreciseStyle_InternalOverrides, ... @@ -1084,13 +1084,13 @@ export type ____DangerouslyImpreciseAnimatedStyleProp_Internal = WithAnimatedValue>>; export type ____ViewStyleProp_Internal = StyleProp< - $ReadOnly>, + Readonly>, >; export type ____TextStyleProp_Internal = StyleProp< - $ReadOnly>, + Readonly>, >; export type ____ImageStyleProp_Internal = StyleProp< - $ReadOnly>, + Readonly>, >; export type ____Styles_Internal = { diff --git a/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js b/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js index a5aab95e4322b9..aa863ade48c81c 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +++ b/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js @@ -8,8 +8,8 @@ * @format */ -export type ____DangerouslyImpreciseStyle_InternalOverrides = $ReadOnly<{}>; -export type ____ImageStyle_InternalOverrides = $ReadOnly<{}>; -export type ____ShadowStyle_InternalOverrides = $ReadOnly<{}>; -export type ____TextStyle_InternalOverrides = $ReadOnly<{}>; -export type ____ViewStyle_InternalOverrides = $ReadOnly<{}>; +export type ____DangerouslyImpreciseStyle_InternalOverrides = Readonly<{}>; +export type ____ImageStyle_InternalOverrides = Readonly<{}>; +export type ____ShadowStyle_InternalOverrides = Readonly<{}>; +export type ____TextStyle_InternalOverrides = Readonly<{}>; +export type ____ViewStyle_InternalOverrides = Readonly<{}>; diff --git a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js index ab847c68f6fa02..0152590ada7ff5 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js +++ b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js @@ -29,7 +29,7 @@ type MaximumOneOf = $Values<{ }>, }>; -export type ____TransformStyle_Internal = $ReadOnly<{ +export type ____TransformStyle_Internal = Readonly<{ /** * `transform` accepts an array of transformation objects. Each object specifies * the property that will be transformed as the key, and the value to use in the @@ -48,7 +48,7 @@ export type ____TransformStyle_Internal = $ReadOnly<{ */ transform?: | $ReadOnlyArray< - $ReadOnly< + Readonly< MaximumOneOf< MergeUnion< | {+perspective: number | AnimatedNode} diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index a9e4036b2e34b8..df51994f2418cc 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -667,7 +667,7 @@ const TextImpl: component( TextImpl.displayName = 'Text'; -type TextPressabilityProps = $ReadOnly<{ +type TextPressabilityProps = Readonly<{ onLongPress?: ?(event: GestureResponderEvent) => unknown, onPress?: ?(event: GestureResponderEvent) => unknown, onPressIn?: ?(event: GestureResponderEvent) => unknown, @@ -801,7 +801,7 @@ function useTextPressability({ ); } -type NativePressableTextProps = $ReadOnly<{ +type NativePressableTextProps = Readonly<{ textProps: NativeTextProps, textPressabilityProps: TextPressabilityProps, }>; diff --git a/packages/react-native/Libraries/Text/TextNativeComponent.js b/packages/react-native/Libraries/Text/TextNativeComponent.js index 5e0fc03c4cbd3f..020d5ceea8b6b3 100644 --- a/packages/react-native/Libraries/Text/TextNativeComponent.js +++ b/packages/react-native/Libraries/Text/TextNativeComponent.js @@ -17,7 +17,7 @@ import {createViewConfig} from '../NativeComponent/ViewConfig'; import UIManager from '../ReactNative/UIManager'; import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass'; -export type NativeTextProps = $ReadOnly<{ +export type NativeTextProps = Readonly<{ ...TextProps, isHighlighted?: ?boolean, selectionColor?: ?ProcessedColorValue, diff --git a/packages/react-native/Libraries/Text/TextProps.js b/packages/react-native/Libraries/Text/TextProps.js index 4ca3c34e718e5e..adbcb59d8ab5f1 100644 --- a/packages/react-native/Libraries/Text/TextProps.js +++ b/packages/react-native/Libraries/Text/TextProps.js @@ -25,14 +25,14 @@ import type { import * as React from 'react'; -export type PressRetentionOffset = $ReadOnly<{ +export type PressRetentionOffset = Readonly<{ top: number, left: number, bottom: number, right: number, }>; -type TextPointerEventProps = $ReadOnly<{ +type TextPointerEventProps = Readonly<{ onPointerEnter?: (event: PointerEvent) => void, onPointerLeave?: (event: PointerEvent) => void, onPointerMove?: (event: PointerEvent) => void, @@ -121,7 +121,7 @@ export type TextPropsAndroid = { minimumFontScale?: ?number, }; -type TextBaseProps = $ReadOnly<{ +type TextBaseProps = Readonly<{ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown, /** @@ -268,7 +268,7 @@ type TextBaseProps = $ReadOnly<{ /** * @see https://reactnative.dev/docs/text#reference */ -export type TextProps = $ReadOnly<{ +export type TextProps = Readonly<{ ...TextPointerEventProps, ...TextPropsIOS, ...TextPropsAndroid, diff --git a/packages/react-native/Libraries/Types/CoreEventTypes.js b/packages/react-native/Libraries/Types/CoreEventTypes.js index 886d404494b01e..eb822951d45a21 100644 --- a/packages/react-native/Libraries/Types/CoreEventTypes.js +++ b/packages/react-native/Libraries/Types/CoreEventTypes.js @@ -10,12 +10,12 @@ import type {HostInstance} from '../../src/private/types/HostInstance'; -export type NativeSyntheticEvent<+T> = $ReadOnly<{ +export type NativeSyntheticEvent<+T> = Readonly<{ bubbles: ?boolean, cancelable: ?boolean, currentTarget: number | HostInstance, defaultPrevented: ?boolean, - dispatchConfig: $ReadOnly<{ + dispatchConfig: Readonly<{ registrationName: string, }>, eventPhase: ?number, @@ -31,14 +31,14 @@ export type NativeSyntheticEvent<+T> = $ReadOnly<{ type: ?string, }>; -export type ResponderSyntheticEvent = $ReadOnly<{ +export type ResponderSyntheticEvent = Readonly<{ ...NativeSyntheticEvent, - touchHistory: $ReadOnly<{ + touchHistory: Readonly<{ indexOfSingleActiveTouch: number, mostRecentTimeStamp: number, numberActiveTouches: number, touchBank: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ touchActive: boolean, startPageX: number, startPageY: number, @@ -54,14 +54,14 @@ export type ResponderSyntheticEvent = $ReadOnly<{ }>, }>; -export type LayoutRectangle = $ReadOnly<{ +export type LayoutRectangle = Readonly<{ x: number, y: number, width: number, height: number, }>; -export type TextLayoutLine = $ReadOnly<{ +export type TextLayoutLine = Readonly<{ ...LayoutRectangle, ascender: number, capHeight: number, @@ -71,12 +71,12 @@ export type TextLayoutLine = $ReadOnly<{ }>; export type LayoutChangeEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ layout: LayoutRectangle, }>, >; -type TextLayoutEventData = $ReadOnly<{ +type TextLayoutEventData = Readonly<{ lines: Array, }>; @@ -220,7 +220,7 @@ export interface NativePointerEvent extends NativeMouseEvent { export type PointerEvent = NativeSyntheticEvent; -export type NativeTouchEvent = $ReadOnly<{ +export type NativeTouchEvent = Readonly<{ /** * Array of all touch events that have changed since the last event */ @@ -266,29 +266,29 @@ export type NativeTouchEvent = $ReadOnly<{ export type GestureResponderEvent = ResponderSyntheticEvent; -export type NativeScrollRectangle = $ReadOnly<{ +export type NativeScrollRectangle = Readonly<{ bottom: number, left: number, right: number, top: number, }>; -export type NativeScrollPoint = $ReadOnly<{ +export type NativeScrollPoint = Readonly<{ y: number, x: number, }>; -export type NativeScrollVelocity = $ReadOnly<{ +export type NativeScrollVelocity = Readonly<{ y: number, x: number, }>; -export type NativeScrollSize = $ReadOnly<{ +export type NativeScrollSize = Readonly<{ height: number, width: number, }>; -export type NativeScrollEvent = $ReadOnly<{ +export type NativeScrollEvent = Readonly<{ contentInset: NativeScrollRectangle, contentOffset: NativeScrollPoint, contentSize: NativeScrollSize, @@ -304,7 +304,7 @@ export type NativeScrollEvent = $ReadOnly<{ export type ScrollEvent = NativeSyntheticEvent; -export type TargetedEvent = $ReadOnly<{ +export type TargetedEvent = Readonly<{ target: number, ... }>; @@ -314,7 +314,7 @@ export type BlurEvent = NativeSyntheticEvent; export type FocusEvent = NativeSyntheticEvent; export type MouseEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ clientX: number, clientY: number, pageX: number, @@ -323,7 +323,7 @@ export type MouseEvent = NativeSyntheticEvent< }>, >; -export type KeyEvent = $ReadOnly<{ +export type KeyEvent = Readonly<{ /** * The actual key that was pressed. For example, F would be "f" or "F" depending on the shift key. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key diff --git a/packages/react-native/Libraries/Utilities/Dimensions.js b/packages/react-native/Libraries/Utilities/Dimensions.js index 8ae066c54b5656..d8d4b7d3391211 100644 --- a/packages/react-native/Libraries/Utilities/Dimensions.js +++ b/packages/react-native/Libraries/Utilities/Dimensions.js @@ -60,7 +60,7 @@ class Dimensions { * * @param {DimensionsPayload} dims Simple string-keyed object of dimensions to set */ - static set(dims: $ReadOnly): void { + static set(dims: Readonly): void { // We calculate the window dimensions in JS so that we don't encounter loss of // precision in transferring the dimensions (which could be non-integers) over // the bridge. diff --git a/packages/react-native/Libraries/Utilities/IPerformanceLogger.js b/packages/react-native/Libraries/Utilities/IPerformanceLogger.js index 617e7138bec84a..19dac2ef7026ba 100644 --- a/packages/react-native/Libraries/Utilities/IPerformanceLogger.js +++ b/packages/react-native/Libraries/Utilities/IPerformanceLogger.js @@ -34,10 +34,10 @@ export interface IPerformanceLogger { clearCompleted(): void; close(): void; currentTimestamp(): number; - getExtras(): $ReadOnly<{[key: string]: ?ExtraValue, ...}>; - getPoints(): $ReadOnly<{[key: string]: ?number, ...}>; - getPointExtras(): $ReadOnly<{[key: string]: ?Extras, ...}>; - getTimespans(): $ReadOnly<{[key: string]: ?Timespan, ...}>; + getExtras(): Readonly<{[key: string]: ?ExtraValue, ...}>; + getPoints(): Readonly<{[key: string]: ?number, ...}>; + getPointExtras(): Readonly<{[key: string]: ?Extras, ...}>; + getTimespans(): Readonly<{[key: string]: ?Timespan, ...}>; hasTimespan(key: string): boolean; isClosed(): boolean; logEverything(): void; diff --git a/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js b/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js index 3957027dff231e..57d5ef05d85a15 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js @@ -37,7 +37,7 @@ class Screen { } function TestComponent( - props: $ReadOnly<{children: () => React.MixedElement}>, + props: Readonly<{children: () => React.MixedElement}>, ): React.Node { return props.children(); } diff --git a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js index 67ae5f865429b0..17c271f1191e02 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js @@ -10,7 +10,7 @@ const {dispatchCommand} = require('../ReactNative/RendererProxy'); -type NativeCommandsOptions = $ReadOnly<{ +type NativeCommandsOptions = Readonly<{ supportedCommands: $ReadOnlyArray, }>; diff --git a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js index 9cd3d2d2eda41a..3b6510a84c4d13 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js @@ -16,7 +16,7 @@ import requireNativeComponent from '../../Libraries/ReactNative/requireNativeCom import UIManager from '../ReactNative/UIManager'; // TODO: import from CodegenSchema once workspaces are enabled -type NativeComponentOptions = $ReadOnly<{ +type NativeComponentOptions = Readonly<{ interfaceOnly?: boolean, paperComponentName?: string, paperComponentNameDeprecated?: string, diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 97f1713ca17d08..2ccfeb47b40f0f 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>, }; @@ -67,9 +67,9 @@ type Registry< * */ export default class EventEmitter< - TEventToArgsMap: $ReadOnly< + TEventToArgsMap: Readonly< Record>, - > = $ReadOnly>>, + > = 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 ab3b11b9bd207e..1c4d3c8b0ee61a 100644 --- a/packages/react-native/flow/bom.js.flow +++ b/packages/react-native/flow/bom.js.flow @@ -47,8 +47,8 @@ declare var console: { // Printing table( tabularData: - | $ReadOnly<{[key: string]: unknown, ...}> - | $ReadOnlyArray<$ReadOnly<{[key: string]: unknown, ...}>> + | Readonly<{[key: string]: unknown, ...}> + | $ReadOnlyArray> | $ReadOnlyArray<$ReadOnlyArray>, ): void, dir(...data: $ReadOnlyArray): void, diff --git a/packages/react-native/jest/mockComponent.js b/packages/react-native/jest/mockComponent.js index 30045abe8994fa..856350d3dd7281 100644 --- a/packages/react-native/jest/mockComponent.js +++ b/packages/react-native/jest/mockComponent.js @@ -11,7 +11,7 @@ import * as React from 'react'; import {createElement} from 'react'; -type Modulish = T | $ReadOnly<{default: T}>; +type Modulish = T | Readonly<{default: T}>; type ModuleDefault = T['default']; type TComponentType = React.ComponentType<{...}>; @@ -27,9 +27,8 @@ export default function mockComponent< moduleName: string, instanceMethods: ?interface {}, isESModule: TIsESModule, -): TIsESModule extends true - ? // $FlowFixMe[incompatible-use] - ModuleDefault +): TIsESModule extends true // $FlowFixMe[incompatible-use] + ? ModuleDefault : TComponentModule & typeof instanceMethods { const RealComponent: TComponentType = isESModule ? // $FlowFixMe[prop-missing] diff --git a/packages/react-native/scripts/featureflags/print.js b/packages/react-native/scripts/featureflags/print.js index e5b62459d4b0d9..ff6cc5dd7adcec 100644 --- a/packages/react-native/scripts/featureflags/print.js +++ b/packages/react-native/scripts/featureflags/print.js @@ -37,8 +37,8 @@ function getPurposeString(purpose: string): string { } function compareFeatureFlags( - [keyA, valueA]: $ReadOnly<[string, $ReadOnly<{Purpose: string, ...}>]>, - [keyB, valueB]: $ReadOnly<[string, $ReadOnly<{Purpose: string, ...}>]>, + [keyA, valueA]: Readonly<[string, Readonly<{Purpose: string, ...}>]>, + [keyB, valueB]: Readonly<[string, Readonly<{Purpose: string, ...}>]>, ): number { const purposeA = PURPOSE_ORDER.indexOf(valueA.Purpose); const purposeB = PURPOSE_ORDER.indexOf(valueB.Purpose); diff --git a/packages/react-native/scripts/featureflags/types.js b/packages/react-native/scripts/featureflags/types.js index 17370773b3e127..54ce4fbb9dd57e 100644 --- a/packages/react-native/scripts/featureflags/types.js +++ b/packages/react-native/scripts/featureflags/types.js @@ -10,7 +10,7 @@ export type FeatureFlagValue = boolean | number | string; -export type FeatureFlagDefinitions = $ReadOnly<{ +export type FeatureFlagDefinitions = Readonly<{ common: CommonFeatureFlagList, jsOnly: JsOnlyFeatureFlagList, }>; @@ -30,7 +30,7 @@ export type OSSReleaseStageValue = export type CommonFeatureFlagConfig< TValue: FeatureFlagValue = FeatureFlagValue, -> = $ReadOnly<{ +> = Readonly<{ defaultValue: TValue, metadata: FeatureFlagMetadata, ossReleaseStage: OSSReleaseStageValue, @@ -39,24 +39,24 @@ export type CommonFeatureFlagConfig< skipNativeAPI?: true, }>; -export type CommonFeatureFlagList = $ReadOnly<{ +export type CommonFeatureFlagList = Readonly<{ [flagName: string]: CommonFeatureFlagConfig<>, }>; export type JsOnlyFeatureFlagConfig< TValue: FeatureFlagValue = FeatureFlagValue, -> = $ReadOnly<{ +> = Readonly<{ defaultValue: TValue, metadata: FeatureFlagMetadata, ossReleaseStage: OSSReleaseStageValue, }>; -export type JsOnlyFeatureFlagList = $ReadOnly<{ +export type JsOnlyFeatureFlagList = Readonly<{ [flagName: string]: JsOnlyFeatureFlagConfig<>, }>; export type FeatureFlagMetadata = - | $ReadOnly<{ + | Readonly<{ purpose: 'experimentation', /** * Approximate date when the flag was added. @@ -66,13 +66,13 @@ export type FeatureFlagMetadata = description: string, expectedReleaseValue: TValue, }> - | $ReadOnly<{ + | Readonly<{ purpose: 'operational' | 'release', description: string, expectedReleaseValue: TValue, }>; -export type GeneratorConfig = $ReadOnly<{ +export type GeneratorConfig = Readonly<{ featureFlagDefinitions: FeatureFlagDefinitions, jsPath: string, commonCxxPath: string, @@ -81,10 +81,10 @@ export type GeneratorConfig = $ReadOnly<{ androidJniPath: string, }>; -export type GeneratorOptions = $ReadOnly<{ +export type GeneratorOptions = Readonly<{ verifyUnchanged: boolean, }>; -export type GeneratorResult = $ReadOnly<{ +export type GeneratorResult = Readonly<{ [path: string]: string /* content */, }>; diff --git a/packages/react-native/src/private/animated/NativeAnimatedHelper.js b/packages/react-native/src/private/animated/NativeAnimatedHelper.js index a115addaa2f6e8..071af9a83c63d1 100644 --- a/packages/react-native/src/private/animated/NativeAnimatedHelper.js +++ b/packages/react-native/src/private/animated/NativeAnimatedHelper.js @@ -406,7 +406,7 @@ function assertNativeAnimatedModule(): void { let _warnedMissingNativeAnimated = false; function shouldUseNativeDriver( - config: $ReadOnly<{...AnimationConfig, ...}> | EventConfig, + config: Readonly<{...AnimationConfig, ...}> | EventConfig, ): boolean { if (config.useNativeDriver == null) { console.warn( diff --git a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js index 21062f744e8d80..504a78796cf19f 100644 --- a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js +++ b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js @@ -25,31 +25,31 @@ type CompositeKey = { | CompositeKeyComponent | AnimatedEvent | $ReadOnlyArray - | $ReadOnly<{[string]: unknown}>, + | Readonly<{[string]: unknown}>, }; type CompositeKeyComponent = | AnimatedNode | $ReadOnlyArray - | $ReadOnly<{[string]: CompositeKeyComponent}>; + | Readonly<{[string]: CompositeKeyComponent}>; -type $ReadOnlyCompositeKey = $ReadOnly<{ - style?: $ReadOnly<{[string]: CompositeKeyComponent}>, +type $ReadOnlyCompositeKey = Readonly<{ + style?: Readonly<{[string]: CompositeKeyComponent}>, [string]: | $ReadOnlyCompositeKeyComponent | AnimatedEvent | $ReadOnlyArray - | $ReadOnly<{[string]: unknown}>, + | Readonly<{[string]: unknown}>, }>; type $ReadOnlyCompositeKeyComponent = | AnimatedNode | $ReadOnlyArray<$ReadOnlyCompositeKeyComponent | null> - | $ReadOnly<{[string]: $ReadOnlyCompositeKeyComponent}>; + | Readonly<{[string]: $ReadOnlyCompositeKeyComponent}>; type AnimatedPropsMemoHook = ( () => AnimatedProps, - props: $ReadOnly<{[string]: unknown}>, + props: Readonly<{[string]: unknown}>, ) => AnimatedProps; /** @@ -62,14 +62,14 @@ export function createAnimatedPropsMemoHook( ): AnimatedPropsMemoHook { return function useAnimatedPropsMemo( create: () => AnimatedProps, - props: $ReadOnly<{[string]: unknown}>, + props: Readonly<{[string]: unknown}>, ): AnimatedProps { const compositeKey = useMemo( () => createCompositeKeyForProps(props, allowlist), [props], ); - const prevRef = useRef>(); @@ -107,7 +107,7 @@ export function createAnimatedPropsMemoHook( * returns null. */ export function createCompositeKeyForProps( - props: $ReadOnly<{[string]: unknown}>, + props: Readonly<{[string]: unknown}>, allowlist: ?AnimatedPropsAllowlist, ): $ReadOnlyCompositeKey | null { let compositeKey: CompositeKey | null = null; @@ -200,9 +200,9 @@ function createCompositeKeyForArray( * If `object` contains no `AnimatedNode` instances, this returns null. */ function createCompositeKeyForObject( - object: $ReadOnly<{[string]: unknown}>, + object: Readonly<{[string]: unknown}>, allowlist?: ?AnimatedStyleAllowlist, -): $ReadOnly<{[string]: $ReadOnlyCompositeKeyComponent}> | null { +): Readonly<{[string]: $ReadOnlyCompositeKeyComponent}> | null { let compositeKey: {[string]: $ReadOnlyCompositeKeyComponent} | null = null; const keys = Object.keys(object); @@ -355,6 +355,6 @@ function areCompositeKeyComponentsEqual( // this shim when they do. // $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; -const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean = +const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = // $FlowFixMe[method-unbinding] Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/src/private/components/virtualview/VirtualView.js b/packages/react-native/src/private/components/virtualview/VirtualView.js index c57c9cdfc2b82f..245d2510a6f42d 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualView.js +++ b/packages/react-native/src/private/components/virtualview/VirtualView.js @@ -37,14 +37,14 @@ export enum VirtualViewRenderState { None = 2, } -export type Rect = $ReadOnly<{ +export type Rect = Readonly<{ x: number, y: number, width: number, height: number, }>; -export type ModeChangeEvent = $ReadOnly<{ +export type ModeChangeEvent = Readonly<{ ...Omit, renderState: VirtualViewRenderState, mode: VirtualViewMode, diff --git a/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js b/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js index 81d54ad8d743fb..eaa20fd80c3022 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +++ b/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js @@ -18,7 +18,7 @@ import type {HostComponent} from '../../types/HostComponent'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -export type NativeModeChangeEvent = $ReadOnly<{ +export type NativeModeChangeEvent = Readonly<{ /** * Virtualization mode of the target view. * @@ -34,7 +34,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ /** * Rect of the target view, relative to the nearest ancestor scroll container. */ - targetRect: $ReadOnly<{ + targetRect: Readonly<{ x: Double, y: Double, width: Double, @@ -51,7 +51,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ * * This can be used to determine whether and how much new content to render. */ - thresholdRect: $ReadOnly<{ + thresholdRect: Readonly<{ x: Double, y: Double, width: Double, @@ -59,7 +59,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ }>, }>; -type VirtualViewExperimentalNativeProps = $ReadOnly<{ +type VirtualViewExperimentalNativeProps = Readonly<{ ...ViewProps, /** diff --git a/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js b/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js index 951a000e51b47f..4ba5b68398edc8 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js +++ b/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js @@ -18,7 +18,7 @@ import type {HostComponent} from '../../types/HostComponent'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -export type NativeModeChangeEvent = $ReadOnly<{ +export type NativeModeChangeEvent = Readonly<{ /** * Virtualization mode of the target view. * @@ -34,7 +34,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ /** * Rect of the target view, relative to the nearest ancestor scroll container. */ - targetRect: $ReadOnly<{ + targetRect: Readonly<{ x: Double, y: Double, width: Double, @@ -51,7 +51,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ * * This can be used to determine whether and how much new content to render. */ - thresholdRect: $ReadOnly<{ + thresholdRect: Readonly<{ x: Double, y: Double, width: Double, @@ -59,7 +59,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ }>, }>; -type VirtualViewNativeProps = $ReadOnly<{ +type VirtualViewNativeProps = Readonly<{ ...ViewProps, /** 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 93792282b67ebc..7871887d7c02d0 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 @@ -355,7 +355,7 @@ export function dispatchModeChangeEvent( /** * Helper to create a callback ref that records instances using WeakRefs. */ -function createWeakRefCallback(): $ReadOnly<{ +function createWeakRefCallback(): Readonly<{ weakRefs: $ReadOnlyArray>, callbackRef: React.RefSetter, }> { diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js index 22d3f7fc3d9112..af12cdb9742cd0 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js @@ -16,9 +16,9 @@ import * as React from 'react'; const View = require('../../../../../Libraries/Components/View/View').default; -type Props = $ReadOnly<{ +type Props = Readonly<{ children: React.Node, - box?: ?$ReadOnly<{ + box?: ?Readonly<{ top: number, right: number, bottom: number, diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js index 1b76fb8824592e..59aa4c801a4068 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js @@ -31,7 +31,7 @@ const blank = { bottom: 0, }; -type BoxInspectorProps = $ReadOnly<{ +type BoxInspectorProps = Readonly<{ style: ViewStyleProp, frame: ?InspectedElementFrame, }>; @@ -57,10 +57,10 @@ function BoxInspector({style, frame}: BoxInspectorProps): React.Node { ); } -type BoxContainerProps = $ReadOnly<{ +type BoxContainerProps = Readonly<{ title: string, titleStyle?: TextStyleProp, - box: $ReadOnly<{ + box: Readonly<{ top: number, left: number, right: number, diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js index 5f022484c2ab35..08b4e9704ca06f 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js @@ -25,15 +25,15 @@ const Dimensions = const BorderBox = require('./BorderBox').default; const resolveBoxStyle = require('./resolveBoxStyle').default; -type Props = $ReadOnly<{ +type Props = Readonly<{ frame: InspectedElementFrame, style?: ?ViewStyleProp, }>; function ElementBox({frame, style}: Props): React.Node { const flattenedStyle = flattenStyle(style) || {}; - let margin: ?$ReadOnly