Skip to content

Commit 8745256

Browse files
SamChou19815meta-codesync[bot]
authored andcommitted
Redo modern syntax rollout in react-native (facebook#57034)
Summary: Pull Request resolved: facebook#57034 With D107165685, it should work this time. Changelog: [Internal] Differential Revision: D107111468
1 parent 63dec77 commit 8745256

234 files changed

Lines changed: 1759 additions & 1582 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-
+__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,
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,
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-
+handle: JestMockFn<[message: JSONSerializable], void> = jest.fn();
87+
readonly 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: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,18 @@ export class DeviceAgent {
9898

9999
export class DeviceMock extends DeviceAgent {
100100
// Empty handlers
101-
+connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
102-
+disconnect: JestMockFn<[message: DisconnectRequest], void> = jest.fn();
103-
+getPages: JestMockFn<
101+
readonly connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
102+
readonly disconnect: JestMockFn<[message: DisconnectRequest], void> =
103+
jest.fn();
104+
readonly getPages: JestMockFn<
104105
[message: GetPagesRequest],
105106
| GetPagesResponse['payload']
106107
| Promise<GetPagesResponse['payload'] | void>
107108
| void,
108109
> = jest.fn();
109-
+wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> = jest.fn();
110-
+wrappedEventParsed: JestMockFn<
110+
readonly wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> =
111+
jest.fn();
112+
readonly wrappedEventParsed: JestMockFn<
111113
[
112114
payload: {
113115
...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: {+serverBaseWsUrl: string, ...},
28+
serverRef: {readonly 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-
+#experiments: Experiments;
141+
readonly #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-
+#experiments: Experiments;
96+
readonly #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-
| {+[string]: JSONSerializable};
159+
| {readonly [string]: JSONSerializable};
160160

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

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

Lines changed: 6 additions & 3 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-
+launchDebuggerAppWindow: (url: string) => Promise<void>;
30+
readonly launchDebuggerAppWindow: (url: string) => Promise<void>;
3131

3232
/**
3333
* Attempt to open a debugger frontend URL in a standalone shell window
@@ -47,7 +47,10 @@ 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-
+launchDebuggerShell?: (url: string, windowKey: string) => Promise<void>;
50+
readonly launchDebuggerShell?: (
51+
url: string,
52+
windowKey: string,
53+
) => Promise<void>;
5154

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

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-
+size: number;
18+
readonly 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-
+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;
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;
5252
toString(): string;
5353
toJSON(): string;
5454
}

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

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

1818
export interface Spec extends TurboModule {
19-
+getArray: (a: Array<any>) => Array<string>;
20-
+getReadOnlyArray: (a: Array<any>) => ReadonlyArray<string>;
21-
+getArrayWithAlias: (a: AnotherArray, b: Array<ArrayType>) => AnotherArray;
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;
2225
}
2326

2427
export default TurboModuleRegistry.getEnforcing<Spec>(

0 commit comments

Comments
 (0)