Fix a few readonly 10/n (#56948)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56948

```
js1 flow-runner codemod flow/transformAllVariance --variance readonly --format-files=false
```

drop-conflicts

landed-with-radar-review

Reviewed By: SamChou19815

Differential Revision: D106144499

fbshipit-source-id: 85493334eae630d3dec7e5920633c076f8f09729
This commit is contained in:
Marco Wang authored and meta-codesync[bot] committed 2026-05-22 22:27:46 -07:00
1 parent 0676eb63a2
commit 09fc0432d1
193 files changed
+1473 -1312

No files matched your search

@@ -28,99 +28,104 @@ export type ReservedPrimitiveName =
| 'DimensionPrimitive';
type CppTypeInfo = {
+typeName: string,
+localIncludes: ReadonlyArray<string>,
+conversionIncludes: ReadonlyArray<string>,
readonly typeName: string,
readonly localIncludes: ReadonlyArray<string>,
readonly conversionIncludes: ReadonlyArray<string>,
};
type JavaImportInfo = {
+interfaceImports: ReadonlyArray<string>,
+delegateImports: ReadonlyArray<string>,
readonly interfaceImports: ReadonlyArray<string>,
readonly delegateImports: ReadonlyArray<string>,
};
type ReservedTypeMapping = {
+cpp: CppTypeInfo,
+java: JavaImportInfo,
readonly cpp: CppTypeInfo,
readonly java: JavaImportInfo,
};
const RESERVED_TYPES: {+[ReservedPrimitiveName]: ReservedTypeMapping} = {
ColorPrimitive: {
cpp: {
typeName: 'SharedColor',
localIncludes: ['#include <react/renderer/graphics/Color.h>'],
conversionIncludes: [],
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;',
],
},
},
java: {
interfaceImports: [],
delegateImports: ['import com.facebook.react.bridge.ColorPropConverter;'],
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;'],
},
},
},
ImageSourcePrimitive: {
cpp: {
typeName: 'ImageSource',
localIncludes: ['#include <react/renderer/imagemanager/primitives.h>'],
conversionIncludes: [
'#include <react/renderer/components/image/conversions.h>',
],
ImageRequestPrimitive: {
cpp: {
typeName: 'ImageRequest',
localIncludes: [
'#include <react/renderer/imagemanager/ImageRequest.h>',
],
conversionIncludes: [],
},
java: {
// ImageRequestPrimitive is not used in Java component props
interfaceImports: [],
delegateImports: [],
},
},
java: {
interfaceImports: ['import com.facebook.react.bridge.ReadableMap;'],
delegateImports: ['import com.facebook.react.bridge.ReadableMap;'],
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;'],
},
},
},
ImageRequestPrimitive: {
cpp: {
typeName: 'ImageRequest',
localIncludes: ['#include <react/renderer/imagemanager/ImageRequest.h>'],
conversionIncludes: [],
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;'],
},
},
java: {
// ImageRequestPrimitive is not used in Java component props
interfaceImports: [],
delegateImports: [],
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;',
],
},
},
},
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
| {
+default: string,
+options: ReadonlyArray<string>,
+type: 'StringEnumTypeAnnotation',
readonly default: string,
readonly options: ReadonlyArray<string>,
readonly type: 'StringEnumTypeAnnotation',
}
| {
+elementType: ObjectTypeAnnotation<PropTypeAnnotation>,
+type: 'ArrayTypeAnnotation',
readonly elementType: ObjectTypeAnnotation<PropTypeAnnotation>,
readonly type: 'ArrayTypeAnnotation',
},
},
nameParts: ReadonlyArray<string>,
+1 -1
View File
@@ -128,7 +128,7 @@ class UnsupportedModulePropertyParserError extends ParserError {
}
class UnsupportedTypeAnnotationParserError extends ParserError {
+typeAnnotationType: string;
readonly typeAnnotationType: string;
constructor(
nativeModuleName: string,
typeAnnotation: $FlowFixMe,
@@ -91,53 +91,83 @@ type CustomObj = {foo: string, bar: number};
type CustomObj2 = {a: Int32, b: string};
interface NativeCommands {
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
+methodIntString: (
readonly methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
readonly methodIntString: (
viewRef: React.ElementRef<NativeType>,
a: Int32,
b: string,
) => 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 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;
+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 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;
+methodIntArray: (
readonly methodIntArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<Int32>,
) => void;
+methodStringArray: (
readonly methodStringArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<string>,
) => void;
+methodBoolArray: (
readonly methodBoolArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<boolean>,
) => void;
+methodFloatArray: (
readonly methodFloatArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<Float>,
) => void;
+methodDoubleArray: (
readonly methodDoubleArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<Double>,
) => void;
+methodCustomObjArray: (
readonly methodCustomObjArray: (
viewRef: React.ElementRef<NativeType>,
a: Array<CustomObj>,
) => void;
+methodCustomObj2Array: (
readonly methodCustomObj2Array: (
viewRef: React.ElementRef<NativeType>,
a: Array<CustomObj2>,
) => void;
+methodRootTag: (viewRef: React.ElementRef<NativeType>, a: RootTag) => void;
readonly methodRootTag: (
viewRef: React.ElementRef<NativeType>,
a: RootTag,
) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -26,20 +26,23 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Array<Int32>) => void;
+methodString: (
readonly methodInt: (
viewRef: React.ElementRef<NativeType>,
a: Array<Int32>,
) => void;
readonly methodString: (
viewRef: React.ElementRef<NativeType>,
a: Array<string>,
) => void;
+methodBool: (
readonly methodBool: (
viewRef: React.ElementRef<NativeType>,
a: Array<boolean>,
) => void;
+methodFloat: (
readonly methodFloat: (
viewRef: React.ElementRef<NativeType>,
a: Array<Float>,
) => void;
+methodDouble: (
readonly methodDouble: (
viewRef: React.ElementRef<NativeType>,
a: Array<Double>,
) => void;
@@ -26,11 +26,23 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
+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;
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;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -21,7 +21,10 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
+methodInt: (viewRef: React.ElementRef<NativeType>, a: string) => void;
readonly 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 {
+methodInt: (
readonly methodInt: (
viewRef: React.ElementRef<NativeType>,
a: Int32,
b: string,
@@ -22,8 +22,11 @@ type NativeProps = Readonly<{
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
+methodString: (viewRef: React.ElementRef<NativeType>, a: string) => void;
readonly methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
readonly 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 {
+methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
readonly methodInt: (viewRef: React.ElementRef<NativeType>, a: Int32) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -21,13 +21,11 @@ type BeforeMatchingGeneric<T> = {||};
type AfterMatchingGeneric<T> = {||};
export interface Spec extends TurboModule {
+simpleObject: (a: SimpleObject) => void;
+beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
readonly simpleObject: (a: SimpleObject) => void;
readonly beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
+beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
+afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
readonly beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
readonly afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
}
TurboModuleRegistry.getEnforcing<Spec>(
'NativeModuleTest',
) as Spec;
TurboModuleRegistry.getEnforcing<Spec>('NativeModuleTest') as Spec;
@@ -44,34 +44,32 @@ type SimpleArray = Array<string>;
type SimpleArrayChange = Array<string>;
export interface Spec extends TurboModule {
+exampleFunction: (a: SimpleObject) => void;
+simpleObject: (a: SimpleObject) => void;
+beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
+afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
readonly exampleFunction: (a: SimpleObject) => void;
readonly simpleObject: (a: SimpleObject) => void;
readonly beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
readonly afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
+beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
+afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
readonly beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
readonly afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
+booleanType: (a: BooleanType) => void;
+stringType: (a: StringType) => void;
readonly booleanType: (a: BooleanType) => void;
readonly stringType: (a: StringType) => void;
+simpleFunction: (a: string) => string;
+simpleFunction2: (a: string) => number;
+simpleFunction3: (foo: string) => string;
+simpleFunction4: (a: number) => string;
readonly simpleFunction: (a: string) => string;
readonly simpleFunction2: (a: string) => number;
readonly simpleFunction3: (foo: string) => string;
readonly simpleFunction4: (a: number) => string;
+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 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;
+simpleArray: (a: SimpleArray) => void;
+simpleArrayChange: (a: SimpleArrayChange) => void;
}
readonly simpleArray: (a: SimpleArray) => void;
readonly simpleArrayChange: (a: SimpleArrayChange) => void;
}
TurboModuleRegistry.getEnforcing<Spec>(
'NativeModuleTest',
) as Spec;
TurboModuleRegistry.getEnforcing<Spec>('NativeModuleTest') as Spec;
@@ -36,37 +36,34 @@ type SimpleUnion4 = BooleanType | StringType | SimpleObject;
type SimpleArray = Array<string>;
type SimpleArrayChange = Array<number>;
export interface Spec extends TurboModule {
+exampleFunction: (a: SimpleObject) => void;
+simpleObject: (a: SimpleObject) => void;
+beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
+afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
readonly exampleFunction: (a: SimpleObject) => void;
readonly simpleObject: (a: SimpleObject) => void;
readonly beforeMismatchGeneric: <T>(a: BeforeMismatchGeneric<T>) => void;
readonly afterMismatchGeneric: <Foo>(a: AfterMismatchGeneric<Foo>) => void;
+beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
+afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
readonly beforeMatchingGeneric: <T>(a: BeforeMatchingGeneric<T>) => void;
readonly afterMatchingGeneric: <T>(a: AfterMatchingGeneric<T>) => void;
+arrayBufferType: (a: ArrayBufferType) => void;
+booleanType: (a: BooleanType) => void;
+stringType: (a: StringType) => void;
readonly arrayBufferType: (a: ArrayBufferType) => void;
readonly booleanType: (a: BooleanType) => void;
readonly stringType: (a: StringType) => void;
+simpleFunction: (a: string) => string;
+simpleFunction2: (a: string) => number;
+simpleFunction3: (foo: string) => string;
+simpleFunction4: (a: number) => string;
readonly simpleFunction: (a: string) => string;
readonly simpleFunction2: (a: string) => number;
readonly simpleFunction3: (foo: string) => string;
readonly simpleFunction4: (a: number) => string;
+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 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;
+simpleArray: (a: SimpleArray) => void;
+simpleArrayChange: (a: SimpleArrayChange) => void;
readonly simpleArray: (a: SimpleArray) => void;
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: string,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => Readonly<{
readonly exampleFunction: (a: string, b: number) => void;
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+constant?: string,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => Readonly<{
readonly exampleFunction: (a: string, b: number) => void;
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+constant: string,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => Readonly<{}>;
readonly exampleFunction: (a: string, b: number) => void;
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {};
readonly exampleFunction: (a: string, b: number) => void;
readonly 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 {
+exampleFunction: (a: MyType, b: number) => void;
readonly 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 {
+exampleFunction: (a: MyType, b: number) => void;
readonly 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 {
+exampleFunction: (
readonly exampleFunction: (
a: {
a1: string,
a2: number,
@@ -22,8 +22,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
+getConstants: () => {
+exampleConstant: string,
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (
readonly exampleFunction: (
a: ?{
a1: string,
a2?: number,
@@ -22,8 +22,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
+getConstants: () => {
+exampleConstant: string,
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (
readonly exampleFunction: (
a: {
a1: string,
a2?: number,
@@ -22,8 +22,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
+getConstants: () => {
+exampleConstant: string,
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (
readonly exampleFunction: (
a: {
a1: string,
a2: number,
@@ -21,8 +21,8 @@ export interface Spec extends TurboModule {
},
b: number,
) => void;
+getConstants: () => {
+exampleConstant: string,
readonly getConstants: () => {
readonly exampleConstant: string,
};
}
@@ -170,55 +170,63 @@ enum EnumUnsorted {
}
export interface Spec extends TurboModule {
+stringLiteral0: (a: StringLiteral0) => void;
+stringLiteral1: (a: StringLiteral1) => void;
readonly stringLiteral0: (a: StringLiteral0) => void;
readonly stringLiteral1: (a: StringLiteral1) => void;
+booleanLiteral0: (a: BooleanLiteral0) => void;
+booleanLiteral1: (a: BooleanLiteral1) => void;
readonly booleanLiteral0: (a: BooleanLiteral0) => void;
readonly booleanLiteral1: (a: BooleanLiteral1) => void;
+numericLiteral0: (a: NumericLiteral0) => void;
+numericLiteral1: (a: NumericLiteral1) => void;
readonly numericLiteral0: (a: NumericLiteral0) => void;
readonly numericLiteral1: (a: NumericLiteral1) => void;
+stringLiteralUnion0: (a: StringLiteralUnion0) => void;
+stringLiteralUnion1: (a: StringLiteralUnion1) => void;
+stringLiteralUnion2: (a: StringLiteralUnion2) => void;
readonly stringLiteralUnion0: (a: StringLiteralUnion0) => void;
readonly stringLiteralUnion1: (a: StringLiteralUnion1) => void;
readonly stringLiteralUnion2: (a: StringLiteralUnion2) => void;
+referenceType: (a: ReferenceType) => void;
+referenceType2: (a: ReferenceType2) => void;
+referenceType3: (a: ReferenceType3) => void;
readonly referenceType: (a: ReferenceType) => void;
readonly referenceType2: (a: ReferenceType2) => void;
readonly referenceType3: (a: ReferenceType3) => void;
+referenceGeneric: <T>(a: ReferenceGeneric<T>) => void;
+referenceGeneric2: <T, X>(a: ReferenceGeneric2<T, X>) => void;
readonly referenceGeneric: <T>(a: ReferenceGeneric<T>) => void;
readonly referenceGeneric2: <T, X>(a: ReferenceGeneric2<T, X>) => 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 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;
+mapWithKey: (a: MapWithKey) => void;
+mapWithKey2: (a: MapWithKey2) => void;
readonly mapWithKey: (a: MapWithKey) => void;
readonly mapWithKey2: (a: MapWithKey2) => void;
+enum: (a: Enum) => void;
+enumWithTypeChange: (a: EnumWithTypeChange) => void;
+enumWithRemoval: (a: EnumWithRemoval) => void;
+enumWithValueChange: (a: EnumWithValueChange) => void;
+enumUnsorted: (a: EnumUnsorted) => 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;
}
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 {
+exampleFunction: (a: {[key: string]: string}, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: {[key: string]: string}, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: {[key: string]: number}, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: {[key: string]: number}, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -20,9 +20,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -20,9 +20,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: TestEnum,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: TestEnum,
};
}
@@ -20,9 +20,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -19,9 +19,9 @@ enum TestEnum {
}
export interface Spec extends TurboModule {
+exampleFunction: (a: TestEnum, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: TestEnum, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: string, b: number, c?: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: string, b: number, c?: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -16,9 +16,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type BooleanUnion = true | false;
export interface Spec extends TurboModule {
+exampleFunction: (a: BooleanUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: BooleanUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -15,9 +15,9 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo
type BooleanUnion = true;
export interface Spec extends TurboModule {
+exampleFunction: (a: BooleanUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: BooleanUnion, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: testUnion,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: testUnion,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: NumberUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: NumberUnion, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: NumberUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: NumberUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -30,9 +30,9 @@ type ObjectC = {|
type ObjectUnion = ObjectA | ObjectB | ObjectC;
export interface Spec extends TurboModule {
+exampleFunction: (a: ObjectUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: ObjectUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -26,9 +26,9 @@ type ObjectB = {|
type ObjectUnion = ObjectA | ObjectB;
export interface Spec extends TurboModule {
+exampleFunction: (a: ObjectUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: ObjectUnion, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -25,9 +25,9 @@ type ObjectB = {|
type ObjectUnion = ObjectA | ObjectB;
export interface Spec extends TurboModule {
+exampleFunction: (a: ObjectUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: ObjectUnion, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: testUnion, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: testUnion, b: number) => void;
readonly getConstants: () => {
readonly 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 {
+exampleFunction: (a: string, b: number) => void;
+getConstants: () => {
+exampleConstant: number,
readonly exampleFunction: (a: string, b: number) => void;
readonly getConstants: () => {
readonly exampleConstant: number,
};
}
@@ -28,7 +28,7 @@ type PopupMenuSelectionEvent = NativeSyntheticEvent<
type PopupMenuDismissEvent = NativeSyntheticEvent<Readonly<{}>>;
export type PopupMenuAndroidInstance = {
+show: () => void,
readonly show: () => void,
};
type Props = {
@@ -37,7 +37,7 @@ const styles = StyleSheet.create({
});
export type PopupMenuAndroidInstance = {
+show: () => void,
readonly show: () => void,
};
type Props = {
@@ -38,7 +38,7 @@ type NativeProps = Readonly<{
type ComponentType = HostComponent<NativeProps>;
interface NativeCommands {
+show: (viewRef: React.ElementRef<ComponentType>) => void;
readonly show: (viewRef: React.ElementRef<ComponentType>) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -30,18 +30,18 @@ export type AnimatedColorConfig = Readonly<{
type ColorListenerCallback = (value: ColorValue) => unknown;
export type RgbaValue = {
+r: number,
+g: number,
+b: number,
+a: number,
readonly r: number,
readonly g: number,
readonly b: number,
readonly a: number,
...
};
type RgbaAnimatedValue = {
+r: AnimatedValue,
+g: AnimatedValue,
+b: AnimatedValue,
+a: AnimatedValue,
readonly r: AnimatedValue,
readonly g: AnimatedValue,
readonly b: AnimatedValue,
readonly a: AnimatedValue,
...
};
@@ -30,7 +30,7 @@ export type AnimatedPropsAllowlist = Readonly<{
}>;
type TargetView = {
+instance: TargetViewInstance,
readonly instance: TargetViewInstance,
connectedViewTag: ?number,
};
type TargetViewInstance = React.ElementRef<React.ElementType>;
@@ -45,8 +45,8 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
constructor(
valueIn?: ?{
+x: number | AnimatedValue,
+y: number | AnimatedValue,
readonly x: number | AnimatedValue,
readonly y: number | AnimatedValue,
...
},
config?: ?AnimatedValueXYConfig,
@@ -10,7 +10,7 @@
declare export class URLSearchParams {
_searchParams: Array<[string, string]>;
+size: number;
readonly 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 {
+getScrollResponder: () => ScrollResponderType;
+getScrollableNode: () => ?number;
+getInnerViewNode: () => ?number;
+getInnerViewRef: () => InnerViewInstance | null;
+getNativeScrollRef: () => PublicScrollViewInstance | null;
+scrollTo: (
readonly getScrollResponder: () => ScrollResponderType;
readonly getScrollableNode: () => ?number;
readonly getInnerViewNode: () => ?number;
readonly getInnerViewRef: () => InnerViewInstance | null;
readonly getNativeScrollRef: () => PublicScrollViewInstance | null;
readonly scrollTo: (
options?: ScrollViewScrollToOptions | number,
deprecatedX?: number,
deprecatedAnimated?: boolean,
) => void;
+scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void;
+flashScrollIndicators: () => void;
+scrollResponderZoomTo: (
readonly scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void;
readonly flashScrollIndicators: () => void;
readonly scrollResponderZoomTo: (
rect: {
x: number,
y: number,
@@ -157,7 +157,7 @@ export interface ScrollViewImperativeMethods {
},
animated?: boolean, // deprecated, put this inside the rect argument instead
) => void;
+scrollResponderScrollNativeHandleToKeyboard: (
readonly scrollResponderScrollNativeHandleToKeyboard: (
nodeHandle: number | HostInstance,
additionalOffset?: number,
preventNegativeScrollOffset?: boolean,
@@ -16,20 +16,20 @@ import * as React from 'react';
type ScrollViewNativeComponentType = HostComponent<{...}>;
interface NativeCommands {
+flashScrollIndicators: (
readonly flashScrollIndicators: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
) => void;
+scrollTo: (
readonly scrollTo: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
x: Double,
y: Double,
animated: boolean,
) => void;
+scrollToEnd: (
readonly scrollToEnd: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
animated: boolean,
) => void;
+zoomToRect: (
readonly zoomToRect: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
rect: {
x: Double,
@@ -40,7 +40,7 @@ export type ScrollViewStickyHeaderProps = Readonly<{
}>;
interface Instance extends React.ElementRef<typeof Animated.View> {
+setNextHeaderY: number => void;
readonly 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<{
+children: React.Node,
readonly 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> {
+focus: (viewRef: React.ElementRef<T>) => void;
+blur: (viewRef: React.ElementRef<T>) => void;
+setTextAndSelection: (
readonly focus: (viewRef: React.ElementRef<T>) => void;
readonly blur: (viewRef: React.ElementRef<T>) => void;
readonly 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: {
+changedTouches: ReadonlyArray<GestureResponderEvent['nativeEvent']>,
+force?: number,
+identifier: number,
+locationX: number,
+locationY: number,
+pageX: number,
+pageY: number,
+target: ?number,
+timestamp: number,
+touches: ReadonlyArray<GestureResponderEvent['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']>,
}) => {
const touches = nativeEvent.touches;
const changedTouches = nativeEvent.changedTouches;
@@ -21,10 +21,10 @@ const ViewNativeComponent: HostComponent<Props> =
}));
interface NativeCommands {
+focus: (viewRef: HostInstance) => void;
+blur: (viewRef: HostInstance) => void;
+hotspotUpdate: (viewRef: HostInstance, x: number, y: number) => void;
+setPressed: (viewRef: HostInstance, pressed: boolean) => void;
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;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -13,9 +13,9 @@ import type {ExtendedError} from './ExtendedError';
import ExceptionsManager, {SyntheticError} from './ExceptionsManager';
export type CapturedError = {
+componentStack: string,
+error: unknown,
+errorBoundary: ?{...},
readonly componentStack: string,
readonly error: unknown,
readonly errorBoundary: ?{...},
...
};
@@ -11,11 +11,11 @@
'use strict';
export type ResolvedAssetSource = {
+__packager_asset: boolean,
+width: ?number,
+height: ?number,
+uri: string,
+scale: number,
readonly __packager_asset: boolean,
readonly width: ?number,
readonly height: ?number,
readonly uri: string,
readonly 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).
*/
+uri?: ?string;
readonly 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
*/
+bundle?: ?string;
readonly bundle?: ?string;
/**
* `method` is the HTTP Method to use. Defaults to GET if not specified.
*/
+method?: ?string;
readonly method?: ?string;
/**
* `headers` is an object representing the HTTP headers to send along with the
* request for a remote image.
*/
+headers?: ?{[string]: string};
readonly 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.
*/
+body?: ?string;
readonly 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.
*/
+cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached');
readonly 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.
*/
+width?: ?number;
+height?: ?number;
readonly width?: ?number;
readonly 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.
*/
+scale?: ?number;
readonly scale?: ?number;
}
export type ImageRequireSource = number;
+4 -4
View File
@@ -26,10 +26,10 @@ export type ImageSourceHeaders = {
export function getImageSourcesFromImageProps(imageProps: ImageProps):
| ?ResolvedAssetSource
| ReadonlyArray<{
+uri: string,
+headers: ImageSourceHeaders,
+width: ?number,
+height: ?number,
readonly uri: string,
readonly headers: ImageSourceHeaders,
readonly width: ?number,
readonly height: ?number,
...
}> {
let source = resolveAssetSource(imageProps.source);
@@ -45,7 +45,7 @@ type ImageHostComponentProps = Readonly<{
}>;
interface NativeCommands {
+setIsVisible_EXPERIMENTAL: (
readonly setIsVisible_EXPERIMENTAL: (
viewRef: HostInstance,
isVisible: boolean,
time: number,
@@ -43,9 +43,9 @@ export function createViewConfig(
}
function composeIndexers<T>(
maybeA: ?{+[string]: T},
maybeB: ?{+[string]: T},
): {+[string]: T} {
maybeA: ?{readonly [string]: T},
maybeB: ?{readonly [string]: T},
): {readonly [string]: T} {
return maybeA == null || maybeB == null
? (maybeA ?? maybeB ?? {})
: {...maybeA, ...maybeB};
@@ -37,7 +37,7 @@ export function DynamicallyInjectedByGestureHandler<T extends {...}>(
* TODO(T110872225): Remove this logic, after achieving platform-consistency
*/
export function ConditionallyIgnoredEventHandlers<
const T extends {+[name: string]: true},
const T extends {readonly [name: string]: true},
>(value: T): T | void {
if (Platform.OS === 'ios') {
return value;
@@ -44,7 +44,9 @@ if (reactDevToolsHook) {
type ExternalInspection = {
externalInspectingEnabled: boolean,
+reportToExternalInspection: (viewData: TouchedViewDataAtPoint) => void,
readonly reportToExternalInspection: (
viewData: TouchedViewDataAtPoint,
) => void,
};
type InspectorDeferredProps = {
+1 -1
View File
@@ -12,7 +12,7 @@ export opaque type DisplayModeType = number;
/** DisplayMode should be in sync with the method displayModeToInt from
* react/renderer/uimanager/primitives.h. */
const DisplayMode: {+[string]: DisplayModeType} = Object.freeze({
const DisplayMode: {readonly [string]: DisplayModeType} = Object.freeze({
VISIBLE: 1,
SUSPENDED: 2,
HIDDEN: 3,
@@ -28,62 +28,65 @@ import defineLazyObjectProperty from '../Utilities/defineLazyObjectProperty';
export type NodeSet = Array<Node>;
export type NodeProps = {...};
export interface Spec {
+createNode: (
readonly createNode: (
reactTag: number,
viewName: string,
rootTag: RootTag,
props: NodeProps,
instanceHandle: InternalInstanceHandle,
) => Node;
+cloneNode: (node: Node) => Node;
+cloneNodeWithNewChildren: (node: Node) => Node;
+cloneNodeWithNewProps: (node: Node, newProps: NodeProps) => Node;
+cloneNodeWithNewChildrenAndProps: (node: Node, newProps: NodeProps) => Node;
+createChildSet: (rootTag: RootTag) => NodeSet;
+appendChild: (parentNode: Node, child: Node) => Node;
+appendChildToSet: (childSet: NodeSet, child: Node) => void;
+completeRoot: (rootTag: RootTag, childSet: NodeSet) => void;
+measure: (
readonly cloneNode: (node: Node) => Node;
readonly cloneNodeWithNewChildren: (node: Node) => Node;
readonly cloneNodeWithNewProps: (node: Node, newProps: NodeProps) => Node;
readonly cloneNodeWithNewChildrenAndProps: (
node: Node,
newProps: NodeProps,
) => Node;
readonly createChildSet: (rootTag: RootTag) => NodeSet;
readonly appendChild: (parentNode: Node, child: Node) => Node;
readonly appendChildToSet: (childSet: NodeSet, child: Node) => void;
readonly completeRoot: (rootTag: RootTag, childSet: NodeSet) => void;
readonly measure: (
node: Node | NativeElementReference,
callback: MeasureOnSuccessCallback,
) => void;
+measureInWindow: (
readonly measureInWindow: (
node: Node | NativeElementReference,
callback: MeasureInWindowOnSuccessCallback,
) => void;
+measureLayout: (
readonly measureLayout: (
node: Node | NativeElementReference,
relativeNode: Node | NativeElementReference,
onFail: () => void,
onSuccess: MeasureLayoutOnSuccessCallback,
) => void;
+configureNextLayoutAnimation: (
readonly configureNextLayoutAnimation: (
config: LayoutAnimationConfig,
callback: () => void, // check what is returned here
errorCallback: () => void,
) => void;
+sendAccessibilityEvent: (node: Node, eventType: string) => void;
+findShadowNodeByTag_DEPRECATED: (reactTag: number) => ?Node;
+setNativeProps: (
readonly sendAccessibilityEvent: (node: Node, eventType: string) => void;
readonly findShadowNodeByTag_DEPRECATED: (reactTag: number) => ?Node;
readonly setNativeProps: (
node: Node | NativeElementReference,
newProps: NodeProps,
) => void;
+dispatchCommand: (
readonly dispatchCommand: (
node: Node,
commandName: string,
args: Array<unknown>,
) => void;
+findNodeAtPoint: (
readonly findNodeAtPoint: (
node: Node,
locationX: number,
locationY: number,
callback: (instanceHandle: ?InternalInstanceHandle) => void,
) => void;
+compareDocumentPosition: (
readonly compareDocumentPosition: (
node: Node | NativeElementReference,
otherNode: Node | NativeElementReference,
) => number;
+getBoundingClientRect: (
readonly getBoundingClientRect: (
node: Node | NativeElementReference,
includeTransform: boolean,
) => ?[
@@ -92,16 +95,16 @@ export interface Spec {
/* width: */ number,
/* height: */ number,
];
+setIsJSResponder: (
readonly setIsJSResponder: (
node: Node | NativeElementReference,
isJSResponder: boolean,
blockNativeResponder: boolean,
) => void;
+unstable_DefaultEventPriority: number;
+unstable_DiscreteEventPriority: number;
+unstable_ContinuousEventPriority: number;
+unstable_IdleEventPriority: number;
+unstable_getCurrentEventPriority: () => number;
readonly unstable_DefaultEventPriority: number;
readonly unstable_DiscreteEventPriority: number;
readonly unstable_ContinuousEventPriority: number;
readonly unstable_IdleEventPriority: number;
readonly unstable_getCurrentEventPriority: () => number;
}
let nativeFabricUIManagerProxy: ?Spec;
@@ -1092,7 +1092,7 @@ export type ____ImageStyleProp_Internal = StyleProp<
export type ____Styles_Internal = {
// $FlowFixMe[incompatible-exact]
// $FlowFixMe[incompatible-type]
+[key: string]: Partial<____DangerouslyImpreciseStyle_Internal>,
readonly [key: string]: Partial<____DangerouslyImpreciseStyle_Internal>,
...
};
@@ -51,29 +51,31 @@ export type ____TransformStyle_Internal = Readonly<{
Readonly<
MaximumOneOf<
MergeUnion<
| {+perspective: number | AnimatedNode}
| {+rotate: string | AnimatedNode}
| {+rotateX: string | AnimatedNode}
| {+rotateY: string | AnimatedNode}
| {+rotateZ: string | AnimatedNode}
| {+scale: number | AnimatedNode}
| {+scaleX: number | AnimatedNode}
| {+scaleY: number | AnimatedNode}
| {+translateX: number | string | AnimatedNode}
| {+translateY: number | string | AnimatedNode}
| {readonly perspective: number | AnimatedNode}
| {readonly rotate: string | AnimatedNode}
| {readonly rotateX: string | AnimatedNode}
| {readonly rotateY: string | AnimatedNode}
| {readonly rotateZ: string | AnimatedNode}
| {readonly scale: number | AnimatedNode}
| {readonly scaleX: number | AnimatedNode}
| {readonly scaleY: number | AnimatedNode}
| {readonly translateX: number | string | AnimatedNode}
| {readonly translateY: number | string | AnimatedNode}
| {
+translate:
readonly translate:
| [
number | string | AnimatedNode,
number | string | AnimatedNode,
]
| AnimatedNode,
}
| {+skewX: string | AnimatedNode}
| {+skewY: string | AnimatedNode}
| {readonly skewX: string | AnimatedNode}
| {readonly skewY: string | AnimatedNode}
// TODO: what is the actual type it expects?
| {
+matrix: ReadonlyArray<number | AnimatedNode> | AnimatedNode,
readonly matrix:
| ReadonlyArray<number | AnimatedNode>
| AnimatedNode,
},
>,
>,
@@ -15,7 +15,7 @@ import * as React from 'react';
type NativeTextEffectProps = Readonly<{
effectName?: ?string,
effectProps?: ?Readonly<{+[string]: unknown}>,
effectProps?: ?Readonly<{readonly [string]: unknown}>,
children?: React.Node,
}>;
+1 -1
View File
@@ -30,7 +30,7 @@
// eslint-disable-next-line no-unused-vars
export interface DEPRECATED_RCTExport<T extends void = void> {
+getConstants?: () => {...};
readonly getConstants?: () => {...};
}
export interface TurboModule extends DEPRECATED_RCTExport<void> {}
+28 -28
View File
@@ -89,7 +89,7 @@ export interface NativeUIEvent {
/**
* Returns a long with details about the event, depending on the event type.
*/
+detail: number;
readonly detail: number;
}
/**
@@ -99,72 +99,72 @@ export interface NativeMouseEvent extends NativeUIEvent {
/**
* The X coordinate of the mouse pointer in global (screen) coordinates.
*/
+screenX: number;
readonly screenX: number;
/**
* The Y coordinate of the mouse pointer in global (screen) coordinates.
*/
+screenY: number;
readonly screenY: number;
/**
* The X coordinate of the mouse pointer relative to the whole document.
*/
+pageX: number;
readonly pageX: number;
/**
* The Y coordinate of the mouse pointer relative to the whole document.
*/
+pageY: number;
readonly pageY: number;
/**
* The X coordinate of the mouse pointer in local (DOM content) coordinates.
*/
+clientX: number;
readonly clientX: number;
/**
* The Y coordinate of the mouse pointer in local (DOM content) coordinates.
*/
+clientY: number;
readonly clientY: number;
/**
* Alias for NativeMouseEvent.clientX
*/
+x: number;
readonly x: number;
/**
* Alias for NativeMouseEvent.clientY
*/
+y: number;
readonly y: number;
/**
* Returns true if the control key was down when the mouse event was fired.
*/
+ctrlKey: boolean;
readonly ctrlKey: boolean;
/**
* Returns true if the shift key was down when the mouse event was fired.
*/
+shiftKey: boolean;
readonly shiftKey: boolean;
/**
* Returns true if the alt key was down when the mouse event was fired.
*/
+altKey: boolean;
readonly altKey: boolean;
/**
* Returns true if the meta key was down when the mouse event was fired.
*/
+metaKey: boolean;
readonly metaKey: boolean;
/**
* The button number that was pressed (if applicable) when the mouse event was fired.
*/
+button: number;
readonly button: number;
/**
* The buttons being depressed (if any) when the mouse event was fired.
*/
+buttons: number;
readonly buttons: number;
/**
* The secondary target for the event, if there is one.
*/
+relatedTarget: null | number | HostInstance;
readonly relatedTarget: null | number | HostInstance;
// offset is proposed: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
/**
* The X coordinate of the mouse pointer between that event and the padding edge of the target node
*/
+offsetX: number;
readonly offsetX: number;
/**
* The Y coordinate of the mouse pointer between that event and the padding edge of the target node
*/
+offsetY: number;
readonly offsetY: number;
}
/**
@@ -174,48 +174,48 @@ export interface NativePointerEvent extends NativeMouseEvent {
/**
* A unique identifier for the pointer causing the event.
*/
+pointerId: number;
readonly pointerId: number;
/**
* The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer
*/
+width: number;
readonly width: number;
/**
* The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
*/
+height: number;
readonly height: number;
/**
* The normalized pressure of the pointer input in the range 0 to 1, where 0 and 1 represent
* the minimum and maximum pressure the hardware is capable of detecting, respectively.
*/
+pressure: number;
readonly pressure: number;
/**
* The normalized tangential pressure of the pointer input (also known as barrel pressure or
* cylinder stress) in the range -1 to 1, where 0 is the neutral position of the control.
*/
+tangentialPressure: number;
readonly tangentialPressure: number;
/**
* The plane angle (in degrees, in the range of -90 to 90) between the Y–Z plane and the plane
* containing both the pointer (e.g. pen stylus) axis and the Y axis.
*/
+tiltX: number;
readonly tiltX: number;
/**
* The plane angle (in degrees, in the range of -90 to 90) between the X–Z plane and the plane
* containing both the pointer (e.g. pen stylus) axis and the X axis.
*/
+tiltY: number;
readonly tiltY: number;
/**
* The clockwise rotation of the pointer (e.g. pen stylus) around its major axis in degrees,
* with a value in the range 0 to 359.
*/
+twist: number;
readonly twist: number;
/**
* Indicates the device type that caused the event (mouse, pen, touch, etc.)
*/
+pointerType: string;
readonly pointerType: string;
/**
* Indicates if the pointer represents the primary pointer of this pointer type.
*/
+isPrimary: boolean;
readonly isPrimary: boolean;
}
export type PointerEvent = NativeSyntheticEvent<NativePointerEvent>;
@@ -11,6 +11,6 @@
import type {Spec} from '../ReactNative/NativeUIManager';
export interface UIManagerJSInterface extends Spec {
+getViewManagerConfig: (viewManagerName: string) => Object;
+hasViewManagerConfig: (viewManagerName: string) => boolean;
readonly getViewManagerConfig: (viewManagerName: string) => Object;
readonly hasViewManagerConfig: (viewManagerName: string) => boolean;
}
+2 -2
View File
@@ -30,14 +30,14 @@ type Appearance = {
};
let lazyState: ?{
+NativeAppearance: INativeAppearance,
readonly NativeAppearance: INativeAppearance,
// Cache the color scheme to reduce the cost of reading it between changes.
// NOTE: If `NativeAppearance` is null, this will always be null.
appearance: ?Appearance,
// NOTE: This is non-nullable to make it easier for `onChangedListener` to
// return a non-nullable `EventSubscription` value. This is not the common
// path, so we do not have to over-optimize it.
+eventEmitter: EventEmitter<{change: [Appearance]}>,
readonly eventEmitter: EventEmitter<{change: [Appearance]}>,
};
/**
@@ -63,8 +63,8 @@ RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function (nativeEvent) {
* ```
*/
type TBackHandler = {
+exitApp: () => void,
+addEventListener: (
readonly exitApp: () => void,
readonly addEventListener: (
eventName: BackPressEventName,
handler: BackPressHandler,
) => {remove: () => void, ...},
@@ -13,8 +13,8 @@
export type BackPressEventName = 'backPress' | 'hardwareBackPress';
export interface HardwareBackPressEvent {
+type: string;
+timeStamp: number;
readonly type: string;
readonly timeStamp: number;
}
type TBackHandler = {
@@ -13,10 +13,13 @@
let logListeners;
type LogListeners = {
+onDifferentFunctionsIgnored: (nameOne: ?string, nameTwo: ?string) => void,
readonly onDifferentFunctionsIgnored: (
nameOne: ?string,
nameTwo: ?string,
) => void,
};
type Options = {+unsafelyIgnoreFunctions?: boolean};
type Options = {readonly unsafelyIgnoreFunctions?: boolean};
function unstable_setLogListeners(listeners: ?LogListeners) {
logListeners = listeners;
@@ -41,9 +41,9 @@ export interface IEventEmitter<
}
interface Registration<TArgs> {
+context: unknown;
+listener: (...args: TArgs) => unknown;
+remove: () => void;
readonly context: unknown;
readonly listener: (...args: TArgs) => unknown;
readonly remove: () => void;
}
type Registry<
+42 -42
View File
@@ -114,12 +114,12 @@ declare class PerformanceEntry {
// https://w3c.github.io/user-timing/#performancemark
declare class PerformanceMark extends PerformanceEntry {
constructor(name: string, markOptions?: PerformanceMarkOptions): void;
+detail: unknown;
readonly detail: unknown;
}
// https://w3c.github.io/user-timing/#performancemeasure
declare class PerformanceMeasure extends PerformanceEntry {
+detail: unknown;
readonly detail: unknown;
}
// https://w3c.github.io/server-timing/#the-performanceservertiming-interface
@@ -207,8 +207,8 @@ declare interface EventCounts {
}
declare class Performance {
+eventCounts: EventCounts;
+timeOrigin: DOMHighResTimeStamp;
readonly eventCounts: EventCounts;
readonly timeOrigin: DOMHighResTimeStamp;
clearMarks(name?: string): void;
clearMeasures(name?: string): void;
@@ -284,7 +284,7 @@ declare class FormData {
}
declare class DOMRectReadOnly {
+bottom: number;
readonly bottom: number;
constructor(x: number, y: number, width: number, height: number): void;
static fromRect(rectangle?: {
height: number,
@@ -293,13 +293,13 @@ declare class DOMRectReadOnly {
y: number,
...
}): DOMRectReadOnly;
+height: number;
+left: number;
+right: number;
+top: number;
+width: number;
+x: number;
+y: number;
readonly height: number;
readonly left: number;
readonly right: number;
readonly top: number;
readonly width: number;
readonly x: number;
readonly y: number;
}
declare class DOMRect extends DOMRectReadOnly {
@@ -331,23 +331,23 @@ declare class MutationRecord {
// Always an empty NodeList for `attributes` and `characterData` mutations.
// React Native currently only supports `childList`, so this contains the
// added nodes for that mutation type.
+addedNodes: NodeList<Node>;
readonly addedNodes: NodeList<Node>;
// Always `null` in React Native (only `childList` mutations are supported).
+attributeName: null;
readonly attributeName: null;
// Always `null` in React Native (only `childList` mutations are supported).
+nextSibling: null;
readonly nextSibling: null;
// Always `null` in React Native (only `childList` mutations are supported,
// and `attributeOldValue`/`characterDataOldValue` are not supported).
+oldValue: null;
readonly oldValue: null;
// Always `null` in React Native (only `childList` mutations are supported).
+previousSibling: null;
readonly previousSibling: null;
// Always an empty NodeList for `attributes` and `characterData` mutations.
// React Native currently only supports `childList`, so this contains the
// removed nodes for that mutation type.
+removedNodes: NodeList<Node>;
+target: Node;
readonly removedNodes: NodeList<Node>;
readonly target: Node;
// React Native currently only supports `childList` mutations.
+type: 'childList';
readonly type: 'childList';
}
// React Native currently only supports `childList` mutations, so `childList`
@@ -355,8 +355,8 @@ declare class MutationRecord {
// `attributeOldValue`/`characterData`/`characterDataOldValue` options are not
// supported and will throw if provided.
declare type MutationObserverInit = {
+childList: true,
+subtree?: boolean,
readonly childList: true,
readonly subtree?: boolean,
...
};
@@ -372,17 +372,17 @@ declare class MutationObserver {
}
declare type IntersectionObserverEntry = {
+boundingClientRect: DOMRectReadOnly,
+intersectionRatio: number,
+intersectionRect: DOMRectReadOnly,
+isIntersecting: boolean,
readonly boundingClientRect: DOMRectReadOnly,
readonly intersectionRatio: number,
readonly intersectionRect: DOMRectReadOnly,
readonly isIntersecting: boolean,
// Always non-null in React Native.
+rootBounds: DOMRectReadOnly,
readonly rootBounds: DOMRectReadOnly,
// React Native-specific extension. Equivalent to `intersectionRatio` but
// computed against the `rnRootThreshold` root-relative thresholds.
+rnRootIntersectionRatio: number,
+target: Element,
+time: DOMHighResTimeStamp,
readonly rnRootIntersectionRatio: number,
readonly target: Element,
readonly time: DOMHighResTimeStamp,
...
};
@@ -410,12 +410,12 @@ declare class IntersectionObserver {
): void;
disconnect(): void;
observe(target: Element): void;
+root: Element | null;
+rootMargin: string;
readonly root: Element | null;
readonly rootMargin: string;
// React Native-specific extension. The thresholds expressed as a fraction of
// the root's size (set via the `rnRootThreshold` option).
+rnRootThresholds: ReadonlyArray<number> | null;
+thresholds: ReadonlyArray<number>;
readonly rnRootThresholds: ReadonlyArray<number> | null;
readonly thresholds: ReadonlyArray<number>;
unobserve(target: Element): void;
}
@@ -689,7 +689,7 @@ declare class Request {
referrer: string;
referrerPolicy: ReferrerPolicyType;
+signal: AbortSignal;
readonly signal: AbortSignal;
text(): Promise<string>;
url: string;
}
@@ -697,15 +697,15 @@ declare class Request {
declare class AbortController {
abort(reason?: $FlowFixMe): void;
constructor(): void;
+signal: AbortSignal;
readonly signal: AbortSignal;
}
declare class AbortSignal extends EventTarget {
static abort(reason?: $FlowFixMe): AbortSignal;
static any(signals: Iterable<AbortSignal>): AbortSignal;
+aborted: boolean;
readonly aborted: boolean;
onabort: (event: Event) => unknown;
+reason: $FlowFixMe;
readonly reason: $FlowFixMe;
throwIfAborted(): void;
static timeout(time: number): AbortSignal;
}
@@ -741,8 +741,8 @@ declare type FileSystemHandleKind = 'file' | 'directory';
// https://wicg.github.io/file-system-access/#api-filesystemhandle
declare class FileSystemHandle {
+kind: FileSystemHandleKind;
+name: string;
readonly kind: FileSystemHandleKind;
readonly name: string;
isSameEntry: (other: FileSystemHandle) => Promise<boolean>;
queryPermission?: (
@@ -755,7 +755,7 @@ declare class FileSystemHandle {
// https://fs.spec.whatwg.org/#api-filesystemfilehandle
declare class FileSystemFileHandle extends FileSystemHandle {
+kind: 'file';
readonly kind: 'file';
constructor(name: string): void;
@@ -768,7 +768,7 @@ declare class FileSystemFileHandle extends FileSystemHandle {
// https://fs.spec.whatwg.org/#api-filesystemdirectoryhandle
declare class FileSystemDirectoryHandle extends FileSystemHandle {
+kind: 'directory';
readonly kind: 'directory';
constructor(name: string): void;
+21 -21
View File
@@ -10,12 +10,12 @@
declare class StyleSheet {
disabled: boolean;
+href: string;
+media: MediaList;
+ownerNode: Node;
+parentStyleSheet: ?StyleSheet;
+title: string;
+type: string;
readonly href: string;
readonly media: MediaList;
readonly ownerNode: Node;
readonly parentStyleSheet: ?StyleSheet;
readonly title: string;
readonly type: string;
}
declare class StyleSheetList {
@@ -35,10 +35,10 @@ declare class MediaList {
}
declare class CSSStyleSheet extends StyleSheet {
+cssRules: CSSRuleList;
readonly cssRules: CSSRuleList;
deleteRule(index: number): void;
insertRule(rule: string, index: number): number;
+ownerRule: ?CSSRule;
readonly ownerRule: ?CSSRule;
replace(text: string): Promise<CSSStyleSheet>;
replaceSync(text: string): void;
}
@@ -56,24 +56,24 @@ declare class CSSRule {
static MEDIA_RULE: number;
static NAMESPACE_RULE: number;
static PAGE_RULE: number;
+parentRule: ?CSSRule;
+parentStyleSheet: ?CSSStyleSheet;
readonly parentRule: ?CSSRule;
readonly parentStyleSheet: ?CSSStyleSheet;
static REGION_STYLE_RULE: number;
static STYLE_RULE: number;
static SUPPORTS_RULE: number;
+type: number;
readonly type: number;
static UNKNOWN_RULE: number;
static VIEWPORT_RULE: number;
}
declare class CSSKeyframeRule extends CSSRule {
keyText: string;
+style: CSSStyleDeclaration;
readonly style: CSSStyleDeclaration;
}
declare class CSSKeyframesRule extends CSSRule {
appendRule(rule: string): void;
+cssRules: CSSRuleList;
readonly cssRules: CSSRuleList;
deleteRule(select: string): void;
findRule(select: string): CSSKeyframeRule | null;
name: string;
@@ -418,7 +418,7 @@ type CompositeOperation = 'replace' | 'add' | 'accumulate';
type CompositeOperationOrAuto = CompositeOperation | 'auto';
declare class AnimationTimeline {
+currentTime: number | null;
readonly currentTime: number | null;
}
type DocumentTimelineOptions = {
@@ -522,19 +522,19 @@ declare class Animation extends EventTarget {
currentTime: number | null;
effect: AnimationEffect | null;
finish(): void;
+finished: Promise<Animation>;
readonly finished: Promise<Animation>;
id: string;
oncancel: ?(ev: AnimationPlaybackEvent) => unknown;
onfinish: ?(ev: AnimationPlaybackEvent) => unknown;
onremove: ?(ev: AnimationPlaybackEvent) => unknown;
pause(): void;
+pending: boolean;
readonly pending: boolean;
persist(): void;
play(): void;
playbackRate: number;
+playState: AnimationPlayState;
+ready: Promise<Animation>;
+replaceState: AnimationReplaceState;
readonly playState: AnimationPlayState;
readonly ready: Promise<Animation>;
readonly replaceState: AnimationReplaceState;
reverse(): void;
startTime: number | null;
timeline: AnimationTimeline | null;
@@ -570,6 +570,6 @@ declare class AnimationPlaybackEvent extends Event {
type: string,
animationEventInitDict?: AnimationPlaybackEvent$Init,
): void;
+currentTime: number | null;
+timelineTime: number | null;
readonly currentTime: number | null;
readonly timelineTime: number | null;
}
+127 -127
View File
@@ -32,12 +32,12 @@ declare class Blob {
}
declare class FileReader extends EventTarget {
+EMPTY: 0;
+LOADING: 1;
+DONE: 2;
+error: null | DOMError;
+readyState: 0 | 1 | 2;
+result: null | string | ArrayBuffer;
readonly EMPTY: 0;
readonly LOADING: 1;
readonly DONE: 2;
readonly error: null | DOMError;
readonly readyState: 0 | 1 | 2;
readonly result: null | string | ArrayBuffer;
abort(): void;
onabort: null | ((ev: ProgressEvent) => any);
onerror: null | ((ev: ProgressEvent) => any);
@@ -117,8 +117,8 @@ declare type DOMStringMap = {[key: string]: string, ...};
declare class DOMStringList {
@@iterator(): Iterator<string>;
+[key: number]: string;
+length: number;
readonly [key: number]: string;
readonly length: number;
item(number): string | null;
contains(string): boolean;
}
@@ -140,16 +140,16 @@ declare interface CustomElementRegistry {
}
declare interface ShadowRoot extends DocumentFragment {
+delegatesFocus: boolean;
+host: Element;
readonly delegatesFocus: boolean;
readonly host: Element;
// flowlint unsafe-getters-setters:off
get innerHTML(): string;
set innerHTML(value: string | TrustedHTML): void;
// flowlint unsafe-getters-setters:error
+mode: ShadowRootMode;
readonly mode: ShadowRootMode;
// From DocumentOrShadowRoot Mixin.
+styleSheets: StyleSheetList;
readonly styleSheets: StyleSheetList;
adoptedStyleSheets: Array<CSSStyleSheet>;
}
@@ -650,17 +650,17 @@ declare class Event {
/**
* Returns the type of event, e.g. "click", "hashchange", or "submit".
*/
+type: string;
readonly type: string;
/**
* Returns the object to which event is dispatched (its target).
*/
+target: EventTarget; // TODO: nullable
readonly target: EventTarget; // TODO: nullable
/** @deprecated */
+srcElement: Element; // TODO: nullable
readonly srcElement: Element; // TODO: nullable
/**
* Returns the object whose event listener's callback is currently being invoked.
*/
+currentTarget: EventTarget; // TODO: nullable
readonly currentTarget: EventTarget; // TODO: nullable
/**
* Returns the invocation target objects of event's path (objects on which
* listeners will be invoked), except for any nodes in shadow trees of which
@@ -669,15 +669,15 @@ declare class Event {
*/
composedPath(): Array<EventTarget>;
+NONE: number;
+AT_TARGET: number;
+BUBBLING_PHASE: number;
+CAPTURING_PHASE: number;
readonly NONE: number;
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
/**
* Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET,
* and BUBBLING_PHASE.
*/
+eventPhase: number;
readonly eventPhase: number;
/**
* When dispatched in a tree, invoking this method prevents event from reaching
@@ -696,14 +696,14 @@ declare class Event {
* event goes through its target's ancestors in reverse tree order, and
* false otherwise.
*/
+bubbles: boolean;
readonly bubbles: boolean;
/**
* Returns true or false depending on how event was initialized. Its
* return value does not always carry meaning, but true can indicate
* that part of the operation during which event was dispatched, can
* be canceled by invoking the preventDefault() method.
*/
+cancelable: boolean;
readonly cancelable: boolean;
// returnValue: boolean; // legacy, and some subclasses still define it as a string!
/**
* If invoked when the cancelable attribute value is true, and while
@@ -716,28 +716,28 @@ declare class Event {
* Returns true if preventDefault() was invoked successfully to indicate
* cancelation, and false otherwise.
*/
+defaultPrevented: boolean;
readonly defaultPrevented: boolean;
/**
* Returns true or false depending on how event was initialized. True if
* event invokes listeners past a ShadowRoot node that is the root of its
* target, and false otherwise.
*/
+composed: boolean;
readonly composed: boolean;
/**
* Returns true if event was dispatched by the user agent, and false otherwise.
*/
+isTrusted: boolean;
readonly isTrusted: boolean;
/**
* Returns the event's timestamp as the number of milliseconds measured relative
* to the time origin.
*/
+timeStamp: number;
readonly timeStamp: number;
/** Non-standard. See Event.prototype.composedPath */
+deepPath?: () => EventTarget[];
readonly deepPath?: () => EventTarget[];
/** Non-standard. See Event.prototype.composed */
+scoped: boolean;
readonly scoped: boolean;
/**
* @deprecated
@@ -831,15 +831,15 @@ type WheelEvent$Init = {
};
declare class WheelEvent extends MouseEvent {
static +DOM_DELTA_PIXEL: 0x00;
static +DOM_DELTA_LINE: 0x01;
static +DOM_DELTA_PAGE: 0x02;
static readonly DOM_DELTA_PIXEL: 0x00;
static readonly DOM_DELTA_LINE: 0x01;
static readonly DOM_DELTA_PAGE: 0x02;
constructor(type: string, eventInitDict?: WheelEvent$Init): void;
+deltaX: number;
+deltaY: number;
+deltaZ: number;
+deltaMode: 0x00 | 0x01 | 0x02;
readonly deltaX: number;
readonly deltaY: number;
readonly deltaZ: number;
readonly deltaMode: 0x00 | 0x01 | 0x02;
}
declare class DragEvent extends MouseEvent {
@@ -907,7 +907,7 @@ type PageTransitionEventInit = {
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-pagetransitionevent-interface
declare class PageTransitionEvent extends Event {
constructor(type: string, init?: PageTransitionEventInit): void;
+persisted: boolean;
readonly persisted: boolean;
}
// used for websockets and postMessage, for example. See:
@@ -929,12 +929,12 @@ declare class EventSource extends EventTarget {
url: string,
configuration?: {withCredentials: boolean, ...},
): void;
+CLOSED: 2;
+CONNECTING: 0;
+OPEN: 1;
+readyState: 0 | 1 | 2;
+url: string;
+withCredentials: boolean;
readonly CLOSED: 2;
readonly CONNECTING: 0;
readonly OPEN: 1;
readonly readyState: 0 | 1 | 2;
readonly url: string;
readonly withCredentials: boolean;
onerror: () => void;
onmessage: MessageEventListener;
onopen: () => void;
@@ -1028,33 +1028,33 @@ declare class KeyboardEvent extends UIEvent {
constructor(typeArg: string, init?: KeyboardEvent$Init): void;
/** `true` if the Alt (alternative) (or "Option") key modifier was active. */
+altKey: boolean;
readonly altKey: boolean;
/**
* Holds a string that identifies the physical key being pressed. The value
* is not affected by the current keyboard layout or modifier state, so a
* particular key will always return the same value.
*/
+code: string;
readonly code: string;
/** `true` if the Control (control) key modifier was active. */
+ctrlKey: boolean;
readonly ctrlKey: boolean;
/**
* `true` if the key event occurs as part of a composition session, i.e.,
* after a `compositionstart` event and before the corresponding
* `compositionend` event.
*/
+isComposing: boolean;
readonly isComposing: boolean;
/**
* Holds a [key attribute value](https://www.w3.org/TR/uievents-key/#key-attribute-value)
* corresponding to the key pressed. */
+key: string;
readonly key: string;
/** An indication of the logical location of the key on the device. */
+location: number;
readonly location: number;
/** `true` if the meta (Meta) key (or "Command") modifier was active. */
+metaKey: boolean;
readonly metaKey: boolean;
/** `true` if the key has been pressed in a sustained manner. */
+repeat: boolean;
readonly repeat: boolean;
/** `true` if the shift (Shift) key modifier was active. */
+shiftKey: boolean;
readonly shiftKey: boolean;
/**
* Queries the state of a modifier using a key value.
@@ -1072,7 +1072,7 @@ declare class KeyboardEvent extends UIEvent {
*
* @deprecated You should use KeyboardEvent.key instead, if available.
*/
+charCode: number;
readonly charCode: number;
/**
* Holds a system- and implementation-dependent numerical code signifying
* the unmodified identifier associated with the key pressed. Unlike the
@@ -1084,7 +1084,7 @@ declare class KeyboardEvent extends UIEvent {
*
* @deprecated You should use KeyboardEvent.key instead, if available.
*/
+keyCode: number;
readonly keyCode: number;
/**
* Holds a system- and implementation-dependent numerical code signifying
* the unmodified identifier associated with the key pressed. In most cases,
@@ -1092,7 +1092,7 @@ declare class KeyboardEvent extends UIEvent {
*
* @deprecated You should use KeyboardEvent.key instead, if available.
*/
+which: number;
readonly which: number;
}
type InputEvent$Init = {
@@ -1107,10 +1107,10 @@ type InputEvent$Init = {
declare class InputEvent extends UIEvent {
constructor(typeArg: string, inputEventInit: InputEvent$Init): void;
+data: string | null;
+dataTransfer: DataTransfer | null;
+inputType: string;
+isComposing: boolean;
readonly data: string | null;
readonly dataTransfer: DataTransfer | null;
readonly inputType: string;
readonly isComposing: boolean;
getTargetRanges(): Array<any>; // TODO: StaticRange
}
@@ -1144,11 +1144,11 @@ declare class ErrorEvent extends Event {
...
},
): void;
+message: string;
+filename: string;
+lineno: number;
+colno: number;
+error: any;
readonly message: string;
readonly filename: string;
readonly lineno: number;
readonly colno: number;
readonly error: any;
}
// https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts
@@ -1216,7 +1216,7 @@ type ClipboardItemOptions = {
};
declare class ClipboardItem {
+types: ReadonlyArray<string>;
readonly types: ReadonlyArray<string>;
getType(type: string): Promise<Blob>;
constructor(
items: {[type: string]: ClipboardItemData},
@@ -1233,7 +1233,7 @@ type ClipboardEvent$Init = {
declare class ClipboardEvent extends Event {
constructor(type: ClipboardEventTypes, eventInit?: ClipboardEvent$Init): void;
+clipboardData: ?DataTransfer; // readonly
readonly clipboardData: ?DataTransfer; // readonly
}
// https://www.w3.org/TR/2017/WD-css-transitions-1-20171130/#interface-transitionevent
@@ -1252,9 +1252,9 @@ declare class TransitionEvent extends Event {
eventInit?: TransitionEvent$Init,
): void;
+propertyName: string; // readonly
+elapsedTime: number; // readonly
+pseudoElement: string; // readonly
readonly propertyName: string; // readonly
readonly elapsedTime: number; // readonly
readonly pseudoElement: string; // readonly
}
// https://www.w3.org/TR/html50/browsers.html#beforeunloadevent
@@ -1263,18 +1263,18 @@ declare class BeforeUnloadEvent extends Event {
}
declare class SecurityPolicyViolationEvent extends Event {
+documentURI: string;
+referrer: string;
+blockedURI: string;
+effectiveDirective: string;
+violatedDirective: string;
+originalPolicy: string;
+sourceFile: string;
+sample: string;
+disposition: 'enforce' | 'report';
+statusCode: number;
+lineNumber: number;
+columnNumber: number;
readonly documentURI: string;
readonly referrer: string;
readonly blockedURI: string;
readonly effectiveDirective: string;
readonly violatedDirective: string;
readonly originalPolicy: string;
readonly sourceFile: string;
readonly sample: string;
readonly disposition: 'enforce' | 'report';
readonly statusCode: number;
readonly lineNumber: number;
readonly columnNumber: number;
}
// https://developer.mozilla.org/en-US/docs/Web/API/USBConnectionEvent
@@ -1288,7 +1288,7 @@ declare class Node extends EventTarget {
baseURI: ?string;
childNodes: NodeList<Node>;
firstChild: ?Node;
+isConnected: boolean;
readonly isConnected: boolean;
lastChild: ?Node;
nextSibling: ?Node;
nodeName: string;
@@ -1391,13 +1391,13 @@ declare class HTMLCollection<out Elem extends HTMLElement> {
// from https://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-register
// See also https://github.com/w3c/webcomponents/
type ElementRegistrationOptions = {
+prototype?: {
readonly prototype?: {
// from https://www.w3.org/TR/custom-elements/#types-of-callbacks
// See also https://github.com/w3c/webcomponents/
+createdCallback?: () => unknown,
+attachedCallback?: () => unknown,
+detachedCallback?: () => unknown,
+attributeChangedCallback?: ((
readonly createdCallback?: () => unknown,
readonly attachedCallback?: () => unknown,
readonly detachedCallback?: () => unknown,
readonly attributeChangedCallback?: ((
// attribute is set
attributeLocalName: string,
oldAttributeValue: null,
@@ -1420,28 +1420,28 @@ type ElementRegistrationOptions = {
) => unknown),
...
},
+extends?: string,
readonly extends?: string,
...
};
type ElementCreationOptions = {is: string, ...};
declare class Document extends Node {
+timeline: DocumentTimeline;
readonly timeline: DocumentTimeline;
getAnimations(): Array<Animation>;
+URL: string;
readonly URL: string;
adoptNode<T extends Node>(source: T): T;
anchors: HTMLCollection<HTMLAnchorElement>;
applets: HTMLCollection<HTMLAppletElement>;
body: HTMLBodyElement | null;
+characterSet: string;
readonly characterSet: string;
/**
* Legacy alias of `characterSet`
* @deprecated
*/
+charset: string;
readonly charset: string;
close(): void;
+contentType: string;
readonly contentType: string;
cookie: string;
createAttribute(name: string): Attr;
createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;
@@ -1696,10 +1696,10 @@ declare class Document extends Node {
createTextNode(data: string): Text;
currentScript: HTMLScriptElement | null;
dir: 'rtl' | 'ltr';
+doctype: DocumentType | null;
+documentElement: HTMLElement | null;
readonly doctype: DocumentType | null;
readonly documentElement: HTMLElement | null;
documentMode: number;
+documentURI: string;
readonly documentURI: string;
domain: string | null;
embeds: HTMLCollection<HTMLEmbedElement>;
exitFullscreen(): Promise<void>;
@@ -2033,13 +2033,13 @@ declare class Document extends Node {
): HTMLCollection<HTMLElement>;
head: HTMLHeadElement | null;
images: HTMLCollection<HTMLImageElement>;
+implementation: DOMImplementation;
readonly implementation: DOMImplementation;
importNode<T extends Node>(importedNode: T, deep: boolean): T;
/**
* Legacy alias of `characterSet`
* @deprecated
*/
+inputEncoding: string;
readonly inputEncoding: string;
lastModified: string;
links: HTMLCollection<HTMLLinkElement>;
media: string;
@@ -2071,7 +2071,7 @@ declare class Document extends Node {
elementFromPoint(x: number, y: number): HTMLElement | null;
elementsFromPoint(x: number, y: number): Array<HTMLElement>;
defaultView: any;
+compatMode: 'BackCompat' | 'CSS1Compat';
readonly compatMode: 'BackCompat' | 'CSS1Compat';
hidden: boolean;
// Pointer Lock specification
@@ -2712,7 +2712,7 @@ declare class Document extends Node {
getElementById(elementId: string): HTMLElement | null;
// From DocumentOrShadowRoot Mixin.
+styleSheets: StyleSheetList;
readonly styleSheets: StyleSheetList;
adoptedStyleSheets: Array<CSSStyleSheet>;
}
@@ -2857,7 +2857,7 @@ declare class Element extends Node implements Animatable {
scrollLeft: number;
scrollTop: number;
scrollWidth: number;
+tagName: string;
readonly tagName: string;
// TODO: a lot more ARIA properties
ariaHidden: void | 'true' | 'false';
@@ -3466,8 +3466,8 @@ declare class HTMLTableElement extends HTMLElement {
caption: HTMLTableCaptionElement | null;
tHead: HTMLTableSectionElement | null;
tFoot: HTMLTableSectionElement | null;
+tBodies: HTMLCollection<HTMLTableSectionElement>;
+rows: HTMLCollection<HTMLTableRowElement>;
readonly tBodies: HTMLCollection<HTMLTableSectionElement>;
readonly rows: HTMLCollection<HTMLTableRowElement>;
createTHead(): HTMLTableSectionElement;
deleteTHead(): void;
createTFoot(): HTMLTableSectionElement;
@@ -3489,7 +3489,7 @@ declare class HTMLTableColElement extends HTMLElement {
declare class HTMLTableSectionElement extends HTMLElement {
tagName: 'THEAD' | 'TFOOT' | 'TBODY';
+rows: HTMLCollection<HTMLTableRowElement>;
readonly rows: HTMLCollection<HTMLTableRowElement>;
insertRow(index?: number): HTMLTableRowElement;
deleteRow(index: number): void;
}
@@ -3498,15 +3498,15 @@ declare class HTMLTableCellElement extends HTMLElement {
tagName: 'TD' | 'TH';
colSpan: number;
rowSpan: number;
+cellIndex: number;
readonly cellIndex: number;
}
declare class HTMLTableRowElement extends HTMLElement {
tagName: 'TR';
align: 'left' | 'right' | 'center';
+rowIndex: number;
+sectionRowIndex: number;
+cells: HTMLCollection<HTMLTableCellElement>;
readonly rowIndex: number;
readonly sectionRowIndex: number;
readonly cells: HTMLCollection<HTMLTableCellElement>;
deleteCell(index: number): void;
insertCell(index?: number): HTMLTableCellElement;
}
@@ -5965,13 +5965,13 @@ declare class URL {
host: string;
hostname: string;
href: string;
+origin: string;
readonly origin: string;
password: string;
pathname: string;
port: string;
protocol: string;
search: string;
+searchParams: URLSearchParams;
readonly searchParams: URLSearchParams;
username: string;
toString(): string;
toJSON(): string;
@@ -6250,30 +6250,30 @@ type NotificationOptions = {
declare class Notification extends EventTarget {
constructor(title: string, options?: NotificationOptions): void;
static +permission: NotificationPermission;
static readonly permission: NotificationPermission;
static requestPermission(
callback?: (perm: NotificationPermission) => unknown,
): Promise<NotificationPermission>;
static +maxActions: number;
static readonly maxActions: number;
onclick: ?(evt: Event) => unknown;
onclose: ?(evt: Event) => unknown;
onerror: ?(evt: Event) => unknown;
onshow: ?(evt: Event) => unknown;
+title: string;
+dir: NotificationDirection;
+lang: string;
+body: string;
+tag: string;
+image?: string;
+icon?: string;
+badge?: string;
+vibrate?: Array<number>;
+timestamp: number;
+renotify: boolean;
+silent: boolean;
+requireInteraction: boolean;
+data: any;
+actions: Array<NotificationAction>;
readonly title: string;
readonly dir: NotificationDirection;
readonly lang: string;
readonly body: string;
readonly tag: string;
readonly image?: string;
readonly icon?: string;
readonly badge?: string;
readonly vibrate?: Array<number>;
readonly timestamp: number;
readonly renotify: boolean;
readonly silent: boolean;
readonly requireInteraction: boolean;
readonly data: any;
readonly actions: Array<NotificationAction>;
close(): void;
}
@@ -32,7 +32,7 @@ import nullthrows from 'nullthrows';
interface NativeAnimatedModuleSpec extends NativeAnimatedTurboModuleSpec {
// connectAnimatedNodeToShadowNodeFamily is available only in NativeAnimatedNonTurboModule
+connectAnimatedNodeToShadowNodeFamily?: (
readonly connectAnimatedNodeToShadowNodeFamily?: (
nodeTag: number,
// $FlowExpectedError[unclear-type].
shadowNode: Object,
@@ -25,7 +25,7 @@ export interface VirtualCollection<out T extends Item> {
* or a getter function that is computed on access. However, it should remain
* constant for the lifetime of this object.
*/
+size: number;
readonly size: number;
/**
* If an item exists at the supplied index, this should return a consistent
@@ -41,8 +41,8 @@ export interface VirtualCollection<out T extends Item> {
* array is eagerly allocated.
*/
export class VirtualArray<out T extends Item> implements VirtualCollection<T> {
+size: number;
+at: (index: number) => T;
readonly size: number;
readonly at: (index: number) => T;
constructor(input: Readonly<$ArrayLike<T>>) {
const array = [...input];
@@ -49,7 +49,9 @@ export type ElementsHierarchy = InspectorData['hierarchy'];
type ExternalInspection = {
externalInspectingEnabled: boolean,
+reportToExternalInspection: (viewData: TouchedViewDataAtPoint) => void,
readonly reportToExternalInspection: (
viewData: TouchedViewDataAtPoint,
) => void,
};
type Props = {
@@ -13,10 +13,10 @@ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
+show: () => void;
+reload: () => void;
+setProfilingEnabled: (enabled: boolean) => void;
+setHotLoadingEnabled: (enabled: boolean) => void;
readonly show: () => void;
readonly reload: () => void;
readonly setProfilingEnabled: (enabled: boolean) => void;
readonly setHotLoadingEnabled: (enabled: boolean) => void;
}
export default TurboModuleRegistry.getEnforcing<Spec>('DevMenu') as Spec;
@@ -24,8 +24,10 @@ export type PartialReloadAndProfileConfig = {
};
export interface Spec extends TurboModule {
+setReloadAndProfileConfig: (config: PartialReloadAndProfileConfig) => void;
+getReloadAndProfileConfig: () => ReloadAndProfileConfig;
readonly setReloadAndProfileConfig: (
config: PartialReloadAndProfileConfig,
) => void;
readonly getReloadAndProfileConfig: () => ReloadAndProfileConfig;
}
export default TurboModuleRegistry.get<Spec>(
@@ -13,8 +13,8 @@ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
+setGlobalHookSettings: (settings: string) => void;
+getGlobalHookSettings: () => ?string;
readonly setGlobalHookSettings: (settings: string) => void;
readonly getGlobalHookSettings: () => ?string;
}
export default TurboModuleRegistry.get<Spec>(
@@ -16,9 +16,9 @@ import ExceptionsManager, {
import * as React from 'react';
type ErrorInfo = {
+componentStack?: ?string,
readonly componentStack?: ?string,
// $FlowFixMe[unclear-type] unknown props and state.
+errorBoundary?: ?React.Component<any, any>,
readonly errorBoundary?: ?React.Component<any, any>,
};
function getExtendedError(
@@ -111,8 +111,8 @@ type AndroidDrawerLayoutNativeProps = Readonly<{
type NativeType = HostComponent<AndroidDrawerLayoutNativeProps>;
interface NativeCommands {
+openDrawer: (viewRef: React.ElementRef<NativeType>) => void;
+closeDrawer: (viewRef: React.ElementRef<NativeType>) => void;
readonly openDrawer: (viewRef: React.ElementRef<NativeType>) => void;
readonly closeDrawer: (viewRef: React.ElementRef<NativeType>) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
@@ -59,7 +59,7 @@ type AndroidSwipeRefreshLayoutNativeProps = Readonly<{
type NativeType = HostComponent<AndroidSwipeRefreshLayoutNativeProps>;
interface NativeCommands {
+setNativeRefreshing: (
readonly setNativeRefreshing: (
viewRef: React.ElementRef<NativeType>,
value: boolean,
) => void;
@@ -47,7 +47,7 @@ type AndroidSwitchNativeProps = Readonly<{
type NativeType = HostComponent<AndroidSwitchNativeProps>;
interface NativeCommands {
+setNativeValue: (
readonly setNativeValue: (
viewRef: React.ElementRef<NativeType>,
value: boolean,
) => void;
Loaded 100 of 193 files, more files were not shown because too many files have changed in this diff. Show more