Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/assets-registry/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
export type AssetDestPathResolver = 'android' | 'generic';

export type PackagerAsset = {
readonly __packager_asset: boolean,
readonly fileSystemLocation: string,
readonly httpServerLocation: string,
readonly width: ?number,
readonly height: ?number,
readonly scales: Array<number>,
readonly hash: string,
readonly name: string,
readonly type: string,
readonly resolver?: AssetDestPathResolver,
+__packager_asset: boolean,
+fileSystemLocation: string,
+httpServerLocation: string,
+width: ?number,
+height: ?number,
+scales: Array<number>,
+hash: string,
+name: string,
+type: string,
+resolver?: AssetDestPathResolver,
...
};
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class DebuggerAgent {

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

__handle(message: JSONSerializable): void {
this.handle(message);
Expand Down
12 changes: 5 additions & 7 deletions packages/dev-middleware/src/__tests__/InspectorDeviceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,16 @@ export class DeviceAgent {

export class DeviceMock extends DeviceAgent {
// Empty handlers
readonly connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
readonly disconnect: JestMockFn<[message: DisconnectRequest], void> =
jest.fn();
readonly getPages: JestMockFn<
+connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
+disconnect: JestMockFn<[message: DisconnectRequest], void> = jest.fn();
+getPages: JestMockFn<
[message: GetPagesRequest],
| GetPagesResponse['payload']
| Promise<GetPagesResponse['payload'] | void>
| void,
> = jest.fn();
readonly wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> =
jest.fn();
readonly wrappedEventParsed: JestMockFn<
+wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> = jest.fn();
+wrappedEventParsed: JestMockFn<
[
payload: {
...WrappedEventToDevice['payload'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const PAGES_POLLING_DELAY = 2100;
jest.useFakeTimers();

async function setupDevice(
serverRef: {readonly serverBaseWsUrl: string, ...},
serverRef: {+serverBaseWsUrl: string, ...},
signal: AbortSignal,
) {
const device = await createDeviceMock(
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default class Device {
// Logging reporting batches of cdp messages
#cdpDebugLogging: CdpDebugLogging;

readonly #experiments: Experiments;
+#experiments: Experiments;

constructor(deviceOptions: DeviceOptions) {
this.#experiments = deviceOptions.experiments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class InspectorProxy implements InspectorProxyQueries {

#eventReporter: ?EventReporter;

readonly #experiments: Experiments;
+#experiments: Experiments;

// custom message handler factory allowing implementers to handle unsupported CDP messages.
#customMessageHandler: ?CreateCustomMessageHandlerFn;
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-middleware/src/inspector-proxy/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ export type JSONSerializable =
| string
| null
| ReadonlyArray<JSONSerializable>
| {readonly [string]: JSONSerializable};
| {+[string]: JSONSerializable};

export type DeepReadOnly<T> =
T extends ReadonlyArray<infer V>
? ReadonlyArray<DeepReadOnly<V>>
: T extends {...}
? {readonly [K in keyof T]: DeepReadOnly<T[K]>}
? {+[K in keyof T]: DeepReadOnly<T[K]>}
: T;
9 changes: 3 additions & 6 deletions packages/dev-middleware/src/types/DevToolLauncher.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface DevToolLauncher {
* the host of dev-middleware. Implementations are responsible for rewriting
* this as necessary where the server is remote.
*/
readonly launchDebuggerAppWindow: (url: string) => Promise<void>;
+launchDebuggerAppWindow: (url: string) => Promise<void>;

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

/**
* Attempt to prepare the debugger shell for use and returns a coded result
Expand All @@ -63,5 +60,5 @@ export interface DevToolLauncher {
* SHOULD NOT return a rejecting promise in any case, and instead SHOULD report
* errors via the returned result object.
*/
readonly prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
+prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
}
26 changes: 13 additions & 13 deletions packages/dev-middleware/src/types/ReadonlyURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ReadonlyURLSearchParams {
get(name: string): string | null;
getAll(name: string): Array<string>;
has(name: string, value?: string): boolean;
readonly size: number;
+size: number;
entries(): Iterator<[string, string]>;
keys(): Iterator<string>;
values(): Iterator<string>;
Expand All @@ -37,18 +37,18 @@ export interface ReadonlyURLSearchParams {
* Used for URLs passed between module boundaries.
*/
export interface ReadonlyURL {
readonly hash: string;
readonly host: string;
readonly hostname: string;
readonly href: string;
readonly origin: string;
readonly password: string;
readonly pathname: string;
readonly port: string;
readonly protocol: string;
readonly search: string;
readonly searchParams: ReadonlyURLSearchParams;
readonly username: string;
+hash: string;
+host: string;
+hostname: string;
+href: string;
+origin: string;
+password: string;
+pathname: string;
+port: string;
+protocol: string;
+search: string;
+searchParams: ReadonlyURLSearchParams;
+username: string;
toString(): string;
toJSON(): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ export type ArrayType = string;
type AnotherArray = Array<ArrayType>;

export interface Spec extends TurboModule {
readonly getArray: (a: Array<any>) => Array<string>;
readonly getReadOnlyArray: (a: Array<any>) => ReadonlyArray<string>;
readonly getArrayWithAlias: (
a: AnotherArray,
b: Array<ArrayType>,
) => AnotherArray;
+getArray: (a: Array<any>) => Array<string>;
+getReadOnlyArray: (a: Array<any>) => ReadonlyArray<string>;
+getArrayWithAlias: (a: AnotherArray, b: Array<ArrayType>) => AnotherArray;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export type Boolean = boolean;
type AnotherBoolean = Boolean;

export interface Spec extends TurboModule {
readonly getBoolean: (arg: boolean) => boolean;
readonly getBooleanWithAlias: (arg: Boolean) => AnotherBoolean;
+getBoolean: (arg: boolean) => boolean;
+getBooleanWithAlias: (arg: Boolean) => AnotherBoolean;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export type String = string;
type CB = (value: String) => void;

export interface Spec extends TurboModule {
readonly getValueWithCallback: (callback: (value: string) => void) => void;
readonly getValueWithCallbackWithAlias: (c: CB) => void;
+getValueWithCallback: (callback: (value: string) => void) => void;
+getValueWithCallbackWithAlias: (c: CB) => void;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ export type StateTypeWithEnums = {
};

export interface Spec extends TurboModule {
readonly getStatusRegular: (statusProp: StateType) => StatusRegularEnum;
readonly getStatusStr: (statusProp: StateType) => StatusStrEnum;
readonly getStatusNum: (statusProp: StateType) => StatusNumEnum;
readonly getStatusLowerCase: (statusProp: StateType) => StatusLowerCaseEnum;
readonly getStateType: (
+getStatusRegular: (statusProp: StateType) => StatusRegularEnum;
+getStatusStr: (statusProp: StateType) => StatusStrEnum;
+getStatusNum: (statusProp: StateType) => StatusNumEnum;
+getStatusLowerCase: (statusProp: StateType) => StatusLowerCaseEnum;
+getStateType: (
a: StatusRegularEnum,
b: StatusStrEnum,
c: StatusNumEnum,
d: StatusLowerCaseEnum,
) => StateType;
readonly getStateTypeWithEnums: (
+getStateTypeWithEnums: (
paramOfTypeWithEnums: StateTypeWithEnums,
) => StateTypeWithEnums;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
readonly getBool: (a: ?boolean) => ?boolean;
readonly getNumber: (a: ?number) => ?number;
readonly getString: (a: ?number) => ?string;
readonly getArray: (a: ?Array<any>) => ?Array<any>;
readonly getObject: (a: ?Object) => ?Object;
readonly getValueWithPromise: () => ?Promise<string>;
+getBool: (a: ?boolean) => ?boolean;
+getNumber: (a: ?number) => ?number;
+getString: (a: ?number) => ?string;
+getArray: (a: ?Array<any>) => ?Array<any>;
+getObject: (a: ?Object) => ?Object;
+getValueWithPromise: () => ?Promise<string>;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export type Number = number;
type AnotherNumber = Number;

export interface Spec extends TurboModule {
readonly getNumber: (arg: number) => number;
readonly getNumberWithAlias: (arg: Number) => AnotherNumber;
+getNumber: (arg: number) => number;
+getNumberWithAlias: (arg: Number) => AnotherNumber;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ export type GenericObject = Object;
type AnotherGenericObject = GenericObject;

export interface Spec extends TurboModule {
readonly getGenericObject: (arg: Object) => Object;
readonly getGenericObjectReadOnly: (arg: Object) => Readonly<{a: string}>;
readonly getGenericObjectWithAlias: (
arg: GenericObject,
) => AnotherGenericObject;
readonly difficultObject: (A: {
+getGenericObject: (arg: Object) => Object;
+getGenericObjectReadOnly: (arg: Object) => Readonly<{a: string}>;
+getGenericObjectWithAlias: (arg: GenericObject) => AnotherGenericObject;
+difficultObject: (A: {
D: boolean,
E: {
D: boolean,
Expand All @@ -42,7 +40,7 @@ export interface Spec extends TurboModule {
},
F: string,
};
readonly getConstants: () => {
+getConstants: () => {
D: boolean,
E: {
D: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
readonly getConstants: () => {
+getConstants: () => {
D?: ?boolean,
A?: Array<any>,
E?: ?{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export type SomeObj = {
export type PartialSomeObj = Partial<SomeObj>;

export interface Spec extends TurboModule {
readonly getSomeObj: () => SomeObj;
readonly getPartialSomeObj: () => Partial<SomeObj>;
readonly getSomeObjFromPartialSomeObj: (value: Partial<SomeObj>) => SomeObj;
readonly getPartialPartial: (
+getSomeObj: () => SomeObj;
+getPartialSomeObj: () => Partial<SomeObj>;
+getSomeObjFromPartialSomeObj: (value: Partial<SomeObj>) => SomeObj;
+getPartialPartial: (
value1: Partial<SomeObj>,
value2: PartialSomeObj,
) => SomeObj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export type String = string;
type AnotherPromise = Promise<String>;

export interface Spec extends TurboModule {
readonly getValueWithPromise: (error: boolean) => Promise<string>;
readonly getValueWithPromiseWithAlias: (arg: String) => AnotherPromise;
+getValueWithPromise: (error: boolean) => Promise<string>;
+getValueWithPromiseWithAlias: (arg: String) => AnotherPromise;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ type Animal = {

export interface Spec extends TurboModule {
// Exported methods.
readonly getConstants: () => {
+getConstants: () => {
const1: boolean,
const2: number,
const3: string,
};
readonly voidFunc: () => void;
readonly getBool: (arg: boolean) => boolean;
readonly getNumber: (arg: number) => number;
readonly getString: (arg: string) => string;
readonly getArray: (arg: Array<any>) => Array<any>;
readonly getObject: (arg: Object) => Object;
readonly getObjectShape: (arg: {prop: number}) => {prop: number};
readonly getAlias: (arg: Animal) => Animal;
readonly getRootTag: (arg: RootTag) => RootTag;
readonly getValue: (x: number, y: string, z: Object) => Object;
readonly getValueWithCallback: (callback: (value: string) => void) => void;
readonly getValueWithPromise: (error: boolean) => Promise<string>;
+voidFunc: () => void;
+getBool: (arg: boolean) => boolean;
+getNumber: (arg: number) => number;
+getString: (arg: string) => string;
+getArray: (arg: Array<any>) => Array<any>;
+getObject: (arg: Object) => Object;
+getObjectShape: (arg: {prop: number}) => {prop: number};
+getAlias: (arg: Animal) => Animal;
+getRootTag: (arg: RootTag) => RootTag;
+getValue: (x: number, y: string, z: Object) => Object;
+getValueWithCallback: (callback: (value: string) => void) => void;
+getValueWithPromise: (error: boolean) => Promise<string>;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Loading
Loading