Revert recent Flow syntax codemods in react-native-github (#56998)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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

fbshipit-source-id: 6bf915d530e130eba9c9d96a2b6c3dc8853594d1
This commit is contained in:
Rubén Norte authored and meta-codesync[bot] committed 2026-05-29 14:09:58 -07:00
1 parent 5b16cdff9d
commit 833144fcec
232 files changed
+1487 -1668

No files matched your search

+10 -10
View File
@@ -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,
...
};
*/
@@ -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);
@@ -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'],
@@ -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(
@@ -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;
@@ -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;
@@ -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;
@@ -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
@@ -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
@@ -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>;
}
@@ -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>;
@@ -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;
}
@@ -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>(
@@ -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>(
@@ -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>(
@@ -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;
}
@@ -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>(
@@ -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>(
@@ -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,
@@ -42,7 +40,7 @@ export interface Spec extends TurboModule {
},
F: string,
};
readonly getConstants: () => {
+getConstants: () => {
D: boolean,
E: {
D: boolean,
@@ -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?: ?{
@@ -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;
@@ -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>(
@@ -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>(
@@ -21,34 +21,28 @@ type Animal = {
export interface Spec extends TurboModule {
// Exported methods.
readonly getConstants: () => {
+getConstants: () => {
const1: Array<boolean>,
const2: Array<number>,
const3: Array<string>,
id?: Array<?{prop: number}>,
};
readonly voidFunc: () => void;
readonly getBool: (id: Array<boolean>) => Array<boolean>;
readonly getNumber: (arg: Array<number>) => Array<number>;
readonly getString: (arg: Array<string>) => Array<string>;
readonly getArray: (arg: Array<Array<any>>) => Array<Array<any>>;
readonly getObject: (arg: Array<Object>) => Array<Object>;
readonly getObjectShape: (
arg: Array<{prop: number}>,
) => Array<{prop: number}>;
readonly getAlias: (arg: Array<Animal>) => Array<Animal>;
readonly getRootTag: (arg: Array<RootTag>) => Array<RootTag>;
readonly getValue: (
+voidFunc: () => void;
+getBool: (id: Array<boolean>) => Array<boolean>;
+getNumber: (arg: Array<number>) => Array<number>;
+getString: (arg: Array<string>) => Array<string>;
+getArray: (arg: Array<Array<any>>) => Array<Array<any>>;
+getObject: (arg: Array<Object>) => Array<Object>;
+getObjectShape: (arg: Array<{prop: number}>) => Array<{prop: number}>;
+getAlias: (arg: Array<Animal>) => Array<Animal>;
+getRootTag: (arg: Array<RootTag>) => Array<RootTag>;
+getValue: (
x: Array<number>,
y: Array<string>,
z: Array<Object>,
) => Array<Object>;
readonly getValueWithCallback: (
callback: (value: Array<string>) => void,
) => void;
readonly getValueWithPromise: (
error: Array<boolean>,
) => Promise<Array<string>>;
+getValueWithCallback: (callback: (value: Array<string>) => void) => void;
+getValueWithPromise: (error: Array<boolean>) => Promise<Array<string>>;
}
export default TurboModuleRegistry.getEnforcing<Spec>(
@@ -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>(
@@ -21,25 +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>(
@@ -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>(
@@ -16,8 +16,8 @@ export type String = string;
type AnotherString = String;
export interface Spec extends TurboModule {
readonly getString: (arg: string) => string;
readonly getStringWithAlias: (arg: String) => AnotherString;
+getString: (arg: string) => string;
+getStringWithAlias: (arg: String) => AnotherString;
}
export default TurboModuleRegistry.getEnforcing<Spec>(
+8 -8
View File
@@ -72,14 +72,14 @@ export type ArrayBufferTypeAnnotation = Readonly<{
type: 'ArrayBufferTypeAnnotation',
}>;
export type ObjectTypeAnnotation<out T> = Readonly<{
export type ObjectTypeAnnotation<+T> = Readonly<{
type: 'ObjectTypeAnnotation',
properties: ReadonlyArray<NamedShape<T>>,
// metadata for objects that generated from interfaces
baseTypes?: ReadonlyArray<string>,
}>;
export type UnionTypeAnnotation<out T> = Readonly<{
export type UnionTypeAnnotation<+T> = Readonly<{
type: 'UnionTypeAnnotation',
types: ReadonlyArray<T>,
}>;
@@ -93,13 +93,13 @@ export type EventEmitterTypeAnnotation = Readonly<{
typeAnnotation: NativeModuleEventEmitterTypeAnnotation | $FlowFixMe,
}>;
type FunctionTypeAnnotation<out P, out R> = Readonly<{
type FunctionTypeAnnotation<+P, +R> = Readonly<{
type: 'FunctionTypeAnnotation',
params: ReadonlyArray<NamedShape<P>>,
returnTypeAnnotation: R,
}>;
export type NamedShape<out T> = Readonly<{
export type NamedShape<+T> = Readonly<{
name: string,
optional: boolean,
typeAnnotation: T,
@@ -195,7 +195,7 @@ export type ComponentCommandArrayTypeAnnotation = ArrayTypeAnnotation<
| MixedTypeAnnotation,
>;
export type ArrayTypeAnnotation<out T> = Readonly<{
export type ArrayTypeAnnotation<+T> = Readonly<{
type: 'ArrayTypeAnnotation',
elementType: T,
}>;
@@ -269,11 +269,11 @@ export type ReservedTypeAnnotation = Readonly<{
/**
* NativeModule Types
*/
export type Nullable<out T extends NativeModuleTypeAnnotation> =
export type Nullable<+T extends NativeModuleTypeAnnotation> =
| NullableTypeAnnotation<T>
| T;
export type NullableTypeAnnotation<out T extends NativeModuleTypeAnnotation> =
export type NullableTypeAnnotation<+T extends NativeModuleTypeAnnotation> =
Readonly<{
type: 'NullableTypeAnnotation',
typeAnnotation: T,
@@ -321,7 +321,7 @@ export type NativeModuleObjectTypeAnnotation = ObjectTypeAnnotation<
>;
export type NativeModuleArrayTypeAnnotation<
out T extends Nullable<NativeModuleBaseTypeAnnotation>,
+T extends Nullable<NativeModuleBaseTypeAnnotation>,
> = ArrayTypeAnnotation<
| T
/**
@@ -28,104 +28,99 @@ export type ReservedPrimitiveName =
| 'DimensionPrimitive';
type CppTypeInfo = {
readonly typeName: string,
readonly localIncludes: ReadonlyArray<string>,
readonly conversionIncludes: ReadonlyArray<string>,
+typeName: string,
+localIncludes: ReadonlyArray<string>,
+conversionIncludes: ReadonlyArray<string>,
};
type JavaImportInfo = {
readonly interfaceImports: ReadonlyArray<string>,
readonly delegateImports: ReadonlyArray<string>,
+interfaceImports: ReadonlyArray<string>,
+delegateImports: ReadonlyArray<string>,
};
type ReservedTypeMapping = {
readonly cpp: CppTypeInfo,
readonly java: JavaImportInfo,
+cpp: CppTypeInfo,
+java: JavaImportInfo,
};
const RESERVED_TYPES: {readonly [ReservedPrimitiveName]: ReservedTypeMapping} =
{
ColorPrimitive: {
cpp: {
typeName: 'SharedColor',
localIncludes: ['#include <react/renderer/graphics/Color.h>'],
conversionIncludes: [],
},
java: {
interfaceImports: [],
delegateImports: [
'import com.facebook.react.bridge.ColorPropConverter;',
],
},
const RESERVED_TYPES: {+[ReservedPrimitiveName]: ReservedTypeMapping} = {
ColorPrimitive: {
cpp: {
typeName: 'SharedColor',
localIncludes: ['#include <react/renderer/graphics/Color.h>'],
conversionIncludes: [],
},
ImageSourcePrimitive: {
cpp: {
typeName: 'ImageSource',
localIncludes: ['#include <react/renderer/imagemanager/primitives.h>'],
conversionIncludes: [
'#include <react/renderer/components/image/conversions.h>',
],
},
java: {
interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
},
java: {
interfaceImports: [],
delegateImports: ['import com.facebook.react.bridge.ColorPropConverter;'],
},
ImageRequestPrimitive: {
cpp: {
typeName: 'ImageRequest',
localIncludes: [
'#include <react/renderer/imagemanager/ImageRequest.h>',
],
conversionIncludes: [],
},
java: {
// ImageRequestPrimitive is not used in Java component props
interfaceImports: [],
delegateImports: [],
},
},
ImageSourcePrimitive: {
cpp: {
typeName: 'ImageSource',
localIncludes: ['#include <react/renderer/imagemanager/primitives.h>'],
conversionIncludes: [
'#include <react/renderer/components/image/conversions.h>',
],
},
PointPrimitive: {
cpp: {
typeName: 'Point',
localIncludes: ['#include <react/renderer/graphics/Point.h>'],
conversionIncludes: [],
},
java: {
interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
},
java: {
interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
},
EdgeInsetsPrimitive: {
cpp: {
typeName: 'EdgeInsets',
localIncludes: ['#include <react/renderer/graphics/RectangleEdges.h>'],
conversionIncludes: [],
},
java: {
interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
},
},
ImageRequestPrimitive: {
cpp: {
typeName: 'ImageRequest',
localIncludes: ['#include <react/renderer/imagemanager/ImageRequest.h>'],
conversionIncludes: [],
},
DimensionPrimitive: {
cpp: {
typeName: 'YGValue',
localIncludes: [
'#include <yoga/Yoga.h>',
'#include <react/renderer/core/graphicsConversions.h>',
],
conversionIncludes: [
'#include <react/renderer/components/view/conversions.h>',
],
},
java: {
interfaceImports: ['import com.facebook.yoga.YogaValue;'],
delegateImports: [
'import com.facebook.react.bridge.DimensionPropConverter;',
],
},
java: {
// ImageRequestPrimitive is not used in Java component props
interfaceImports: [],
delegateImports: [],
},
};
},
PointPrimitive: {
cpp: {
typeName: 'Point',
localIncludes: ['#include <react/renderer/graphics/Point.h>'],
conversionIncludes: [],
},
java: {
interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
},
},
EdgeInsetsPrimitive: {
cpp: {
typeName: 'EdgeInsets',
localIncludes: ['#include <react/renderer/graphics/RectangleEdges.h>'],
conversionIncludes: [],
},
java: {
interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
},
},
DimensionPrimitive: {
cpp: {
typeName: 'YGValue',
localIncludes: [
'#include <yoga/Yoga.h>',
'#include <react/renderer/core/graphicsConversions.h>',
],
conversionIncludes: [
'#include <react/renderer/components/view/conversions.h>',
],
},
java: {
interfaceImports: ['import com.facebook.yoga.YogaValue;'],
delegateImports: [
'import com.facebook.react.bridge.DimensionPropConverter;',
],
},
},
};
function getCppTypeForReservedPrimitive(name: ReservedPrimitiveName): string {
return RESERVED_TYPES[name].cpp.typeName;
@@ -49,13 +49,13 @@ function getNativeTypeFromAnnotation(
| ObjectTypeAnnotation<PropTypeAnnotation>
| ReservedPropTypeAnnotation
| {
readonly default: string,
readonly options: ReadonlyArray<string>,
readonly type: 'StringEnumTypeAnnotation',
+default: string,
+options: ReadonlyArray<string>,
+type: 'StringEnumTypeAnnotation',
}
| {
readonly elementType: ObjectTypeAnnotation<PropTypeAnnotation>,
readonly type: 'ArrayTypeAnnotation',
+elementType: ObjectTypeAnnotation<PropTypeAnnotation>,
+type: 'ArrayTypeAnnotation',
},
},
nameParts: ReadonlyArray<string>,
+1 -1
View File
@@ -128,7 +128,7 @@ class UnsupportedModulePropertyParserError extends ParserError {
}
class UnsupportedTypeAnnotationParserError extends ParserError {
readonly typeAnnotationType: string;
+typeAnnotationType: string;
constructor(
nativeModuleName: string,
typeAnnotation: $FlowFixMe,
@@ -17,7 +17,7 @@ const {verifyPropNotAlreadyDefined} = require('../../parsers-commons');
const {getValueFromTypes} = require('../utils.js');
// $FlowFixMe[unsupported-variance-annotation]
function getTypeAnnotationForArray<out T>(
function getTypeAnnotationForArray<+T>(
name: string,
typeAnnotation: $FlowFixMe,
defaultValue: $FlowFixMe | null,
@@ -219,7 +219,7 @@ function flattenProperties(
}
// $FlowFixMe[unsupported-variance-annotation]
function getTypeAnnotation<out T>(
function getTypeAnnotation<+T>(
name: string,
annotation: $FlowFixMe | ASTNode,
defaultValue: $FlowFixMe | null,
@@ -107,7 +107,7 @@ function wrapModuleSchema(
}
// $FlowFixMe[unsupported-variance-annotation]
function unwrapNullable<out T extends NativeModuleTypeAnnotation>(
function unwrapNullable<+T extends NativeModuleTypeAnnotation>(
x: Nullable<T>,
): [T, boolean] {
if (x.type === 'NullableTypeAnnotation') {
@@ -118,7 +118,7 @@ function unwrapNullable<out T extends NativeModuleTypeAnnotation>(
}
// $FlowFixMe[unsupported-variance-annotation]
function wrapNullable<out T extends NativeModuleTypeAnnotation>(
function wrapNullable<+T extends NativeModuleTypeAnnotation>(
nullable: boolean,
typeAnnotation: T,
): Nullable<T> {
@@ -91,83 +91,53 @@ type CustomObj = {foo: string, bar: number};
type CustomObj2 = {a: Int32, b: string};
interface NativeCommands {
readonly methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
readonly methodIntString: (
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
+methodIntString: (
viewRef: React.ElementRef<NativeType>,
a: Int32,
b: string,
) => void;
readonly methodString: (
viewRef: React.ElementRef<NativeType>,
a: string,
) => void;
readonly methodBool: (
viewRef: React.ElementRef<NativeType>,
a: boolean,
) => void;
readonly methodFloat: (
viewRef: React.ElementRef<NativeType>,
a: Float,
) => void;
readonly methodDouble: (
viewRef: React.ElementRef<NativeType>,
a: Double,
) => void;
+methodString: (viewRef: React.ElementRef<NativeType>, a: string) => void;
+methodBool: (viewRef: React.ElementRef<NativeType>, a: boolean) => void;
+methodFloat: (viewRef: React.ElementRef<NativeType>, a: Float) => void;
+methodDouble: (viewRef: React.ElementRef<NativeType>, a: Double) => void;
readonly methodIntAlias: (
viewRef: React.ElementRef<NativeType>,
a: Int,
) => void;
readonly methodStringAlias: (
viewRef: React.ElementRef<NativeType>,
a: Str,
) => void;
readonly methodBoolAlias: (
viewRef: React.ElementRef<NativeType>,
a: Bool,
) => void;
readonly methodFloatAlias: (
viewRef: React.ElementRef<NativeType>,
a: Fl,
) => void;
readonly methodDoubleAlias: (
viewRef: React.ElementRef<NativeType>,
a: Dbl,
) => void;
+methodIntAlias: (viewRef: React.ElementRef<NativeType>, a: Int) => void;
+methodStringAlias: (viewRef: React.ElementRef<NativeType>, a: Str) => void;
+methodBoolAlias: (viewRef: React.ElementRef<NativeType>, a: Bool) => void;
+methodFloatAlias: (viewRef: React.ElementRef<NativeType>, a: Fl) => void;
+methodDoubleAlias: (viewRef: React.ElementRef<NativeType>, a: Dbl) => void;
readonly methodIntArray: (
+methodIntArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<Int32>,
) => void;
readonly methodStringArray: (
+methodStringArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<string>,
) => void;
readonly methodBoolArray: (
+methodBoolArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<boolean>,
) => void;
readonly methodFloatArray: (
+methodFloatArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<Float>,
) => void;
readonly methodDoubleArray: (
+methodDoubleArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<Double>,
) => void;
readonly methodCustomObjArray: (
+methodCustomObjArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<CustomObj>,
) => void;
readonly methodCustomObj2Array: (
+methodCustomObj2Array: (
viewRef: React.ElementRef<NativeType>,
a: Array<CustomObj2>,
) => void;
readonly methodRootTag: (
viewRef: React.ElementRef<NativeType>,
a: RootTag,
) => void;
+methodRootTag: (viewRef: React.ElementRef<NativeType>, a: RootTag) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -26,23 +26,20 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
readonly methodInt: (
viewRef: React.ElementRef<NativeType>,
a: Array<Int32>,
) => void;
readonly methodString: (
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Array<Int32>) => void;
+methodString: (
viewRef: React.ElementRef<NativeType>,
a: Array<string>,
) => void;
readonly methodBool: (
+methodBool: (
viewRef: React.ElementRef<NativeType>,
a: Array<boolean>,
) => void;
readonly methodFloat: (
+methodFloat: (
viewRef: React.ElementRef<NativeType>,
a: Array<Float>,
) => void;
readonly methodDouble: (
+methodDouble: (
viewRef: React.ElementRef<NativeType>,
a: Array<Double>,
) => void;
@@ -26,23 +26,11 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
readonly methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
readonly methodString: (
viewRef: React.ElementRef<NativeType>,
a: string,
) => void;
readonly methodBool: (
viewRef: React.ElementRef<NativeType>,
a: boolean,
) => void;
readonly methodFloat: (
viewRef: React.ElementRef<NativeType>,
a: Float,
) => void;
readonly methodDouble: (
viewRef: React.ElementRef<NativeType>,
a: Double,
) => void;
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
+methodString: (viewRef: React.ElementRef<NativeType>, a: string) => void;
+methodBool: (viewRef: React.ElementRef<NativeType>, a: boolean) => void;
+methodFloat: (viewRef: React.ElementRef<NativeType>, a: Float) => void;
+methodDouble: (viewRef: React.ElementRef<NativeType>, a: Double) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -21,10 +21,7 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
readonly methodInt: (
viewRef: React.ElementRef<NativeType>,
a: string,
) => void;
+methodInt: (viewRef: React.ElementRef<NativeType>, a: string) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -22,7 +22,7 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
readonly methodInt: (
+methodInt: (
viewRef: React.ElementRef<NativeType>,
a: Int32,
b: string,
@@ -22,11 +22,8 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
readonly methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
readonly methodString: (
viewRef: React.ElementRef<NativeType>,
a: string,
) => void;
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
+methodString: (viewRef: React.ElementRef<NativeType>, a: string) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -22,7 +22,7 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
readonly methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -21,11 +21,13 @@ type BeforeMatchingGeneric<T> = {||};
type AfterMatchingGeneric<T> = {||};
export interface Spec extends TurboModule {
readonly simpleObject: (a: SimpleObject) => void;
readonly beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
+simpleObject: (a: SimpleObject) => void;
+beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
readonly beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
readonly afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
+beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
+afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
}
TurboModuleRegistry.getEnforcing<Spec>('NativeModuleTest') as Spec;
TurboModuleRegistry.getEnforcing<Spec>(
'NativeModuleTest',
) as Spec;
@@ -44,32 +44,34 @@ type SimpleArray = Array<string>;
type SimpleArrayChange = Array<string>;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: SimpleObject) => void;
readonly simpleObject: (a: SimpleObject) => void;
readonly beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
readonly afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
+exampleFunction: (a: SimpleObject) => void;
+simpleObject: (a: SimpleObject) => void;
+beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
+afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
readonly beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
readonly afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
+beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
+afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
readonly booleanType: (a: BooleanType) => void;
readonly stringType: (a: StringType) => void;
+booleanType: (a: BooleanType) => void;
+stringType: (a: StringType) => void;
readonly simpleFunction: (a: string) => string;
readonly simpleFunction2: (a: string) => number;
readonly simpleFunction3: (foo: string) => string;
readonly simpleFunction4: (a: number) => string;
+simpleFunction: (a: string) => string;
+simpleFunction2: (a: string) => number;
+simpleFunction3: (foo: string) => string;
+simpleFunction4: (a: number) => string;
readonly simpleUnion: (a: SimpleUnion) => void;
readonly simpleUnionLonger: (a: SimpleUnionLonger) => void;
readonly simpleUnionOrderChanged: (a: SimpleUnionOrderChanged) => void;
readonly simpleUnion2: (a: SimpleUnion2) => void;
readonly simpleUnion2OrderChanged: (a: SimpleUnion2OrderChanged) => void;
readonly simpleUnion3: (a: SimpleUnion3) => void;
readonly simpleUnion4: (a: SimpleUnion4) => void;
+simpleUnion: (a: SimpleUnion) => void;
+simpleUnionLonger: (a: SimpleUnionLonger) => void;
+simpleUnionOrderChanged: (a: SimpleUnionOrderChanged) => void;
+simpleUnion2: (a: SimpleUnion2) => void;
+simpleUnion2OrderChanged: (a: SimpleUnion2OrderChanged) => void;
+simpleUnion3: (a: SimpleUnion3) => void;
+simpleUnion4: (a: SimpleUnion4) => void;
readonly simpleArray: (a: SimpleArray) => void;
readonly simpleArrayChange: (a: SimpleArrayChange) => void;
}
+simpleArray: (a: SimpleArray) => void;
+simpleArrayChange: (a: SimpleArrayChange) => void;
}
TurboModuleRegistry.getEnforcing<Spec>('NativeModuleTest') as Spec;
TurboModuleRegistry.getEnforcing<Spec>(
'NativeModuleTest',
) as Spec;
@@ -36,34 +36,37 @@ type SimpleUnion4 = BooleanType | StringType | SimpleObject;
type SimpleArray = Array<string>;
type SimpleArrayChange = Array<number>;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: SimpleObject) => void;
readonly simpleObject: (a: SimpleObject) => void;
readonly beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
readonly afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
+exampleFunction: (a: SimpleObject) => void;
+simpleObject: (a: SimpleObject) => void;
+beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
+afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
readonly beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
readonly afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
+beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
+afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
readonly arrayBufferType: (a: ArrayBufferType) => void;
readonly booleanType: (a: BooleanType) => void;
readonly stringType: (a: StringType) => void;
+arrayBufferType: (a: ArrayBufferType) => void;
+booleanType: (a: BooleanType) => void;
+stringType: (a: StringType) => void;
readonly simpleFunction: (a: string) => string;
readonly simpleFunction2: (a: string) => number;
readonly simpleFunction3: (foo: string) => string;
readonly simpleFunction4: (a: number) => string;
+simpleFunction: (a: string) => string;
+simpleFunction2: (a: string) => number;
+simpleFunction3: (foo: string) => string;
+simpleFunction4: (a: number) => string;
readonly simpleUnion: (a: SimpleUnion) => void;
readonly simpleUnionLonger: (a: SimpleUnionLonger) => void;
readonly simpleUnionOrderChanged: (a: SimpleUnionOrderChanged) => void;
readonly simpleUnion2: (a: SimpleUnion2) => void;
readonly simpleUnion2OrderChanged: (a: SimpleUnion2OrderChanged) => void;
readonly simpleUnion3: (a: SimpleUnion3) => void;
readonly simpleUnion4: (a: SimpleUnion4) => void;
+simpleUnion: (a: SimpleUnion) => void;
+simpleUnionLonger: (a: SimpleUnionLonger) => void;
+simpleUnionOrderChanged: (a: SimpleUnionOrderChanged) => void;
+simpleUnion2: (a: SimpleUnion2) => void;
+simpleUnion2OrderChanged: (a: SimpleUnion2OrderChanged) => void;
+simpleUnion3: (a: SimpleUnion3) => void;
+simpleUnion4: (a: SimpleUnion4) => void;
readonly simpleArray: (a: SimpleArray) => void;
readonly simpleArrayChange: (a: SimpleArrayChange) => void;
+simpleArray: (a: SimpleArray) => void;
+simpleArrayChange: (a: SimpleArrayChange) => void;
}
TurboModuleRegistry.getEnforcing<Spec>('NativeModuleTest') as Spec;
TurboModuleRegistry.getEnforcing<Spec>(
'NativeModuleTest',
) as Spec;
@@ -13,9 +13,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: string,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: string,
};
}
@@ -13,8 +13,8 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => Readonly<{
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => Readonly<{
constant?: string,
}>;
}
@@ -13,9 +13,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly constant?: string,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+constant?: string,
};
}
@@ -13,8 +13,8 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => Readonly<{
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => Readonly<{
constant: string,
}>;
}
@@ -13,9 +13,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly constant: string,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+constant: string,
};
}
@@ -13,8 +13,8 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => Readonly<{}>;
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => Readonly<{}>;
}
export default TurboModuleRegistry.getEnforcing<Spec>(
@@ -13,8 +13,8 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {};
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {};
}
export default TurboModuleRegistry.getEnforcing<Spec>(
@@ -15,7 +15,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type MyType = () => Promise<number>;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: MyType, b: number) => void;
+exampleFunction: (a: MyType, b: number) => void;
}
export default TurboModuleRegistry.getEnforcing<Spec>(
@@ -15,7 +15,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type MyType = () => Promise<string>;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: MyType, b: number) => void;
+exampleFunction: (a: MyType, b: number) => void;
}
export default TurboModuleRegistry.getEnforcing<Spec>(
@@ -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 exampleFunction: (
+exampleFunction: (
a: {
a1: string,
a2: number,
@@ -22,8 +22,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
readonly getConstants: () => {
readonly exampleConstant: string,
+getConstants: () => {
+exampleConstant: string,
};
}
@@ -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 exampleFunction: (
+exampleFunction: (
a: ?{
a1: string,
a2?: number,
@@ -22,8 +22,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
readonly getConstants: () => {
readonly exampleConstant: string,
+getConstants: () => {
+exampleConstant: string,
};
}
@@ -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 exampleFunction: (
+exampleFunction: (
a: {
a1: string,
a2?: number,
@@ -22,8 +22,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
readonly getConstants: () => {
readonly exampleConstant: string,
+getConstants: () => {
+exampleConstant: string,
};
}
@@ -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 exampleFunction: (
+exampleFunction: (
a: {
a1: string,
a2: number,
@@ -21,8 +21,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
readonly getConstants: () => {
readonly exampleConstant: string,
+getConstants: () => {
+exampleConstant: string,
};
}
@@ -170,63 +170,55 @@ enum EnumUnsorted {
}
export interface Spec extends TurboModule {
readonly stringLiteral0: (a: StringLiteral0) => void;
readonly stringLiteral1: (a: StringLiteral1) => void;
+stringLiteral0: (a: StringLiteral0) => void;
+stringLiteral1: (a: StringLiteral1) => void;
readonly booleanLiteral0: (a: BooleanLiteral0) => void;
readonly booleanLiteral1: (a: BooleanLiteral1) => void;
+booleanLiteral0: (a: BooleanLiteral0) => void;
+booleanLiteral1: (a: BooleanLiteral1) => void;
readonly numericLiteral0: (a: NumericLiteral0) => void;
readonly numericLiteral1: (a: NumericLiteral1) => void;
+numericLiteral0: (a: NumericLiteral0) => void;
+numericLiteral1: (a: NumericLiteral1) => void;
readonly stringLiteralUnion0: (a: StringLiteralUnion0) => void;
readonly stringLiteralUnion1: (a: StringLiteralUnion1) => void;
readonly stringLiteralUnion2: (a: StringLiteralUnion2) => void;
+stringLiteralUnion0: (a: StringLiteralUnion0) => void;
+stringLiteralUnion1: (a: StringLiteralUnion1) => void;
+stringLiteralUnion2: (a: StringLiteralUnion2) => void;
readonly referenceType: (a: ReferenceType) => void;
readonly referenceType2: (a: ReferenceType2) => void;
readonly referenceType3: (a: ReferenceType3) => void;
+referenceType: (a: ReferenceType) => void;
+referenceType2: (a: ReferenceType2) => void;
+referenceType3: (a: ReferenceType3) => void;
readonly referenceGeneric: <T>(a: ReferenceGeneric<T>) => void;
readonly referenceGeneric2: <T, X>(a: ReferenceGeneric2<T, X>) => void;
+referenceGeneric: <T>(a: ReferenceGeneric<T>) => void;
+referenceGeneric2: <T, X>(a: ReferenceGeneric2<T, X>) => void;
readonly objectTypeWithProps: (a: ObjectTypeWithProps) => void;
readonly objectTypeLessProps: (a: ObjectTypeLessProps) => void;
readonly objectTypeWithDifferentProps: (
a: ObjectTypeWithDifferentProps,
) => void;
readonly objectTypeWithNesting: (a: ObjectTypeWithNesting) => void;
readonly objectTypeWithChanges: (a: ObjectTypeWithChanges) => void;
readonly objectTypeWithNestedChanges: (
a: ObjectTypeWithNestedChanges,
) => void;
readonly objectTypeWithTwoOptionals: (a: ObjectTypeWithTwoOptionals) => void;
readonly objectTypeWithOptionalNestedChange: (
a: ObjectTypeWithOptionalNestedChange,
) => void;
readonly nonNullableType: (a: NonNullableType) => void;
readonly nullableType: (a: NullableType) => void;
readonly genericObjectType: (a: GenericObjectType) => void;
readonly unsafeObjectType: (a: UnsafeObjectType) => void;
readonly optionalTypeLessProps: (a: OptionalTypeLessProps) => void;
readonly objectTypeLiteral1: (a: ObjectTypeLiteral1) => void;
readonly objectTypeLiteral2: (a: ObjectTypeLiteral2) => void;
readonly objectTypeLiteral1TypeAlias: (
a: ObjectTypeLiteral1TypeAlias,
) => void;
readonly objectTypeLiteral2TypeAlias: (
a: ObjectTypeLiteral2TypeAlias,
) => void;
readonly genericObjectType: (a: Object) => void;
+objectTypeWithProps: (a: ObjectTypeWithProps) => void;
+objectTypeLessProps: (a: ObjectTypeLessProps) => void;
+objectTypeWithDifferentProps: (a: ObjectTypeWithDifferentProps) => void;
+objectTypeWithNesting: (a: ObjectTypeWithNesting) => void;
+objectTypeWithChanges: (a: ObjectTypeWithChanges) => void;
+objectTypeWithNestedChanges: (a: ObjectTypeWithNestedChanges) => void;
+objectTypeWithTwoOptionals: (a: ObjectTypeWithTwoOptionals) => void;
+objectTypeWithOptionalNestedChange: (a: ObjectTypeWithOptionalNestedChange) => void;
+nonNullableType: (a: NonNullableType) => void;
+nullableType: (a: NullableType) => void;
+genericObjectType: (a: GenericObjectType) => void;
+unsafeObjectType: (a: UnsafeObjectType) => void;
+optionalTypeLessProps: (a: OptionalTypeLessProps) => void;
+objectTypeLiteral1: (a: ObjectTypeLiteral1) => void;
+objectTypeLiteral2: (a: ObjectTypeLiteral2) => void;
+objectTypeLiteral1TypeAlias: (a: ObjectTypeLiteral1TypeAlias) => void;
+objectTypeLiteral2TypeAlias: (a: ObjectTypeLiteral2TypeAlias) => void;
+genericObjectType: (a: Object) => void;
readonly mapWithKey: (a: MapWithKey) => void;
readonly mapWithKey2: (a: MapWithKey2) => void;
+mapWithKey: (a: MapWithKey) => void;
+mapWithKey2: (a: MapWithKey2) => void;
readonly enum: (a: Enum) => void;
readonly enumWithTypeChange: (a: EnumWithTypeChange) => void;
readonly enumWithRemoval: (a: EnumWithRemoval) => void;
readonly enumWithValueChange: (a: EnumWithValueChange) => void;
readonly enumUnsorted: (a: EnumUnsorted) => void;
+enum: (a: Enum) => void;
+enumWithTypeChange: (a: EnumWithTypeChange) => void;
+enumWithRemoval: (a: EnumWithRemoval) => void;
+enumWithValueChange: (a: EnumWithValueChange) => void;
+enumUnsorted: (a: EnumUnsorted) => void;
}
TurboModuleRegistry.getEnforcing<Spec>('NativeModuleTest') as Spec;
TurboModuleRegistry.getEnforcing<Spec>(
'NativeModuleTest',
) as Spec;
@@ -13,9 +13,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: {[key: string]: string}, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: {[key: string]: string}, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -13,9 +13,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: {[key: string]: number}, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: {[key: string]: number}, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -20,9 +20,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -20,9 +20,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
};
}
@@ -20,9 +20,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -13,9 +13,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number, c?: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: string, b: number, c?: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -16,9 +16,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type BooleanUnion = true | false;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: BooleanUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: BooleanUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type BooleanUnion = true;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: BooleanUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: BooleanUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type testUnion = 'a' | 'b' | 'c' | 'd';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type testUnion = 'a' | '0' | '1' | 'a long string';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type testUnion = 'a' | 'b' | 'c' | 'd';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: testUnion,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: testUnion,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type testUnion = 'a' | 'b' | 'c';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: testUnion,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: testUnion,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type NumberUnion = 4 | 5 | 6;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: NumberUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: NumberUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type NumberUnion = 1 | 2 | 3;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: NumberUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: NumberUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -30,9 +30,9 @@ type ObjectC = {|
type ObjectUnion = ObjectA | ObjectB | ObjectC;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: ObjectUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: ObjectUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -26,9 +26,9 @@ type ObjectB = {|
type ObjectUnion = ObjectA | ObjectB;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: ObjectUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: ObjectUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -25,9 +25,9 @@ type ObjectB = {|
type ObjectUnion = ObjectA | ObjectB;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: ObjectUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: ObjectUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type testUnion = 1 | 2 | 3;
export interface Spec extends TurboModule {
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type testUnion = 'a' | 'b' | 'c';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -13,9 +13,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
};
}
@@ -28,7 +28,7 @@ type PopupMenuSelectionEvent = NativeSyntheticEvent<
type PopupMenuDismissEvent = NativeSyntheticEvent<Readonly<{}>>;
export type PopupMenuAndroidInstance = {
readonly show: () => void,
+show: () => void,
};
type Props = {
@@ -37,7 +37,7 @@ const styles = StyleSheet.create({
});
export type PopupMenuAndroidInstance = {
readonly show: () => void,
+show: () => void,
};
type Props = {
@@ -38,7 +38,7 @@ type NativeProps = Readonly<{
type ComponentType = HostComponent<NativeProps>;
interface NativeCommands {
readonly show: (viewRef: React.ElementRef<ComponentType>) => void;
+show: (viewRef: React.ElementRef<ComponentType>) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -31,7 +31,7 @@ type Nullable = void | null;
type Primitive = string | number | boolean | symbol | void;
type Builtin = (...ReadonlyArray<empty>) => unknown | Date | Error | RegExp;
export type WithAnimatedValue<out T> = T extends Builtin | Nullable
export type WithAnimatedValue<+T> = T extends Builtin | Nullable
? T
: T extends Primitive
?
@@ -51,7 +51,7 @@ export type WithAnimatedValue<out T> = T extends Builtin | Nullable
: T extends ReadonlyArray<infer P>
? ReadonlyArray<WithAnimatedValue<P>>
: T extends {...}
? {readonly [K in keyof T]: WithAnimatedValue<T[K]>}
? {+[K in keyof T]: WithAnimatedValue<T[K]>}
: T;
type NonAnimatedProps =
@@ -91,7 +91,7 @@ export type AnimatedBaseProps<Props extends {...}> = LooseOmit<
export type AnimatedComponentType<
Props extends {...},
out Instance = unknown,
+Instance = unknown,
> = component(ref?: React.RefSetter<Instance>, ...AnimatedProps<Props>);
export default function createAnimatedComponent<
@@ -30,18 +30,18 @@ export type AnimatedColorConfig = Readonly<{
type ColorListenerCallback = (value: ColorValue) => unknown;
export type RgbaValue = {
readonly r: number,
readonly g: number,
readonly b: number,
readonly a: number,
+r: number,
+g: number,
+b: number,
+a: number,
...
};
type RgbaAnimatedValue = {
readonly r: AnimatedValue,
readonly g: AnimatedValue,
readonly b: AnimatedValue,
readonly a: AnimatedValue,
+r: AnimatedValue,
+g: AnimatedValue,
+b: AnimatedValue,
+a: AnimatedValue,
...
};
@@ -30,7 +30,7 @@ export type AnimatedPropsAllowlist = Readonly<{
}>;
type TargetView = {
readonly instance: TargetViewInstance,
+instance: TargetViewInstance,
connectedViewTag: ?number,
};
type TargetViewInstance = React.ElementRef<React.ElementType>;
@@ -45,8 +45,8 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
constructor(
valueIn?: ?{
readonly x: number | AnimatedValue,
readonly y: number | AnimatedValue,
+x: number | AnimatedValue,
+y: number | AnimatedValue,
...
},
config?: ?AnimatedValueXYConfig,
@@ -10,7 +10,7 @@
declare export class URLSearchParams {
_searchParams: Array<[string, string]>;
readonly size: number;
+size: number;
constructor(
params?: Record<string, string> | string | Array<[string, string]>,
): void;
@@ -135,19 +135,19 @@ export interface ScrollViewScrollToOptions {
// Public methods for ScrollView
export interface ScrollViewImperativeMethods {
readonly getScrollResponder: () => ScrollResponderType;
readonly getScrollableNode: () => ?number;
readonly getInnerViewNode: () => ?number;
readonly getInnerViewRef: () => InnerViewInstance | null;
readonly getNativeScrollRef: () => PublicScrollViewInstance | null;
readonly scrollTo: (
+getScrollResponder: () => ScrollResponderType;
+getScrollableNode: () => ?number;
+getInnerViewNode: () => ?number;
+getInnerViewRef: () => InnerViewInstance | null;
+getNativeScrollRef: () => PublicScrollViewInstance | null;
+scrollTo: (
options?: ScrollViewScrollToOptions | number,
deprecatedX?: number,
deprecatedAnimated?: boolean,
) => void;
readonly scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void;
readonly flashScrollIndicators: () => void;
readonly scrollResponderZoomTo: (
+scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void;
+flashScrollIndicators: () => void;
+scrollResponderZoomTo: (
rect: {
x: number,
y: number,
@@ -157,7 +157,7 @@ export interface ScrollViewImperativeMethods {
},
animated?: boolean, // deprecated, put this inside the rect argument instead
) => void;
readonly scrollResponderScrollNativeHandleToKeyboard: (
+scrollResponderScrollNativeHandleToKeyboard: (
nodeHandle: number | HostInstance,
additionalOffset?: number,
preventNegativeScrollOffset?: boolean,
@@ -16,20 +16,20 @@ import * as React from 'react';
type ScrollViewNativeComponentType = HostComponent<{...}>;
interface NativeCommands {
readonly flashScrollIndicators: (
+flashScrollIndicators: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
) => void;
readonly scrollTo: (
+scrollTo: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
x: Double,
y: Double,
animated: boolean,
) => void;
readonly scrollToEnd: (
+scrollToEnd: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
animated: boolean,
) => void;
readonly zoomToRect: (
+zoomToRect: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
rect: {
x: Double,
@@ -40,7 +40,7 @@ export type ScrollViewStickyHeaderProps = Readonly<{
}>;
interface Instance extends React.ElementRef<typeof Animated.View> {
readonly setNextHeaderY: number => void;
+setNextHeaderY: number => void;
}
const ScrollViewStickyHeader: component(
@@ -78,7 +78,7 @@ import * as React from 'react';
/** @build-types emit-as-interface Expo compatibility */
export type InputAccessoryViewProps = Readonly<{
readonly children: React.Node,
+children: React.Node,
/**
* An ID which is used to associate this `InputAccessoryView` to
* specified TextInput(s).
@@ -13,9 +13,9 @@ import type {Int32} from '../../Types/CodegenTypes';
import * as React from 'react';
export interface TextInputNativeCommands<T> {
readonly focus: (viewRef: React.ElementRef<T>) => void;
readonly blur: (viewRef: React.ElementRef<T>) => void;
readonly setTextAndSelection: (
+focus: (viewRef: React.ElementRef<T>) => void;
+blur: (viewRef: React.ElementRef<T>) => void;
+setTextAndSelection: (
viewRef: React.ElementRef<T>,
mostRecentEventCount: Int32,
value: ?string, // in theory this is nullable
@@ -25,16 +25,16 @@ import Position from './Position';
import * as React from 'react';
const extractSingleTouch = (nativeEvent: {
readonly changedTouches: ReadonlyArray<GestureResponderEvent['nativeEvent']>,
readonly force?: number,
readonly identifier: number,
readonly locationX: number,
readonly locationY: number,
readonly pageX: number,
readonly pageY: number,
readonly target: ?number,
readonly timestamp: number,
readonly touches: ReadonlyArray<GestureResponderEvent['nativeEvent']>,
+changedTouches: ReadonlyArray<GestureResponderEvent['nativeEvent']>,
+force?: number,
+identifier: number,
+locationX: number,
+locationY: number,
+pageX: number,
+pageY: number,
+target: ?number,
+timestamp: number,
+touches: ReadonlyArray<GestureResponderEvent['nativeEvent']>,
}) => {
const touches = nativeEvent.touches;
const changedTouches = nativeEvent.changedTouches;
@@ -21,10 +21,10 @@ const ViewNativeComponent: HostComponent<Props> =
}));
interface NativeCommands {
readonly focus: (viewRef: HostInstance) => void;
readonly blur: (viewRef: HostInstance) => void;
readonly hotspotUpdate: (viewRef: HostInstance, x: number, y: number) => void;
readonly setPressed: (viewRef: HostInstance, pressed: boolean) => void;
+focus: (viewRef: HostInstance) => void;
+blur: (viewRef: HostInstance) => void;
+hotspotUpdate: (viewRef: HostInstance, x: number, y: number) => void;
+setPressed: (viewRef: HostInstance, pressed: boolean) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -13,9 +13,9 @@ import type {ExtendedError} from './ExtendedError';
import ExceptionsManager, {SyntheticError} from './ExceptionsManager';
export type CapturedError = {
readonly componentStack: string,
readonly error: unknown,
readonly errorBoundary: ?{...},
+componentStack: string,
+error: unknown,
+errorBoundary: ?{...},
...
};
@@ -11,11 +11,11 @@
'use strict';
export type ResolvedAssetSource = {
readonly __packager_asset: boolean,
readonly width: ?number,
readonly height: ?number,
readonly uri: string,
readonly scale: number,
+__packager_asset: boolean,
+width: ?number,
+height: ?number,
+uri: string,
+scale: number,
};
// From @react-native/assets-registry
+9 -9
View File
@@ -21,32 +21,32 @@ export interface ImageURISource {
* resource (which should be wrapped in the `require('./path/to/image.png')`
* function).
*/
readonly uri?: ?string;
+uri?: ?string;
/**
* `bundle` is the iOS asset bundle which the image is included in. This
* will default to [NSBundle mainBundle] if not set.
* @platform ios
*/
readonly bundle?: ?string;
+bundle?: ?string;
/**
* `method` is the HTTP Method to use. Defaults to GET if not specified.
*/
readonly method?: ?string;
+method?: ?string;
/**
* `headers` is an object representing the HTTP headers to send along with the
* request for a remote image.
*/
readonly headers?: ?{[string]: string};
+headers?: ?{[string]: string};
/**
* `body` is the HTTP body to send with the request. This must be a valid
* UTF-8 string, and will be sent exactly as specified, with no
* additional encoding (e.g. URL-escaping or base64) applied.
*/
readonly body?: ?string;
+body?: ?string;
/**
* `cache` determines how the requests handles potentially cached
@@ -66,20 +66,20 @@ export interface ImageURISource {
* to a URL load request, no attempt is made to load the data from the originating source,
* and the load is considered to have failed.
*/
readonly cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached');
+cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached');
/**
* `width` and `height` can be specified if known at build time, in which case
* these will be used to set the default `<Image/>` component dimensions.
*/
readonly width?: ?number;
readonly height?: ?number;
+width?: ?number;
+height?: ?number;
/**
* `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if
* unspecified, meaning that one image pixel equates to one display point / DIP.
*/
readonly scale?: ?number;
+scale?: ?number;
}
export type ImageRequireSource = number;
+4 -4
View File
@@ -26,10 +26,10 @@ export type ImageSourceHeaders = {
export function getImageSourcesFromImageProps(imageProps: ImageProps):
| ?ResolvedAssetSource
| ReadonlyArray<{
readonly uri: string,
readonly headers: ImageSourceHeaders,
readonly width: ?number,
readonly height: ?number,
+uri: string,
+headers: ImageSourceHeaders,
+width: ?number,
+height: ?number,
...
}> {
let source = resolveAssetSource(imageProps.source);
@@ -45,7 +45,7 @@ type ImageHostComponentProps = Readonly<{
}>;
interface NativeCommands {
readonly setIsVisible_EXPERIMENTAL: (
+setIsVisible_EXPERIMENTAL: (
viewRef: HostInstance,
isVisible: boolean,
time: number,
Loaded 100 of 232 files, more files were not shown because too many files have changed in this diff. Show more