Skip to content

Commit 5fce2de

Browse files
marcoww6meta-codesync[bot]
authored andcommitted
Transform readonly in xplatjs (#56973)
Summary: Pull Request resolved: #56973 ``` js1 flow-runner codemod flow/transformAllVariance --variance readonly --format-files=false @ ``` drop-conflicts Reviewed By: SamChou19815 Differential Revision: D106410842 fbshipit-source-id: 58982a572f941fa32aeeaa50857b1e3b8968665e
1 parent 083fd99 commit 5fce2de

8 files changed

Lines changed: 31 additions & 26 deletions

File tree

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ 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>

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
}

0 commit comments

Comments
 (0)