Transform $ReadOnly to Readonly 37/n (#55066)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55066

We are transforming the following utility types to be more consistent with typescript and better AI integration:

* `$NonMaybeType` -> `NonNullable`
* `$ReadOnly` -> `Readonly`
* `$ReadOnlyArray` -> `ReadonlyArray`
* `$ReadOnlyMap` -> `ReadonlyMap`
* `$ReadOnlySet` -> `ReadonlySet`
* `$Keys` -> `keyof`
* `$Values` -> `Values`
* `mixed` -> `unknown`

See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/.

drop-conflicts

Command:

`js1 flow-runner codemod flow/transformUtilityType --legacy-type='$ReadOnly'`

Changelog:[internal]

Differential Revision: D90146145

fbshipit-source-id: 4b71784a36f8286f3be620969ea408cf8a0aac80
This commit is contained in:
Marco Wang authored and meta-codesync[bot] committed 2026-01-06 18:57:56 -08:00
1 parent 58bc6c3e38
commit 1cc30dc1ad
175 files changed
+512 -519

No files matched your search

@@ -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,
}>,
>();
@@ -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,
}>;
@@ -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'