Skip to content

Commit 623ba91

Browse files
rubennortemeta-codesync[bot]
authored andcommitted
Revert recent Flow syntax codemods in react-native-github (facebook#56998)
Summary: Pull Request resolved: facebook#56998 Reverts the recent Flow syntax codemods applied across `packages/`, `private/`, and `scripts/` in react-native-github. Specifically restores the previous form for: - `+T` / `+Instance` style variance annotations on generic type parameters that had been converted to the newer `out T` / `in T` keyword form. - `+field:` covariant object/interface properties that had been converted to the `readonly field:` modifier form. - `+[K in keyof T]:` mapped-type covariance that had been converted to `readonly [K in keyof T]:`. These are purely Flow type-annotation changes with no runtime behavior impact, restoring the form that the rest of the toolchain (in particular Fantom) already supports. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D106813102
1 parent 6720760 commit 623ba91

232 files changed

Lines changed: 1507 additions & 1688 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/assets-registry/registry.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
export type AssetDestPathResolver = 'android' | 'generic';
1515
1616
export type PackagerAsset = {
17-
readonly __packager_asset: boolean,
18-
readonly fileSystemLocation: string,
19-
readonly httpServerLocation: string,
20-
readonly width: ?number,
21-
readonly height: ?number,
22-
readonly scales: Array<number>,
23-
readonly hash: string,
24-
readonly name: string,
25-
readonly type: string,
26-
readonly resolver?: AssetDestPathResolver,
17+
+__packager_asset: boolean,
18+
+fileSystemLocation: string,
19+
+httpServerLocation: string,
20+
+width: ?number,
21+
+height: ?number,
22+
+scales: Array<number>,
23+
+hash: string,
24+
+name: string,
25+
+type: string,
26+
+resolver?: AssetDestPathResolver,
2727
...
2828
};
2929
*/

packages/dev-middleware/src/__tests__/InspectorDebuggerUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class DebuggerAgent {
8484

8585
export class DebuggerMock extends DebuggerAgent {
8686
// Empty handlers
87-
readonly handle: JestMockFn<[message: JSONSerializable], void> = jest.fn();
87+
+handle: JestMockFn<[message: JSONSerializable], void> = jest.fn();
8888

8989
__handle(message: JSONSerializable): void {
9090
this.handle(message);

packages/dev-middleware/src/__tests__/InspectorDeviceUtils.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,16 @@ export class DeviceAgent {
9898

9999
export class DeviceMock extends DeviceAgent {
100100
// Empty handlers
101-
readonly connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
102-
readonly disconnect: JestMockFn<[message: DisconnectRequest], void> =
103-
jest.fn();
104-
readonly getPages: JestMockFn<
101+
+connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
102+
+disconnect: JestMockFn<[message: DisconnectRequest], void> = jest.fn();
103+
+getPages: JestMockFn<
105104
[message: GetPagesRequest],
106105
| GetPagesResponse['payload']
107106
| Promise<GetPagesResponse['payload'] | void>
108107
| void,
109108
> = jest.fn();
110-
readonly wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> =
111-
jest.fn();
112-
readonly wrappedEventParsed: JestMockFn<
109+
+wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> = jest.fn();
110+
+wrappedEventParsed: JestMockFn<
113111
[
114112
payload: {
115113
...WrappedEventToDevice['payload'],

packages/dev-middleware/src/__tests__/StandaloneFuseboxShell-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const PAGES_POLLING_DELAY = 2100;
2525
jest.useFakeTimers();
2626

2727
async function setupDevice(
28-
serverRef: {readonly serverBaseWsUrl: string, ...},
28+
serverRef: {+serverBaseWsUrl: string, ...},
2929
signal: AbortSignal,
3030
) {
3131
const device = await createDeviceMock(

packages/dev-middleware/src/inspector-proxy/Device.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export default class Device {
138138
// Logging reporting batches of cdp messages
139139
#cdpDebugLogging: CdpDebugLogging;
140140

141-
readonly #experiments: Experiments;
141+
+#experiments: Experiments;
142142

143143
constructor(deviceOptions: DeviceOptions) {
144144
this.#experiments = deviceOptions.experiments;

packages/dev-middleware/src/inspector-proxy/InspectorProxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
9393

9494
#eventReporter: ?EventReporter;
9595

96-
readonly #experiments: Experiments;
96+
+#experiments: Experiments;
9797

9898
// custom message handler factory allowing implementers to handle unsupported CDP messages.
9999
#customMessageHandler: ?CreateCustomMessageHandlerFn;

packages/dev-middleware/src/inspector-proxy/types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ export type JSONSerializable =
156156
| string
157157
| null
158158
| ReadonlyArray<JSONSerializable>
159-
| {readonly [string]: JSONSerializable};
159+
| {+[string]: JSONSerializable};
160160

161161
export type DeepReadOnly<T> =
162162
T extends ReadonlyArray<infer V>
163163
? ReadonlyArray<DeepReadOnly<V>>
164164
: T extends {...}
165-
? {readonly [K in keyof T]: DeepReadOnly<T[K]>}
165+
? {+[K in keyof T]: DeepReadOnly<T[K]>}
166166
: T;

packages/dev-middleware/src/types/DevToolLauncher.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface DevToolLauncher {
2727
* the host of dev-middleware. Implementations are responsible for rewriting
2828
* this as necessary where the server is remote.
2929
*/
30-
readonly launchDebuggerAppWindow: (url: string) => Promise<void>;
30+
+launchDebuggerAppWindow: (url: string) => Promise<void>;
3131

3232
/**
3333
* Attempt to open a debugger frontend URL in a standalone shell window
@@ -47,10 +47,7 @@ export interface DevToolLauncher {
4747
* the host of dev-middleware. Implementations are responsible for rewriting
4848
* this as necessary where the server is remote.
4949
*/
50-
readonly launchDebuggerShell?: (
51-
url: string,
52-
windowKey: string,
53-
) => Promise<void>;
50+
+launchDebuggerShell?: (url: string, windowKey: string) => Promise<void>;
5451

5552
/**
5653
* Attempt to prepare the debugger shell for use and returns a coded result
@@ -63,5 +60,5 @@ export interface DevToolLauncher {
6360
* SHOULD NOT return a rejecting promise in any case, and instead SHOULD report
6461
* errors via the returned result object.
6562
*/
66-
readonly prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
63+
+prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
6764
}

packages/dev-middleware/src/types/ReadonlyURL.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface ReadonlyURLSearchParams {
1515
get(name: string): string | null;
1616
getAll(name: string): Array<string>;
1717
has(name: string, value?: string): boolean;
18-
readonly size: number;
18+
+size: number;
1919
entries(): Iterator<[string, string]>;
2020
keys(): Iterator<string>;
2121
values(): Iterator<string>;
@@ -37,18 +37,18 @@ export interface ReadonlyURLSearchParams {
3737
* Used for URLs passed between module boundaries.
3838
*/
3939
export interface ReadonlyURL {
40-
readonly hash: string;
41-
readonly host: string;
42-
readonly hostname: string;
43-
readonly href: string;
44-
readonly origin: string;
45-
readonly password: string;
46-
readonly pathname: string;
47-
readonly port: string;
48-
readonly protocol: string;
49-
readonly search: string;
50-
readonly searchParams: ReadonlyURLSearchParams;
51-
readonly username: string;
40+
+hash: string;
41+
+host: string;
42+
+hostname: string;
43+
+href: string;
44+
+origin: string;
45+
+password: string;
46+
+pathname: string;
47+
+port: string;
48+
+protocol: string;
49+
+search: string;
50+
+searchParams: ReadonlyURLSearchParams;
51+
+username: string;
5252
toString(): string;
5353
toJSON(): string;
5454
}

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeArrayTurboModule.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ export type ArrayType = string;
1616
type AnotherArray = Array<ArrayType>;
1717

1818
export interface Spec extends TurboModule {
19-
readonly getArray: (a: Array<any>) => Array<string>;
20-
readonly getReadOnlyArray: (a: Array<any>) => ReadonlyArray<string>;
21-
readonly getArrayWithAlias: (
22-
a: AnotherArray,
23-
b: Array<ArrayType>,
24-
) => AnotherArray;
19+
+getArray: (a: Array<any>) => Array<string>;
20+
+getReadOnlyArray: (a: Array<any>) => ReadonlyArray<string>;
21+
+getArrayWithAlias: (a: AnotherArray, b: Array<ArrayType>) => AnotherArray;
2522
}
2623

2724
export default TurboModuleRegistry.getEnforcing<Spec>(

0 commit comments

Comments
 (0)