diff --git a/packages/debugger-shell/src/electron/SettingsStore.js b/packages/debugger-shell/src/electron/SettingsStore.js index b79b262e314e..0fe913e13791 100644 --- a/packages/debugger-shell/src/electron/SettingsStore.js +++ b/packages/debugger-shell/src/electron/SettingsStore.js @@ -96,7 +96,7 @@ export default class SettingsStore { const data = fs.readFileSync(this.path, 'utf8'); const deserializedData = this._deserialize(data); return { - ...((deserializedData: any): {[string]: unknown}), + ...(deserializedData as any as {[string]: unknown}), }; } catch (error) { if (error?.code === 'ENOENT') { diff --git a/packages/dev-middleware/src/__tests__/InspectorDeviceUtils.js b/packages/dev-middleware/src/__tests__/InspectorDeviceUtils.js index 89bf99736d08..f8ef55eb4c0e 100644 --- a/packages/dev-middleware/src/__tests__/InspectorDeviceUtils.js +++ b/packages/dev-middleware/src/__tests__/InspectorDeviceUtils.js @@ -137,7 +137,7 @@ export class DeviceMock extends DeviceAgent { }); break; default: - (message: empty); + message as empty; throw new Error(`Unhandled event ${message.event}`); } } diff --git a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js index 45a93b795599..840bf2a13535 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js +++ b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js @@ -150,7 +150,7 @@ export async function createAndConnectTarget( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; diff --git a/packages/dev-middleware/src/__tests__/InspectorProxyCdpTransport-test.js b/packages/dev-middleware/src/__tests__/InspectorProxyCdpTransport-test.js index 53e893dfc25d..6a5e6a23a158 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProxyCdpTransport-test.js +++ b/packages/dev-middleware/src/__tests__/InspectorProxyCdpTransport-test.js @@ -61,7 +61,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -121,7 +121,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -189,7 +189,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -306,7 +306,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -356,7 +356,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -431,7 +431,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -477,7 +477,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -515,7 +515,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -578,7 +578,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -632,7 +632,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; @@ -689,7 +689,7 @@ describe.each(['HTTP', 'HTTPS'])( pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); const [{webSocketDebuggerUrl}] = pageList; diff --git a/packages/dev-middleware/src/__tests__/InspectorProxyConcurrentSessions-test.js b/packages/dev-middleware/src/__tests__/InspectorProxyConcurrentSessions-test.js index c8b29d962c83..168bc20b42e4 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProxyConcurrentSessions-test.js +++ b/packages/dev-middleware/src/__tests__/InspectorProxyConcurrentSessions-test.js @@ -62,7 +62,7 @@ describe('inspector proxy concurrent sessions', () => { pageList = (await fetchJson( `${serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toHaveLength(1); }); diff --git a/packages/dev-middleware/src/__tests__/InspectorProxyCustomMessageHandler-test.js b/packages/dev-middleware/src/__tests__/InspectorProxyCustomMessageHandler-test.js index 12a338dad110..a892ef48209f 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProxyCustomMessageHandler-test.js +++ b/packages/dev-middleware/src/__tests__/InspectorProxyCustomMessageHandler-test.js @@ -107,7 +107,7 @@ describe('inspector proxy device message middleware', () => { pageList = (await fetchJson( `${serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList.length).toBeGreaterThan(0); }); invariant(pageList != null, ''); diff --git a/packages/dev-middleware/src/__tests__/InspectorProxyDeviceHandoff-test.js b/packages/dev-middleware/src/__tests__/InspectorProxyDeviceHandoff-test.js index 1ceb76368bd3..14fbb898e995 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProxyDeviceHandoff-test.js +++ b/packages/dev-middleware/src/__tests__/InspectorProxyDeviceHandoff-test.js @@ -423,7 +423,7 @@ describe('inspector-proxy device socket handoff', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toEqual( expect.arrayContaining( pageListSpec.map(pageSpec => diff --git a/packages/dev-middleware/src/__tests__/InspectorProxyReactNativeReloads-test.js b/packages/dev-middleware/src/__tests__/InspectorProxyReactNativeReloads-test.js index 97fece865f2d..1151edc882d5 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProxyReactNativeReloads-test.js +++ b/packages/dev-middleware/src/__tests__/InspectorProxyReactNativeReloads-test.js @@ -55,7 +55,7 @@ describe('inspector proxy React Native reloads', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList.length).toBeGreaterThan(0); }); invariant(pageList != null, ''); @@ -114,7 +114,7 @@ describe('inspector proxy React Native reloads', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toContainEqual( expect.objectContaining({ id: expect.stringContaining('originalPage-updated'), @@ -171,7 +171,7 @@ describe('inspector proxy React Native reloads', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList.length).toBeGreaterThan(0); }); invariant(pageList != null, ''); @@ -224,7 +224,7 @@ describe('inspector proxy React Native reloads', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toContainEqual( expect.objectContaining({ id: expect.stringContaining('originalPage-updated'), @@ -275,7 +275,7 @@ describe('inspector proxy React Native reloads', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList.length).toBeGreaterThan(0); }); invariant(pageList != null, ''); @@ -429,7 +429,7 @@ describe('inspector proxy React Native reloads', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList.length).toBeGreaterThan(0); }); invariant(pageList != null, ''); @@ -465,7 +465,7 @@ describe('inspector proxy React Native reloads', () => { pageList = (await fetchJson( `${serverRef.serverBaseUrl}/json`, // $FlowFixMe[unclear-type] - ): any); + )) as any; expect(pageList).toContainEqual( expect.objectContaining({ id: expect.stringContaining('originalPage-updated'), diff --git a/packages/dev-middleware/src/createDevMiddleware.js b/packages/dev-middleware/src/createDevMiddleware.js index e7d16f773ab9..00c892e5c184 100644 --- a/packages/dev-middleware/src/createDevMiddleware.js +++ b/packages/dev-middleware/src/createDevMiddleware.js @@ -196,7 +196,7 @@ function createWrappedEventReporter( ); break; default: - (event.result.code: empty); + event.result.code as empty; break; } } diff --git a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js index 64d91133d5cb..54a62c649b7e 100644 --- a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js +++ b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js @@ -183,7 +183,7 @@ export default function openDebuggerMiddleware({ shouldUseStandaloneFuseboxShell = false; break; default: - (shellPreparationResult.code: empty); + shellPreparationResult.code as empty; } } if (shouldUseStandaloneFuseboxShell) { @@ -226,7 +226,7 @@ export default function openDebuggerMiddleware({ res.end(); break; default: - (launchType: empty); + launchType as empty; } eventReporter?.logEvent({ type: 'launch_debugger_frontend', diff --git a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js index 2e5422b84e75..4e680fe3e841 100644 --- a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js +++ b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js @@ -111,7 +111,7 @@ function getNativeTypeFromAnnotation( case 'MixedTypeAnnotation': return 'folly::dynamic'; default: - (typeAnnotation: empty); + typeAnnotation as empty; throw new Error( `Received invalid typeAnnotation for ${componentName} prop ${prop.name}, received ${typeAnnotation.type}`, ); diff --git a/packages/react-native-codegen/src/generators/components/CppHelpers.js b/packages/react-native-codegen/src/generators/components/CppHelpers.js index e344284252c6..6a64b2eab3a9 100644 --- a/packages/react-native-codegen/src/generators/components/CppHelpers.js +++ b/packages/react-native-codegen/src/generators/components/CppHelpers.js @@ -47,7 +47,7 @@ function getCppTypeForAnnotation( case 'MixedTypeAnnotation': return 'folly::dynamic'; default: - (type: empty); + (type) as empty; throw new Error(`Received invalid typeAnnotation ${type}`); } } @@ -95,7 +95,7 @@ function getCppArrayTypeForAnnotation( // Unions of strings and string literals are treated as just strings return `std::vector<${getCppTypeForAnnotation('StringTypeAnnotation')}>`; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'ObjectTypeAnnotation': @@ -241,7 +241,7 @@ function convertDefaultTypeToString( case 'DimensionPrimitive': return ''; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error( `Unsupported type annotation: ${typeAnnotation.name}`, ); @@ -283,7 +283,7 @@ function convertDefaultTypeToString( case 'MixedTypeAnnotation': return ''; default: - (typeAnnotation: empty); + typeAnnotation as empty; throw new Error(`Unsupported type annotation: ${typeAnnotation.type}`); } } diff --git a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js index 6d0279757adc..2a40ab854e67 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js @@ -158,7 +158,7 @@ function getObjCParamType(param: Param): string { case 'RootTag': return 'double'; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error(`Receieved invalid type: ${typeAnnotation.name}`); } case 'BooleanTypeAnnotation': @@ -174,7 +174,7 @@ function getObjCParamType(param: Param): string { case 'ArrayTypeAnnotation': return 'const NSArray *'; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error('Received invalid param type annotation'); } } @@ -188,7 +188,7 @@ function getObjCExpectedKindParamType(param: Param): string { case 'RootTag': return '[NSNumber class]'; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error(`Receieved invalid type: ${typeAnnotation.name}`); } case 'BooleanTypeAnnotation': @@ -204,7 +204,7 @@ function getObjCExpectedKindParamType(param: Param): string { case 'ArrayTypeAnnotation': return '[NSArray class]'; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error('Received invalid param type annotation'); } } @@ -218,7 +218,7 @@ function getReadableExpectedKindParamType(param: Param): string { case 'RootTag': return 'double'; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error(`Receieved invalid type: ${typeAnnotation.name}`); } case 'BooleanTypeAnnotation': @@ -234,7 +234,7 @@ function getReadableExpectedKindParamType(param: Param): string { case 'ArrayTypeAnnotation': return 'array'; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error('Received invalid param type annotation'); } } @@ -251,7 +251,7 @@ function getObjCRightHandAssignmentParamType( case 'RootTag': return `[(NSNumber *)arg${index} doubleValue]`; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error(`Receieved invalid type: ${typeAnnotation.name}`); } case 'BooleanTypeAnnotation': @@ -267,7 +267,7 @@ function getObjCRightHandAssignmentParamType( case 'ArrayTypeAnnotation': return `(NSArray *)arg${index}`; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error('Received invalid param type annotation'); } } diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js index 31ca6ebe7ae2..e2ef1b9b29cb 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js @@ -356,7 +356,7 @@ function generateSetters( usingEvent, ); default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Received invalid event property type ${typeAnnotation.type}`, ); diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index 00c6c8cf0ea0..5356ecf1f0c6 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -148,7 +148,7 @@ function getNativeTypeFromAnnotation( eventProperty.name, ]); default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Received invalid event property type ${typeAnnotation.type}`, ); @@ -274,7 +274,7 @@ function generateStruct( ); return; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Received invalid event property type ${typeAnnotation.type}`, ); diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js index 29f14c693d6b..60041ed64d1a 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js @@ -205,7 +205,7 @@ function generatePropsDiffString( 'ImageRequestPrimitive should not be used in Props', ); default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error('Received unknown ReservedPropTypeAnnotation'); } default: @@ -288,11 +288,11 @@ function getClassExtendString(component: ComponentShape): string { case 'ReactNativeCoreViewProps': return 'ViewProps(context, sourceProps, rawProps)'; default: - (extendProps.knownTypeName: empty); + extendProps.knownTypeName as empty; throw new Error('Invalid knownTypeName'); } default: - (extendProps.type: empty); + extendProps.type as empty; throw new Error('Invalid extended type'); } }) diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index 6b909918eb33..58cb6a927ebd 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -331,11 +331,11 @@ function getClassExtendString(component: ComponentShape): string { case 'ReactNativeCoreViewProps': return 'public ViewProps'; default: - (extendProps.knownTypeName: empty); + extendProps.knownTypeName as empty; throw new Error('Invalid knownTypeName'); } default: - (extendProps.type: empty); + extendProps.type as empty; throw new Error('Invalid extended type'); } }) @@ -574,11 +574,11 @@ function getExtendsImports( ); return; default: - (extendProps.knownTypeName: empty); + extendProps.knownTypeName as empty; throw new Error('Invalid knownTypeName'); } default: - (extendProps.type: empty); + extendProps.type as empty; throw new Error('Invalid extended type'); } }); @@ -778,7 +778,7 @@ function generateStruct( case 'MixedTypeAnnotation': return; default: - (property.typeAnnotation.type: empty); + property.typeAnnotation.type as empty; throw new Error( `Received invalid component property type ${property.typeAnnotation.type}`, ); diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js index cda1b644a291..bef3170911ff 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js @@ -132,7 +132,7 @@ function getJavaValueForProp( case 'DimensionPrimitive': return 'DimensionPropConverter.getDimension(value)'; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error('Received unknown ReservedPropTypeAnnotation'); } case 'ArrayTypeAnnotation': { @@ -148,7 +148,7 @@ function getJavaValueForProp( case 'MixedTypeAnnotation': return 'new DynamicFromObject(value)'; default: - (typeAnnotation: empty); + typeAnnotation as empty; throw new Error('Received invalid typeAnnotation'); } } @@ -190,7 +190,7 @@ function getCommandArgJavaType( case 'RootTag': return `args.getDouble(${index})`; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error(`Receieved invalid type: ${typeAnnotation.name}`); } case 'BooleanTypeAnnotation': @@ -206,7 +206,7 @@ function getCommandArgJavaType( case 'ArrayTypeAnnotation': return `args.getArray(${index})`; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error(`Receieved invalid type: ${typeAnnotation.type}`); } } @@ -251,11 +251,11 @@ function getClassExtendString(component: ComponentShape): string { case 'ReactNativeCoreViewProps': return 'View'; default: - (extendProps.knownTypeName: empty); + extendProps.knownTypeName as empty; throw new Error('Invalid knownTypeName'); } default: - (extendProps.type: empty); + extendProps.type as empty; throw new Error('Invalid extended type'); } }) diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js index 7f5833735786..13e0327c14f7 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js @@ -110,7 +110,7 @@ function getJavaValueForProp( addNullable(imports); return '@Nullable YogaValue value'; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error('Received unknown ReservedPropTypeAnnotation'); } case 'ArrayTypeAnnotation': { @@ -130,7 +130,7 @@ function getJavaValueForProp( case 'MixedTypeAnnotation': return 'Dynamic value'; default: - (typeAnnotation: empty); + typeAnnotation as empty; throw new Error('Received invalid typeAnnotation'); } } @@ -158,7 +158,7 @@ function getCommandArgJavaType(param: NamedShape) { case 'RootTag': return 'double'; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error(`Receieved invalid type: ${typeAnnotation.name}`); } case 'BooleanTypeAnnotation': @@ -174,7 +174,7 @@ function getCommandArgJavaType(param: NamedShape) { case 'ArrayTypeAnnotation': return 'ReadableArray'; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error('Receieved invalid typeAnnotation'); } } @@ -218,11 +218,11 @@ function getClassExtendString(component: ComponentShape): string { case 'ReactNativeCoreViewProps': return 'View'; default: - (extendProps.knownTypeName: empty); + extendProps.knownTypeName as empty; throw new Error('Invalid knownTypeName'); } default: - (extendProps.type: empty); + extendProps.type as empty; throw new Error('Invalid extended type'); } }) diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js index 308d33efdbab..28d57d1dd855 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js @@ -108,7 +108,7 @@ function toJavaType( return '@Nullable YogaValue'; default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error( `Received unknown ReservedPropTypeAnnotation ${typeAnnotation.name}`, ); @@ -201,7 +201,7 @@ function toJavaType( return 'YogaValue'; default: - (elementType.name: empty); + elementType.name as empty; throw new Error( `Received unknown ReservedPropTypeAnnotation ${elementType.name}`, ); @@ -216,7 +216,7 @@ function toJavaType( return `ArrayList<${pojoTypeAliasTypeAnnotation.name}>`; } default: { - (elementType.type: empty); + elementType.type as empty; throw new Error( `Unrecognized PojoTypeAnnotation Array element type annotation '${elementType.type}'`, ); @@ -234,7 +234,7 @@ function toJavaType( } default: { - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Unrecognized PojoTypeAnnotation '${typeAnnotation.type}'`, ); diff --git a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js index 05d49fcf08ad..a91773c12d04 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js +++ b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js @@ -91,7 +91,7 @@ function getReactDiffProcessValue(typeAnnotation: PropTypeAnnotation) { case 'DimensionPrimitive': return t.booleanLiteral(true); default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error( `Received unknown native typeAnnotation: "${typeAnnotation.name}"`, ); @@ -116,7 +116,7 @@ function getReactDiffProcessValue(typeAnnotation: PropTypeAnnotation) { } return t.booleanLiteral(true); default: - (typeAnnotation: empty); + typeAnnotation as empty; throw new Error( `Received unknown typeAnnotation: "${typeAnnotation.type}"`, ); @@ -264,11 +264,11 @@ function buildViewConfig( return; default: - (extendProps.knownTypeName: empty); + extendProps.knownTypeName as empty; throw new Error('Invalid knownTypeName'); } default: - (extendProps.type: empty); + extendProps.type as empty; throw new Error('Invalid extended type'); } }); diff --git a/packages/react-native-codegen/src/generators/components/JavaHelpers.js b/packages/react-native-codegen/src/generators/components/JavaHelpers.js index ea6aae15eb21..43f85942e37e 100644 --- a/packages/react-native-codegen/src/generators/components/JavaHelpers.js +++ b/packages/react-native-codegen/src/generators/components/JavaHelpers.js @@ -52,11 +52,11 @@ function getImports( imports.add('import android.view.View;'); return; default: - (extendProps.knownTypeName: empty); + extendProps.knownTypeName as empty; throw new Error('Invalid knownTypeName'); } default: - (extendProps.type: empty); + extendProps.type as empty; throw new Error('Invalid extended type'); } }); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js index a2e16ff06e73..f6266693baa2 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js @@ -87,7 +87,7 @@ function serializeArg( case 'RootTag': return wrap(val => `${val}.asNumber()`); default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error( `Unknown prop type for "${arg.name}, found: ${realTypeAnnotation.name}"`, ); @@ -139,7 +139,7 @@ function serializeArg( case 'string': return wrap(val => `${val}.asString(rt)`); default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'ObjectTypeAnnotation': @@ -147,7 +147,7 @@ function serializeArg( case 'MixedTypeAnnotation': return wrap(val => `jsi::Value(rt, ${val})`); default: - (realTypeAnnotation.type: empty); + realTypeAnnotation.type as empty; throw new Error( `Unknown prop type for "${arg.name}, found: ${realTypeAnnotation.type}"`, ); @@ -248,7 +248,7 @@ function translatePrimitiveJSTypeToCpp( case 'RootTag': return wrapOptional('double', isRequired); default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error(createErrorMessage(realTypeAnnotation.name)); } case 'VoidTypeAnnotation': @@ -294,7 +294,7 @@ function translatePrimitiveJSTypeToCpp( case 'string': return wrapOptional('jsi::String', isRequired); default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'ObjectTypeAnnotation': @@ -308,7 +308,7 @@ function translatePrimitiveJSTypeToCpp( case 'MixedTypeAnnotation': return wrapOptional('jsi::Value', isRequired); default: - (realTypeAnnotation.type: empty); + realTypeAnnotation.type as empty; throw new Error(createErrorMessage(realTypeAnnotation.type)); } } diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index 55e14262fa06..98ed68318f83 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -146,7 +146,7 @@ function translateEventEmitterTypeToJavaType( case 'string': return 'String'; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'NumberTypeAnnotation': @@ -175,7 +175,7 @@ function translateEventEmitterTypeToJavaType( `Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`, ); default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`, ); @@ -208,7 +208,7 @@ function translateFunctionParamToJavaType( case 'RootTag': return wrapOptional('double', isRequired); default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error(createErrorMessage(realTypeAnnotation.name)); } case 'StringTypeAnnotation': @@ -251,7 +251,7 @@ function translateFunctionParamToJavaType( case 'string': return wrapOptional('String', isRequired); default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'ObjectTypeAnnotation': @@ -268,7 +268,7 @@ function translateFunctionParamToJavaType( imports.add('com.facebook.react.bridge.Callback'); return wrapOptional('Callback', isRequired); default: - (realTypeAnnotation.type: 'MixedTypeAnnotation'); + realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error(createErrorMessage(realTypeAnnotation.type)); } } @@ -302,7 +302,7 @@ function translateFunctionReturnTypeToJavaType( case 'RootTag': return wrapOptional('double', isRequired); default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error(createErrorMessage(realTypeAnnotation.name)); } case 'VoidTypeAnnotation': @@ -349,7 +349,7 @@ function translateFunctionReturnTypeToJavaType( case 'string': return wrapOptional('String', isRequired); default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'ObjectTypeAnnotation': @@ -362,7 +362,7 @@ function translateFunctionReturnTypeToJavaType( imports.add('com.facebook.react.bridge.WritableArray'); return wrapOptional('WritableArray', isRequired); default: - (realTypeAnnotation.type: 'MixedTypeAnnotation'); + realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error(createErrorMessage(realTypeAnnotation.type)); } } @@ -388,7 +388,7 @@ function getFalsyReturnStatementFromReturnType( case 'RootTag': return 'return 0.0;'; default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error(createErrorMessage(realTypeAnnotation.name)); } case 'VoidTypeAnnotation': @@ -430,7 +430,7 @@ function getFalsyReturnStatementFromReturnType( case 'string': return nullable ? 'return null;' : 'return "";'; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'StringTypeAnnotation': @@ -444,7 +444,7 @@ function getFalsyReturnStatementFromReturnType( case 'ArrayTypeAnnotation': return 'return null;'; default: - (realTypeAnnotation.type: 'MixedTypeAnnotation'); + realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error(createErrorMessage(realTypeAnnotation.type)); } } diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js index a1dc7860e022..55be945773f4 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js @@ -157,7 +157,7 @@ function translateReturnTypeToKind( case 'RootTag': return 'NumberKind'; default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error( `Invalid ReservedFunctionValueTypeName name, got ${realTypeAnnotation.name}`, ); @@ -195,7 +195,7 @@ function translateReturnTypeToKind( case 'string': return 'StringKind'; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'NumberTypeAnnotation': @@ -217,7 +217,7 @@ function translateReturnTypeToKind( case 'ArrayTypeAnnotation': return 'ArrayKind'; default: - (realTypeAnnotation.type: 'MixedTypeAnnotation'); + realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( `Unknown prop type for returning value, found: ${realTypeAnnotation.type}"`, ); @@ -246,7 +246,7 @@ function translateParamTypeToJniType( case 'RootTag': return !isRequired ? 'Ljava/lang/Double;' : 'D'; default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error( `Invalid ReservedFunctionValueTypeName name, got ${realTypeAnnotation.name}`, ); @@ -282,7 +282,7 @@ function translateParamTypeToJniType( case 'string': return 'Ljava/lang/String;'; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'NumberTypeAnnotation': @@ -304,7 +304,7 @@ function translateParamTypeToJniType( case 'FunctionTypeAnnotation': return 'Lcom/facebook/react/bridge/Callback;'; default: - (realTypeAnnotation.type: 'MixedTypeAnnotation'); + realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( `Unknown prop type for method arg, found: ${realTypeAnnotation.type}"`, ); @@ -328,7 +328,7 @@ function translateReturnTypeToJniType( case 'RootTag': return nullable ? 'Ljava/lang/Double;' : 'D'; default: - (realTypeAnnotation.name: empty); + realTypeAnnotation.name as empty; throw new Error( `Invalid ReservedFunctionValueTypeName name, got ${realTypeAnnotation.name}`, ); @@ -366,7 +366,7 @@ function translateReturnTypeToJniType( case 'string': return 'Ljava/lang/String;'; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'NumberTypeAnnotation': @@ -388,7 +388,7 @@ function translateReturnTypeToJniType( case 'ArrayTypeAnnotation': return 'Lcom/facebook/react/bridge/WritableArray;'; default: - (realTypeAnnotation.type: 'MixedTypeAnnotation'); + realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( `Unknown prop type for method return type, found: ${realTypeAnnotation.type}"`, ); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js index e8775b28aadf..2cc39108680b 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js @@ -155,7 +155,7 @@ class StructCollector { type: 'StringTypeAnnotation', }); default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member types`); } } catch (ex) { @@ -235,7 +235,7 @@ class StructCollector { }); break; default: - (structContext: empty); + structContext as empty; throw new Error(`Detected an invalid struct context: ${structContext}`); } } diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js index 8ab9b2ba5d71..065de9be18ea 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js @@ -96,7 +96,7 @@ function toObjCValue( case 'RootTag': return wrapPrimitive('double'); default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error( `Couldn't convert into ObjC type: ${typeAnnotation.type}"`, ); @@ -167,7 +167,7 @@ function toObjCValue( ? `${value}.has_value() ? ${value}.value().buildUnsafeRawValue() : nil` : `${value}.buildUnsafeRawValue()`; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Couldn't convert into ObjC value: ${typeAnnotation.type}"`, ); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js index 820ffbd23933..056eed66d3f0 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js @@ -85,7 +85,7 @@ function toObjCValue( case 'RootTag': return RCTBridgingTo('Double'); default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error( `Couldn't convert into ObjC type: ${typeAnnotation.type}"`, ); @@ -159,7 +159,7 @@ function toObjCValue( ? `(${value} == nil ? std::nullopt : std::make_optional(${namespacedStructName}(${value})))` : `${namespacedStructName}(${value})`; default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Couldn't convert into ObjC value: ${typeAnnotation.type}"`, ); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStructUtils.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStructUtils.js index c2e0bf1fcf95..7ca3578f361e 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStructUtils.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStructUtils.js @@ -36,7 +36,7 @@ function toObjCType( case 'RootTag': return wrapCxxOptional('double', isRequired); default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error(`Unknown prop type, found: ${typeAnnotation.name}"`); } case 'StringTypeAnnotation': @@ -105,7 +105,7 @@ function toObjCType( isRequired, ); default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Couldn't convert into ObjC type: ${typeAnnotation.type}"`, ); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js index b1dd15c6d0c5..72582c12bf7c 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js @@ -34,7 +34,7 @@ function getEventEmitterTypeObjCType( case 'string': return 'NSString *_Nonnull'; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'NumberTypeAnnotation': @@ -58,7 +58,7 @@ function getEventEmitterTypeObjCType( `Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`, ); default: - (typeAnnotation.type: empty); + typeAnnotation.type as empty; throw new Error( `Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`, ); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js index ed6fda95bfa6..c618b0f78c54 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js @@ -250,7 +250,7 @@ function getParamObjCType( case 'RootTag': return notStruct(isRequired ? 'double' : 'NSNumber *'); default: - (structTypeAnnotation.name: empty); + structTypeAnnotation.name as empty; throw new Error( `Unsupported type for param "${paramName}" in ${methodName}. Found: ${structTypeAnnotation.type}`, ); @@ -290,7 +290,7 @@ function getParamObjCType( case 'GenericObjectTypeAnnotation': return notStruct(wrapOptional('NSDictionary *', !nullable)); default: - (structTypeAnnotation.type: empty); + structTypeAnnotation.type as empty; throw new Error( `Unsupported type for param "${paramName}" in ${methodName}. Found: ${typeAnnotation.type}`, ); @@ -330,7 +330,7 @@ function getReturnObjCType( case 'RootTag': return wrapOptional('NSNumber *', isRequired); default: - (typeAnnotation.name: empty); + typeAnnotation.name as empty; throw new Error( `Unsupported return type for ${methodName}. Found: ${typeAnnotation.name}`, ); @@ -382,13 +382,13 @@ function getReturnObjCType( // In the legacy codegen, we don't surround NSSTring * with _Nullable return wrapOptional('NSString *', isRequired); default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'GenericObjectTypeAnnotation': return wrapOptional('NSDictionary *', isRequired); default: - (typeAnnotation.type: 'MixedTypeAnnotation'); + typeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( `Unsupported return type for ${methodName}. Found: ${typeAnnotation.type}`, ); @@ -456,11 +456,11 @@ function getReturnJSType( case 'string': return 'StringKind'; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member types`); } default: - (typeAnnotation.type: 'MixedTypeAnnotation'); + typeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( `Unsupported return type for ${methodName}. Found: ${typeAnnotation.type}`, ); diff --git a/packages/react-native-codegen/src/parsers/flow/components/commands.js b/packages/react-native-codegen/src/parsers/flow/components/commands.js index 7874ab8534a3..8800427a6157 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -131,7 +131,7 @@ function buildCommandSchema( }; break; default: - (type: unknown); + (type) as unknown; throw new Error( `Unsupported param type for method "${name}", param "${paramName}". Found ${type}`, ); diff --git a/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js b/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js index b3d57458beb2..c0cdfab9a7ad 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js @@ -169,7 +169,7 @@ function getTypeAnnotationForArray<+T>( if (unionType === 'StringLiteralTypeAnnotation') { return { type: 'StringEnumTypeAnnotation', - default: (defaultValue: string), + default: defaultValue as string, options: typeAnnotation.types.map(option => option.value), }; } else if (unionType === 'NumberLiteralTypeAnnotation') { @@ -313,32 +313,32 @@ function getTypeAnnotation<+T>( case 'Int32': return { type: 'Int32TypeAnnotation', - default: ((defaultValue ? defaultValue : 0): number), + default: (defaultValue ? defaultValue : 0) as number, }; case 'Double': return { type: 'DoubleTypeAnnotation', - default: ((defaultValue ? defaultValue : 0): number), + default: (defaultValue ? defaultValue : 0) as number, }; case 'Float': return { type: 'FloatTypeAnnotation', default: withNullDefault - ? (defaultValue: number | null) - : ((defaultValue ? defaultValue : 0): number), + ? (defaultValue as number | null) + : ((defaultValue ? defaultValue : 0) as number), }; case 'BooleanTypeAnnotation': return { type: 'BooleanTypeAnnotation', default: withNullDefault - ? (defaultValue: boolean | null) - : ((defaultValue == null ? false : defaultValue): boolean), + ? (defaultValue as boolean | null) + : ((defaultValue == null ? false : defaultValue) as boolean), }; case 'StringTypeAnnotation': if (typeof defaultValue !== 'undefined') { return { type: 'StringTypeAnnotation', - default: (defaultValue: string | null), + default: defaultValue as string | null, }; } throw new Error(`A default string (or null) is required for "${name}"`); @@ -346,7 +346,7 @@ function getTypeAnnotation<+T>( if (typeof defaultValue !== 'undefined') { return { type: 'StringTypeAnnotation', - default: (defaultValue: string | null), + default: defaultValue as string | null, }; } throw new Error(`A default string (or null) is required for "${name}"`); @@ -366,13 +366,13 @@ function getTypeAnnotation<+T>( if (unionType === 'StringLiteralTypeAnnotation') { return { type: 'StringEnumTypeAnnotation', - default: (defaultValue: string), + default: defaultValue as string, options: typeAnnotation.types.map(option => option.value), }; } else if (unionType === 'NumberLiteralTypeAnnotation') { return { type: 'Int32EnumTypeAnnotation', - default: (defaultValue: number), + default: defaultValue as number, options: typeAnnotation.types.map(option => option.value), }; } else { diff --git a/packages/react-native-codegen/src/parsers/flow/modules/index.js b/packages/react-native-codegen/src/parsers/flow/modules/index.js index 5d946f2404b5..215a5db8aaa5 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/index.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/index.js @@ -197,10 +197,12 @@ function translateTypeAnnotation( const objectTypeAnnotation = { type: 'ObjectTypeAnnotation', // $FlowFixMe[missing-type-arg] - properties: ([ - ...typeAnnotation.properties, - ...typeAnnotation.indexers, - ]: Array<$FlowFixMe>) + properties: ( + [ + ...typeAnnotation.properties, + ...typeAnnotation.indexers, + ] as Array<$FlowFixMe> + ) .map>>( property => { return tryParse(() => { diff --git a/packages/react-native-codegen/src/parsers/parsers-commons.js b/packages/react-native-codegen/src/parsers/parsers-commons.js index 20f5ec396855..c5b39e69de68 100644 --- a/packages/react-native-codegen/src/parsers/parsers-commons.js +++ b/packages/react-native-codegen/src/parsers/parsers-commons.js @@ -763,9 +763,9 @@ const buildModuleSchema = ( ): NativeModuleSchema => { const language = parser.language(); const types = parser.getTypes(ast); - const moduleSpecs = (Object.values(types): ReadonlyArray<$FlowFixMe>).filter( - t => parser.isModuleInterface(t), - ); + const moduleSpecs = ( + Object.values(types) as ReadonlyArray<$FlowFixMe> + ).filter(t => parser.isModuleInterface(t)); throwIfModuleInterfaceNotFound( moduleSpecs.length, diff --git a/packages/react-native-codegen/src/parsers/parsers-primitives.js b/packages/react-native-codegen/src/parsers/parsers-primitives.js index fb75f8abed74..3243a9a95cfd 100644 --- a/packages/react-native-codegen/src/parsers/parsers-primitives.js +++ b/packages/react-native-codegen/src/parsers/parsers-primitives.js @@ -436,7 +436,7 @@ function emitUnion( parser: Parser, ): Nullable { const unparsedMemberTypes: ReadonlyArray<$FlowFixMe> = - (typeAnnotation.types: ReadonlyArray<$FlowFixMe>); + typeAnnotation.types as ReadonlyArray<$FlowFixMe>; const memberTypes = unparsedMemberTypes.map( (memberType: $FlowFixMe): NativeModuleUnionTypeAnnotationMemberType => { diff --git a/packages/react-native-codegen/src/parsers/typescript/components/commands.js b/packages/react-native-codegen/src/parsers/typescript/components/commands.js index dc35f3304bb4..f51d7ccede32 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/commands.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/commands.js @@ -102,7 +102,7 @@ function buildCommandSchemaInternal( }; break; default: - (type: unknown); + (type) as unknown; throw new Error( `Unsupported param type for method "${name}", param "${paramName}". Found ${type}`, ); diff --git a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js index 53259bb7e0fd..23d16906883b 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js @@ -51,7 +51,7 @@ function getUnionOfLiterals( ) { return { type: 'StringEnumTypeAnnotation', - default: (defaultValue: string), + default: defaultValue as string, options: elementTypes.map(option => option.literal.value), }; } else if ( @@ -63,7 +63,7 @@ function getUnionOfLiterals( } else { return { type: 'Int32EnumTypeAnnotation', - default: (defaultValue: number), + default: defaultValue as number, options: elementTypes.map(option => option.literal.value), }; } @@ -335,7 +335,7 @@ function getTypeAnnotationForArray( type: 'FloatTypeAnnotation', }; default: - (type: unknown); + (type) as unknown; throw new Error(`Unknown prop type for "${name}": ${type}`); } } @@ -347,16 +347,15 @@ function setDefaultValue( switch (common.type) { case 'Int32TypeAnnotation': case 'DoubleTypeAnnotation': - common.default = ((defaultValue ? defaultValue : 0): number); + common.default = (defaultValue ? defaultValue : 0) as number; break; case 'FloatTypeAnnotation': - /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition - * roll out. See https://fburl.com/workplace/5whu3i34. */ - common.default = ((defaultValue === null - ? null - : defaultValue - ? defaultValue - : 0): number | null); + common.default = + /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition + * roll out. See https://fburl.com/workplace/5whu3i34. */ + (defaultValue === null ? null : defaultValue ? defaultValue : 0) as + | number + | null; break; case 'BooleanTypeAnnotation': /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition @@ -364,9 +363,9 @@ function setDefaultValue( common.default = defaultValue === null ? null : !!defaultValue; break; case 'StringTypeAnnotation': - common.default = ((defaultValue === undefined ? null : defaultValue): + common.default = (defaultValue === undefined ? null : defaultValue) as | string - | null); + | null; break; } } diff --git a/packages/react-native-compatibility-check/src/ErrorFormatting.js b/packages/react-native-compatibility-check/src/ErrorFormatting.js index ddbed90d7755..64d0d36a6866 100644 --- a/packages/react-native-compatibility-check/src/ErrorFormatting.js +++ b/packages/react-native-compatibility-check/src/ErrorFormatting.js @@ -91,7 +91,7 @@ export function formatErrorMessage( ); return error.message + formattedMembers.join(''); default: - (error.type: empty); + error.type as empty; return ''; } } @@ -114,7 +114,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { shortHandType = 'number'; break; default: - (annotation.memberType: empty); + annotation.memberType as empty; throw new Error('Unexpected enum memberType'); } @@ -130,7 +130,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { shortHandType = 'number'; break; default: - (annotation.memberType: empty); + annotation.memberType as empty; throw new Error('Unexptected enum memberType'); } @@ -213,7 +213,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { return ( '(' + // @lint-ignore-every FLOW_INCOMPATIBLE_TYPE_ARG - (annotation.types: ReadonlyArray) + (annotation.types as ReadonlyArray) .map(boolLit => formatTypeAnnotation(boolLit)) .join(' | ') + ')' @@ -229,7 +229,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { return ( '(' + // @lint-ignore-every FLOW_INCOMPATIBLE_TYPE_ARG - (annotation.types: ReadonlyArray) + (annotation.types as ReadonlyArray) .map(numLit => formatTypeAnnotation(numLit)) .join(' | ') + ')' @@ -247,7 +247,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { return ( '(' + // @lint-ignore-every FLOW_INCOMPATIBLE_TYPE_ARG - (annotation.types: ReadonlyArray) + (annotation.types as ReadonlyArray) .map(stringLit => formatTypeAnnotation(stringLit)) .join(' | ') + ')' @@ -256,7 +256,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { // Unions of strings and string literals are treated as just strings return `Union`; default: - (validUnionType: empty); + validUnionType as empty; throw new Error(`Unsupported union member type`); } case 'StringTypeAnnotation': @@ -281,7 +281,7 @@ function formatTypeAnnotation(annotation: CompleteTypeAnnotation): string { return 'Object'; default: - (annotation.type: empty); + annotation.type as empty; return JSON.stringify(annotation); } } @@ -351,7 +351,7 @@ export function formatDiffSet(summary: DiffSummary): FormattedDiffSummary { formattedIncompatibilities[hasteModule] = formattedIncompat; }); return { - status: (summaryStatus: 'incompatible'), + status: summaryStatus as 'incompatible', incompatibilityReport: formattedIncompatibilities, }; } diff --git a/packages/react-native-compatibility-check/src/SortTypeAnnotations.js b/packages/react-native-compatibility-check/src/SortTypeAnnotations.js index 1d984a6f3bd7..81b2e425f861 100644 --- a/packages/react-native-compatibility-check/src/SortTypeAnnotations.js +++ b/packages/react-native-compatibility-check/src/SortTypeAnnotations.js @@ -158,7 +158,7 @@ export function compareTypeAnnotationForSorting( case 'MixedTypeAnnotation': return 0; default: - (typeA.type: empty); + typeA.type as empty; return -1; } } @@ -282,7 +282,7 @@ function typeAnnotationArbitraryOrder(annotation: CompleteTypeAnnotation) { case 'UnionTypeAnnotation': return 30; default: - (annotation.type: empty); + annotation.type as empty; return -1; } } diff --git a/packages/react-native-compatibility-check/src/TypeDiffing.js b/packages/react-native-compatibility-check/src/TypeDiffing.js index 14a9b7171ad8..bdc081aeeef7 100644 --- a/packages/react-native-compatibility-check/src/TypeDiffing.js +++ b/packages/react-native-compatibility-check/src/TypeDiffing.js @@ -271,7 +271,7 @@ export function compareTypeAnnotation( return compareReservedTypeAnnotation(newerAnnotation, olderAnnotation); default: // Flow exhaustiveness check - (newerAnnotation: empty); + newerAnnotation as empty; throw new Error(`Unsupported type annotation: ${newerAnnotation.type}`); } } @@ -494,7 +494,7 @@ function comparePropertyArrays( )(comparedTypes.errorLog); return result; default: - (comparedTypes: empty); + comparedTypes as empty; throw new Error('Unsupported status ' + comparedTypes.status); } } @@ -694,7 +694,7 @@ export function compareEnumDeclarationMemberArrays( break; default: // Flow exhaustiveness check - (comparedTypes: empty); + comparedTypes as empty; throw new Error('Unsupported status ' + comparedTypes.status); } } else if (newerName > olderName) { @@ -774,7 +774,7 @@ export function compareUnionMemberArrays( break; default: // Flow exhaustiveness check - (headComparison: empty); + headComparison as empty; throw new Error('Unsupported status ' + headComparison.status); } } else if (sortComparison > 0) { @@ -1632,7 +1632,7 @@ function compareReservedTypeAnnotation( case 'DimensionPrimitive': return {status: 'matching'}; default: - (newerAnnotation.name: empty); + newerAnnotation.name as empty; throw new Error('Unknown reserved type ' + newerAnnotation.name); } } diff --git a/packages/react-native-compatibility-check/src/VersionDiffing.js b/packages/react-native-compatibility-check/src/VersionDiffing.js index 48e8c0706f67..bc6becfcc3b6 100644 --- a/packages/react-native-compatibility-check/src/VersionDiffing.js +++ b/packages/react-native-compatibility-check/src/VersionDiffing.js @@ -268,7 +268,7 @@ function nestedPropertiesCheck( } return currentCheck; default: - (result.status: empty); + result.status as empty; return []; } } @@ -939,7 +939,7 @@ export function assessComparisonResult( ); break; default: - (oldDirection: empty); + oldDirection as empty; throw new Error( 'Unsupported native boundary direction ' + oldDirection, ); @@ -1063,7 +1063,7 @@ export function assessComparisonResult( }); break; default: - (oldDirection: empty); + oldDirection as empty; throw new Error('Unknown direction : ' + oldDirection); } /* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This @@ -1080,7 +1080,7 @@ export function assessComparisonResult( } break; default: - (difference.status: empty); + difference.status as empty; throw new Error('Unsupported status: ' + difference.status); } }; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow index 25c2367b7264..e8274cc23b77 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow @@ -25,6 +25,6 @@ export type Props = Readonly<{ width?: WithDefault, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow index e12e8910ac53..447b5e2587ee 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow @@ -25,6 +25,6 @@ export type Props = Readonly<{ width: Int32, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow index 9176e3dac702..b015ec3a9c43 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow @@ -34,6 +34,6 @@ export type Props = Readonly<{ height?: WithDefault, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow index 9c449f413763..8a7ea8935ef7 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow @@ -19,6 +19,6 @@ export type Props = Readonly<{ sizes?: WithDefault, 'small'>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow index ae34e13fa71c..83b0b79dddd4 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow @@ -19,6 +19,6 @@ export type Props = Readonly<{ sizes?: WithDefault, 'small'>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow index 640e75ec0f02..7dedc01870a1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow @@ -24,6 +24,6 @@ export type Props = Readonly<{ height?: WithDefault, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow index 603796543b7e..4f766acf374f 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow @@ -24,6 +24,6 @@ export type Props = Readonly<{ height?: WithDefault, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow index f984ef5f3e19..f0a0791fc3cf 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow @@ -30,6 +30,6 @@ export type Props = Readonly<{ }>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow index 9f4eb4de26e2..e9997e5cc87c 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow @@ -30,6 +30,6 @@ export type Props = Readonly<{ }>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow index e6a54c4f22a8..aa3e584cf372 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow @@ -29,6 +29,6 @@ export type Props = Readonly<{ }>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow index 7d251a902361..a1f9fddbee0b 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow @@ -19,6 +19,6 @@ export type Props = Readonly<{ size?: WithDefault<'small' | 'huge' | 'large', 'small'>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow index bb82078775e6..f3c11fac0cd0 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow @@ -19,6 +19,6 @@ export type Props = Readonly<{ size?: WithDefault<'small' | 'large', 'small'>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow index 4615e09adc11..12e79a1a3c4b 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow @@ -24,6 +24,6 @@ export type Props = Readonly<{ height?: WithDefault, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow index 1695477144dd..c36ee482c630 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow @@ -17,6 +17,6 @@ export type Props = Readonly<{ ...ViewProps, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'NativeComponent', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow index 93fbf9575847..181a16394c65 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow @@ -28,6 +28,6 @@ export interface Spec extends TurboModule { +afterMatchingGeneric: (a: AfterMatchingGeneric) => void; } -(TurboModuleRegistry.getEnforcing( +TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow index f1fd5a5f5f8f..8f7de8386a62 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow @@ -72,6 +72,6 @@ export interface Spec extends TurboModule { +simpleArrayChange: (a: SimpleArrayChange) => void; } - (TurboModuleRegistry.getEnforcing( + TurboModuleRegistry.getEnforcing( 'NativeModuleTest', - ): Spec); + ) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow index b9bab7d651d6..3f4c570cf250 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow @@ -65,6 +65,6 @@ export interface Spec extends TurboModule { +simpleArrayChange: (a: SimpleArrayChange) => void; } -(TurboModuleRegistry.getEnforcing( +TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow index a7800a22f518..77455654a4d1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow index 29342b33c5fd..9a3af67e4d8c 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }>; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow index 82885474f329..944e5ebcdd9a 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow index 603030e24bb1..e9f36f05ad2b 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }>; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow index ee6abb89868a..8af008dc5670 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow index fb537117b543..9a4ebdc57d1c 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow @@ -17,6 +17,6 @@ export interface Spec extends TurboModule { +getConstants: () => Readonly<{}>; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow index 633e17bca56e..6705dc831d4f 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow @@ -17,6 +17,6 @@ export interface Spec extends TurboModule { +getConstants: () => {}; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow index 8a665abdf2d5..3c908428e969 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow @@ -18,6 +18,6 @@ export interface Spec extends TurboModule { +exampleFunction: (a: MyType, b: number) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow index 79bf39c71bbf..56a1908cb607 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow @@ -18,6 +18,6 @@ export interface Spec extends TurboModule { +exampleFunction: (a: MyType, b: number) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow index 2ee8a14bbc33..47a742ae444a 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow @@ -27,6 +27,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow index 4762d412f490..17a07752fa39 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow @@ -27,6 +27,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow index eb7e82106bd5..f2c638174886 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow @@ -27,6 +27,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow index 6cf8cdf2f81e..8bee824e2144 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow @@ -26,6 +26,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow index a3fccd7a0e1f..f27cc20a7b33 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow @@ -219,6 +219,6 @@ export interface Spec extends TurboModule { +enumUnsorted: (a: EnumUnsorted) => void; } -(TurboModuleRegistry.getEnforcing( +TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow index 90274b8f2ced..d3b76db667f0 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow index fdef3b523539..6bfaf126dace 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow index 06ad4f8b5a76..97c14a626e5b 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow @@ -26,6 +26,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow index 1998ecb7d6ca..b976a2795881 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow @@ -26,6 +26,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow index 4c980e0fe510..f1ec89117bd4 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow @@ -25,6 +25,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow index 7bb2d076f276..09e201a6c843 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow @@ -25,6 +25,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow index 31c57e02ee28..a70bf90322c1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow @@ -25,6 +25,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow index e0559fee9382..9463313d32e0 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow @@ -26,6 +26,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow index 4c488ecc59eb..287e8ccfe70a 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow @@ -25,6 +25,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow index 2514a8aa3793..3c3a4b4f88d1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow @@ -25,6 +25,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow index a17ac1454598..9d632d7c2faf 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow @@ -26,6 +26,6 @@ export interface Spec extends TurboModule { onSubmit: EventEmitter; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow index d4b83987e11d..c993ddcb4bbf 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow @@ -26,6 +26,6 @@ export interface Spec extends TurboModule { onSubmit: EventEmitter; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow index 0ffe3ce3a1e9..26c5adb3cb0b 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow index a3e2aeb11e32..9f2c88d7cfbe 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow @@ -22,6 +22,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow index a9b2ff86a22d..9c4b5e278cc9 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow index b86c78411805..9959a7de531a 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow index aff7f31947c5..12b23fc01aaa 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow index 0a10a45bb164..85168428f4aa 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow index 53f5816c44e3..351e61da2d48 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow index 864396cb683e..e2bb96047bb8 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow index a0cf8ca82357..00676cf3ca9e 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow index e17b41dd1f24..ba7cb421101d 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow @@ -36,6 +36,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow index 9c42989298fc..23a4a19e3452 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow @@ -32,6 +32,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow index ba6912efde3f..39555ab1f767 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow @@ -31,6 +31,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow index 6cbbd9bcb4fd..affde92dc8c2 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow index 0015b1e10821..9a1e788e3b1d 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow index eba04a1f8b6b..f84d19c86fae 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow @@ -19,6 +19,6 @@ export interface Spec extends TurboModule { }; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeModuleTest', -): Spec); +) as Spec; diff --git a/packages/react-native-compatibility-check/src/convertPropToBasicTypes.js b/packages/react-native-compatibility-check/src/convertPropToBasicTypes.js index a7cf6d9c96ef..96db09e7e511 100644 --- a/packages/react-native-compatibility-check/src/convertPropToBasicTypes.js +++ b/packages/react-native-compatibility-check/src/convertPropToBasicTypes.js @@ -76,7 +76,7 @@ export default function convertPropToBasicTypes( resultingType = inputType; break; case 'ObjectTypeAnnotation': - resultingType = ({ + resultingType = { type: 'ObjectTypeAnnotation', ...(inputType.baseTypes != null ? {baseTypes: inputType.baseTypes} @@ -86,16 +86,16 @@ export default function convertPropToBasicTypes( optional: property.optional, typeAnnotation: convertPropToBasicTypes(property.typeAnnotation), })), - }: ObjectTypeAnnotation); + } as ObjectTypeAnnotation; break; case 'ArrayTypeAnnotation': - resultingType = ({ + resultingType = { type: 'ArrayTypeAnnotation', elementType: convertPropToBasicTypes(inputType.elementType), - }: ArrayTypeAnnotation); + } as ArrayTypeAnnotation; break; default: - (inputType.type: empty); + inputType.type as empty; throw new Error('Unexpected type ' + inputType.type); } diff --git a/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js b/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js index 4d776ee7e3e7..331d1d56854b 100644 --- a/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js +++ b/packages/react-native-popup-menu-android/js/PopupMenuAndroidNativeComponent.android.js @@ -45,6 +45,6 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['show'], }); -export default (codegenNativeComponent( +export default codegenNativeComponent( 'AndroidPopupMenu', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/Libraries/Animated/AnimatedImplementation.js b/packages/react-native/Libraries/Animated/AnimatedImplementation.js index 740ac6d4708a..46a08d2e8954 100644 --- a/packages/react-native/Libraries/Animated/AnimatedImplementation.js +++ b/packages/react-native/Libraries/Animated/AnimatedImplementation.js @@ -118,8 +118,8 @@ const maybeVectorAnim = function ( configY[key] = y; } } - const aX = anim((value: AnimatedValueXY).x, configX); - const aY = anim((value: AnimatedValueXY).y, configY); + const aX = anim((value as AnimatedValueXY).x, configX); + const aY = anim((value as AnimatedValueXY).y, configY); // We use `stopTogether: false` here because otherwise tracking will break // because the second animation will get stopped before it can update. return parallelImpl([aX, aY], {stopTogether: false}); @@ -142,10 +142,10 @@ const maybeVectorAnim = function ( configA[key] = a; } } - const aR = anim((value: AnimatedColor).r, configR); - const aG = anim((value: AnimatedColor).g, configG); - const aB = anim((value: AnimatedColor).b, configB); - const aA = anim((value: AnimatedColor).a, configA); + const aR = anim((value as AnimatedColor).r, configR); + const aG = anim((value as AnimatedColor).g, configG); + const aB = anim((value as AnimatedColor).b, configB); + const aA = anim((value as AnimatedColor).a, configA); // We use `stopTogether: false` here because otherwise tracking will break // because the second animation will get stopped before it can update. return parallelImpl([aR, aG, aB, aA], {stopTogether: false}); diff --git a/packages/react-native/Libraries/Animated/components/AnimatedImage.js b/packages/react-native/Libraries/Animated/components/AnimatedImage.js index 8ecb4e0b5e75..8353148d8fa7 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedImage.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedImage.js @@ -14,10 +14,10 @@ import Image from '../../Image/Image'; import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; -export default (createAnimatedComponent< +export default createAnimatedComponent< $FlowFixMe, React.ElementRef, ->((Image: $FlowFixMe)): AnimatedComponentType< +>(Image as $FlowFixMe) as AnimatedComponentType< React.ElementConfig, React.ElementRef, ->); +>; diff --git a/packages/react-native/Libraries/Animated/components/AnimatedText.js b/packages/react-native/Libraries/Animated/components/AnimatedText.js index 29e643a4f6ad..7e67641db1fa 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedText.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedText.js @@ -14,10 +14,10 @@ import Text, {type TextProps} from '../../Text/Text'; import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; -export default (createAnimatedComponent< +export default createAnimatedComponent< $FlowFixMe, React.ElementRef, ->((Text: $FlowFixMe)): AnimatedComponentType< +>(Text as $FlowFixMe) as AnimatedComponentType< TextProps, React.ElementRef, ->); +>; diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js index b0de039b4026..7f068989e061 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js @@ -61,12 +61,12 @@ function processColor( if (isRgbaValue(color)) { // $FlowFixMe[incompatible-type] - Type is verified above - return (color: RgbaValue); + return color as RgbaValue; } let normalizedColor: ?ProcessedColorValue = normalizeColor( // $FlowFixMe[incompatible-type] - Type is verified above - (color: ColorValue), + color as ColorValue, ); if (normalizedColor === undefined || normalizedColor === null) { return null; @@ -118,14 +118,14 @@ export function getRgbaValueAndNativeColor( }> { const processedColor: RgbaValue | NativeColorValue = // $FlowFixMe[incompatible-type] - Type is verified above - processColor((value: ColorValue | RgbaValue)) ?? defaultColor; + processColor(value as ColorValue | RgbaValue) ?? defaultColor; if (isRgbaValue(processedColor)) { // $FlowFixMe[incompatible-type] - Type is verified above - return {rgbaValue: (processedColor: RgbaValue)}; + return {rgbaValue: processedColor as RgbaValue}; } else { return { // $FlowFixMe[incompatible-type] - Type is verified above - nativeColor: (processedColor: NativeColorValue), + nativeColor: processedColor as NativeColorValue, rgbaValue: defaultColor, }; } @@ -147,7 +147,7 @@ export default class AnimatedColor extends AnimatedWithChildren { valueIn ?? defaultColor; if (isRgbaAnimatedValue(value)) { // $FlowFixMe[incompatible-type] - Type is verified above - const rgbaAnimatedValue: RgbaAnimatedValue = (value: RgbaAnimatedValue); + const rgbaAnimatedValue: RgbaAnimatedValue = value as RgbaAnimatedValue; this.r = rgbaAnimatedValue.r; this.g = rgbaAnimatedValue.g; this.b = rgbaAnimatedValue.b; @@ -155,7 +155,7 @@ export default class AnimatedColor extends AnimatedWithChildren { } else { const {rgbaValue: initColor, nativeColor} = getRgbaValueAndNativeColor( // $FlowFixMe[incompatible-type] - Type is verified above - (value: ColorValue | RgbaValue), + value as ColorValue | RgbaValue, ); if (nativeColor) { this.nativeColor = nativeColor; diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js index 6784906c9014..951657fd59fb 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -51,7 +51,7 @@ export type InterpolationConfigType< function createNumericInterpolation( config: InterpolationConfigType, ): (input: number) => number { - const outputRange: ReadonlyArray = (config.outputRange: any); + const outputRange: ReadonlyArray = config.outputRange as any; const inputRange = config.inputRange; const easing = config.easing || Easing.linear; @@ -77,7 +77,7 @@ function createNumericInterpolation( ); const range = findRange(input, inputRange); - return (interpolate( + return interpolate( input, inputRange[range], inputRange[range + 1], @@ -86,7 +86,7 @@ function createNumericInterpolation( easing, extrapolateLeft, extrapolateRight, - ): any); + ) as any; }; } @@ -205,7 +205,7 @@ function mapStringToNumericComponents( const components: Array = []; let lastMatchEnd = 0; let match: RegExp$matchResult; - while ((match = (numericComponentRegex.exec(input): any)) != null) { + while ((match = numericComponentRegex.exec(input) as any) != null) { if (match.index > lastMatchEnd) { components.push(input.substring(lastMatchEnd, match.index)); } @@ -374,13 +374,13 @@ export default class AnimatedInterpolation< if (!this._interpolation) { const config = this._config; if (config.outputRange && typeof config.outputRange[0] === 'string') { - this._interpolation = (createStringInterpolation((config: any)): any); + this._interpolation = createStringInterpolation(config as any) as any; } else if (typeof config.outputRange[0] === 'object') { - this._interpolation = (createPlatformColorInterpolation( - (config: any), - ): any); + this._interpolation = createPlatformColorInterpolation( + config as any, + ) as any; } else { - this._interpolation = (createNumericInterpolation((config: any)): any); + this._interpolation = createNumericInterpolation(config as any) as any; } } return this._interpolation; @@ -426,7 +426,7 @@ export default class AnimatedInterpolation< let outputType = null; if (typeof outputRange[0] === 'string') { // $FlowFixMe[incompatible-type] - outputRange = ((outputRange: ReadonlyArray).map(value => { + outputRange = (outputRange as ReadonlyArray).map(value => { const processedColor = processColor(value); if (typeof processedColor === 'number') { outputType = 'color'; @@ -434,7 +434,7 @@ export default class AnimatedInterpolation< } else { return NativeAnimatedHelper.transformDataType(value); } - }): any); + }) as any; } else if (typeof outputRange[0] === 'object') { outputType = 'platform_color'; } diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedTracking.js b/packages/react-native/Libraries/Animated/nodes/AnimatedTracking.js index 8fabf2cc9fdc..d50d2921e5b0 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedTracking.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedTracking.js @@ -79,7 +79,7 @@ export default class AnimatedTracking extends AnimatedNode { this._value.animate( new this._animationClass({ ...this._animationConfig, - toValue: (this._animationConfig.toValue: any).__getValue(), + toValue: (this._animationConfig.toValue as any).__getValue(), }), this._callback, ); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js index 30b94a3a67fd..8650912edf6f 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js @@ -58,7 +58,7 @@ export function flushValue(rootNode: AnimatedNode): void { function findAnimatedStyles(node: AnimatedNode) { // $FlowFixMe[prop-missing] if (typeof node.update === 'function') { - leaves.add((node: any)); + leaves.add(node as any); } else { node.__getChildren().forEach(findAnimatedStyles); } diff --git a/packages/react-native/Libraries/BatchedBridge/NativeModules.js b/packages/react-native/Libraries/BatchedBridge/NativeModules.js index 95f1339d8ce9..c38eab148e98 100644 --- a/packages/react-native/Libraries/BatchedBridge/NativeModules.js +++ b/packages/react-native/Libraries/BatchedBridge/NativeModules.js @@ -114,7 +114,7 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { errorData => reject( updateErrorWithErrorData( - (errorData: $FlowFixMe), + errorData as $FlowFixMe, enqueueingFrameError, ), ), diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index c1a71a9a3fa4..7fafb836fa89 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -352,7 +352,7 @@ function usePressState(forcePressed: boolean): [boolean, (boolean) => void] { const MemoedPressable = memo(Pressable); MemoedPressable.displayName = 'Pressable'; -export default (MemoedPressable: component( +export default MemoedPressable as component( ref?: React.RefSetter>, ...props: PressableProps -)); +); diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index 468814936a0a..c8392ea6e461 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -856,7 +856,7 @@ class ScrollView extends React.Component { getScrollResponder: ScrollViewImperativeMethods['getScrollResponder'] = () => { // $FlowFixMe[unclear-type] - return ((this: any): ScrollResponderType); + return this as any as ScrollResponderType; }; getScrollableNode: ScrollViewImperativeMethods['getScrollableNode'] = () => { @@ -1958,5 +1958,5 @@ ScrollViewWrapper.displayName = 'ScrollView'; // $FlowExpectedError[prop-missing] ScrollViewWrapper.Context = ScrollViewContext; -export default ((ScrollViewWrapper: $FlowFixMe): typeof ScrollViewWrapper & - ScrollViewComponentStatics); +export default ScrollViewWrapper as $FlowFixMe as typeof ScrollViewWrapper & + ScrollViewComponentStatics; diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js index 336bf436a648..6e57b7a776aa 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js @@ -42,11 +42,11 @@ interface NativeCommands { ) => void; } -export default (codegenNativeCommands({ +export default codegenNativeCommands({ supportedCommands: [ 'flashScrollIndicators', 'scrollTo', 'scrollToEnd', 'zoomToRect', ], -}): NativeCommands); +}) as NativeCommands; diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index 72a249831a61..72804f697538 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -89,11 +89,11 @@ const ScrollViewStickyHeader: component( .interpolate({ extrapolateLeft: 'clamp', inputRange: [layoutY, layoutY + 1], - outputRange: ([0, 1]: Array), + outputRange: [0, 1] as Array, }) .interpolate({ inputRange: [0, 1], - outputRange: ([0, -1]: Array), + outputRange: [0, -1] as Array, }), -layoutHeight, 0, diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index 8d3c5530cf56..d441435a6c6d 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -196,7 +196,7 @@ const Switch: component( // We wrap the native state in an object to force the layout-effect // below to re-run whenever we get an update from native, even if it's // not different from the previous native state. - const [native, setNative] = useState({value: (null: ?boolean)}); + const [native, setNative] = useState({value: null as ?boolean}); const handleChange = (event: SwitchChangeEvent) => { // $FlowFixMe[unused-promise] diff --git a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index c8df67cb48fd..b0cf8dafd2d2 100644 --- a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -741,4 +741,4 @@ let AndroidTextInputNativeComponent = ); // flowlint-next-line unclear-type:off -export default ((AndroidTextInputNativeComponent: any): HostComponent); +export default AndroidTextInputNativeComponent as any as HostComponent; diff --git a/packages/react-native/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js b/packages/react-native/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js index 8c40af63337d..a85b55496ba0 100644 --- a/packages/react-native/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +++ b/packages/react-native/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js @@ -40,4 +40,4 @@ const MultilineTextInputNativeComponent: HostComponent<{...}> = ); // flowlint-next-line unclear-type:off -export default ((MultilineTextInputNativeComponent: any): HostComponent<{...}>); +export default MultilineTextInputNativeComponent as any as HostComponent<{...}>; diff --git a/packages/react-native/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js b/packages/react-native/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js index a52be63c5d1a..e3f4c092c3f6 100644 --- a/packages/react-native/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +++ b/packages/react-native/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js @@ -36,6 +36,6 @@ const SinglelineTextInputNativeComponent: HostComponent<{...}> = ); // flowlint-next-line unclear-type:off -export default ((SinglelineTextInputNativeComponent: any): HostComponent<{ +export default SinglelineTextInputNativeComponent as any as HostComponent<{ ... -}>); +}>; diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index e1d5ca1354a4..adca4e337572 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -655,14 +655,14 @@ function InternalTextInput(props: TextInputProps): React.Node { if (flattenedStyle != null) { let overrides: ?{...TextStyleInternal} = null; if (typeof flattenedStyle?.fontWeight === 'number') { - overrides = overrides || ({}: {...TextStyleInternal}); + overrides = overrides || ({} as {...TextStyleInternal}); overrides.fontWeight = // $FlowFixMe[incompatible-type] - (flattenedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']); + flattenedStyle.fontWeight.toString() as TextStyleInternal['fontWeight']; } if (flattenedStyle.verticalAlign != null) { - overrides = overrides || ({}: {...TextStyleInternal}); + overrides = overrides || ({} as {...TextStyleInternal}); overrides.textAlignVertical = verticalAlignToTextAlignVerticalMap[flattenedStyle.verticalAlign]; overrides.verticalAlign = undefined; @@ -693,7 +693,7 @@ function InternalTextInput(props: TextInputProps): React.Node { textInput = ( ( const PooledClass = { addPoolingTo: addPoolingTo, - oneArgumentPooler: (oneArgumentPooler: Pooler), - twoArgumentPooler: (twoArgumentPooler: Pooler), - threeArgumentPooler: (threeArgumentPooler: Pooler), - fourArgumentPooler: (fourArgumentPooler: Pooler), + oneArgumentPooler: oneArgumentPooler as Pooler, + twoArgumentPooler: twoArgumentPooler as Pooler, + threeArgumentPooler: threeArgumentPooler as Pooler, + fourArgumentPooler: fourArgumentPooler as Pooler, }; export default PooledClass; diff --git a/packages/react-native/Libraries/Components/Touchable/Touchable.js b/packages/react-native/Libraries/Components/Touchable/Touchable.js index 3428109bb23c..23358c37aaaa 100644 --- a/packages/react-native/Libraries/Components/Touchable/Touchable.js +++ b/packages/react-native/Libraries/Components/Touchable/Touchable.js @@ -947,7 +947,7 @@ const TouchableMixinImpl = { } }, - withoutDefaultFocusAndBlur: ({}: {...}), + withoutDefaultFocusAndBlur: {} as {...}, }; /** diff --git a/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js b/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js index 366d6b0974cb..d47ed4c6377f 100644 --- a/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js +++ b/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js @@ -33,17 +33,17 @@ const ReactFiberErrorDialog = { /* $FlowFixMe[class-object-subtyping] added when improving typing for * this parameters */ // $FlowFixMe[incompatible-type] - error = (errorValue: ExtendedError); + error = errorValue as ExtendedError; } else if (typeof errorValue === 'string') { /* $FlowFixMe[class-object-subtyping] added when improving typing for * this parameters */ // $FlowFixMe[incompatible-type] - error = (new SyntheticError(errorValue): ExtendedError); + error = new SyntheticError(errorValue) as ExtendedError; } else { /* $FlowFixMe[class-object-subtyping] added when improving typing for * this parameters */ // $FlowFixMe[incompatible-type] - error = (new SyntheticError('Unspecified error'): ExtendedError); + error = new SyntheticError('Unspecified error') as ExtendedError; } try { error.componentStack = componentStack; diff --git a/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js b/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js index 7ed749ffabeb..11668ce6bcec 100644 --- a/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js +++ b/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js @@ -29,7 +29,7 @@ export function checkVersions(): void { ) { console.error( `React Native version mismatch.\n\nJavaScript version: ${_formatVersion( - (ReactNativeVersion.version: $FlowFixMe), + ReactNativeVersion.version as $FlowFixMe, )}\n` + `Native version: ${_formatVersion(nativeVersion)}\n\n` + 'Make sure that you have rebuilt the native code. If the problem ' + diff --git a/packages/react-native/Libraries/Core/Timers/JSTimers.js b/packages/react-native/Libraries/Core/Timers/JSTimers.js index b0b57dfbc23b..8dd62b7e21e6 100644 --- a/packages/react-native/Libraries/Core/Timers/JSTimers.js +++ b/packages/react-native/Libraries/Core/Timers/JSTimers.js @@ -476,11 +476,11 @@ let ExportedJSTimers: { if (!NativeTiming) { console.warn("Timing native module is not available, can't set timers."); // $FlowFixMe[incompatible-type] : we can assume timers are generally available - ExportedJSTimers = ({ + ExportedJSTimers = { callReactNativeMicrotasks: JSTimers.callReactNativeMicrotasks, queueReactNativeMicrotask: JSTimers.queueReactNativeMicrotask, // $FlowFixMe[incompatible-variance] - }: typeof JSTimers); + } as typeof JSTimers; } else { // $FlowFixMe[incompatible-variance] ExportedJSTimers = JSTimers; diff --git a/packages/react-native/Libraries/Core/__mocks__/NativeExceptionsManager.js b/packages/react-native/Libraries/Core/__mocks__/NativeExceptionsManager.js index eec981f70ef2..5c02cc500a59 100644 --- a/packages/react-native/Libraries/Core/__mocks__/NativeExceptionsManager.js +++ b/packages/react-native/Libraries/Core/__mocks__/NativeExceptionsManager.js @@ -10,9 +10,9 @@ import typeof NativeExceptionsManager from '../NativeExceptionsManager'; -export default ({ +export default { reportFatalException: jest.fn(), reportSoftException: jest.fn(), dismissRedbox: jest.fn(), reportException: jest.fn(), -}: NativeExceptionsManager); +} as NativeExceptionsManager; diff --git a/packages/react-native/Libraries/Core/setUpSegmentFetcher.js b/packages/react-native/Libraries/Core/setUpSegmentFetcher.js index f56430ac5a0d..330a5c46df56 100644 --- a/packages/react-native/Libraries/Core/setUpSegmentFetcher.js +++ b/packages/react-native/Libraries/Core/setUpSegmentFetcher.js @@ -40,7 +40,7 @@ function __fetchSegment( ) => { if (errorObject) { const error = new Error(errorObject.message); - (error: any).code = errorObject.code; // flowlint-line unclear-type: off + (error as any).code = errorObject.code; // flowlint-line unclear-type: off callback(error); return; } diff --git a/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js b/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js index e81cb950463b..f0c5522bfe92 100644 --- a/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js +++ b/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js @@ -34,7 +34,7 @@ import processColor from '../StyleSheet/processColor'; // TODO(T171193075): __REACT_DEVTOOLS_GLOBAL_HOOK__ is always injected in dev-bundles, // but it is not mocked in some Jest tests. We should update Jest tests setup, so it would be the same as expected testing environment. -const reactDevToolsHook: ?ReactDevToolsGlobalHook = (window: $FlowFixMe) +const reactDevToolsHook: ?ReactDevToolsGlobalHook = (window as $FlowFixMe) .__REACT_DEVTOOLS_GLOBAL_HOOK__; export type DebuggingOverlayRegistrySubscriberProtocol = { diff --git a/packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js b/packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js index 31cca7fe4f65..c1f6db1c5ee4 100644 --- a/packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js @@ -45,4 +45,4 @@ Object.defineProperty(global, '__rctDeviceEventEmitter', { value: RCTDeviceEventEmitter, }); -export default (RCTDeviceEventEmitter: IEventEmitter); +export default RCTDeviceEventEmitter as IEventEmitter; diff --git a/packages/react-native/Libraries/Image/RelativeImageStub.js b/packages/react-native/Libraries/Image/RelativeImageStub.js index ba1f050a0f8e..8472f13dc4a9 100644 --- a/packages/react-native/Libraries/Image/RelativeImageStub.js +++ b/packages/react-native/Libraries/Image/RelativeImageStub.js @@ -15,7 +15,7 @@ const AssetRegistry = require('@react-native/assets-registry/registry'); -const RelativeImageStub = (AssetRegistry.registerAsset({ +const RelativeImageStub = AssetRegistry.registerAsset({ __packager_asset: true, fileSystemLocation: '/full/path/to/directory', httpServerLocation: '/assets/full/path/to/directory', @@ -25,7 +25,7 @@ const RelativeImageStub = (AssetRegistry.registerAsset({ hash: 'nonsense', name: 'icon', type: 'png', -}): number); +}) as number; // eslint-disable-next-line @react-native/monorepo/no-commonjs-exports module.exports = RelativeImageStub; diff --git a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js index 28fc16055df6..0541357195db 100644 --- a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js @@ -131,17 +131,17 @@ function createLayoutAnimation( } const Presets = { - easeInEaseOut: (createLayoutAnimation( + easeInEaseOut: createLayoutAnimation( 300, 'easeInEaseOut', 'opacity', - ): LayoutAnimationConfig), - linear: (createLayoutAnimation( + ) as LayoutAnimationConfig, + linear: createLayoutAnimation( 500, 'linear', 'opacity', - ): LayoutAnimationConfig), - spring: ({ + ) as LayoutAnimationConfig, + spring: { duration: 700, create: { type: 'linear', @@ -155,7 +155,7 @@ const Presets = { type: 'linear', property: 'opacity', }, - }: LayoutAnimationConfig), + } as LayoutAnimationConfig, }; /** @@ -205,15 +205,15 @@ const LayoutAnimation = { console.error('LayoutAnimation.checkConfig(...) has been disabled.'); }, Presets, - easeInEaseOut: (configureNext.bind(null, Presets.easeInEaseOut): ( + easeInEaseOut: configureNext.bind(null, Presets.easeInEaseOut) as ( onAnimationDidEnd?: OnAnimationDidEndCallback, - ) => void), - linear: (configureNext.bind(null, Presets.linear): ( + ) => void, + linear: configureNext.bind(null, Presets.linear) as ( onAnimationDidEnd?: OnAnimationDidEndCallback, - ) => void), - spring: (configureNext.bind(null, Presets.spring): ( + ) => void, + spring: configureNext.bind(null, Presets.spring) as ( onAnimationDidEnd?: OnAnimationDidEndCallback, - ) => void), + ) => void, setEnabled: setLayoutAnimationEnabled, }; diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index 721f0539947b..e908863fb945 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -564,7 +564,7 @@ class FlatList extends React.PureComponent> { ); return items .map((item, kk) => - keyExtractor(((item: $FlowFixMe): ItemT), index * numColumns + kk), + keyExtractor(item as $FlowFixMe as ItemT, index * numColumns + kk), ) .join(':'); } diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js index 8c3901e4ed40..208ded43951c 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js @@ -57,7 +57,7 @@ function getLogBoxSymbolication(): { Promise, >, } { - return (require('../LogBoxSymbolication'): any); + return require('../LogBoxSymbolication') as any; } const createStack = (methodNames: Array) => diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js index 7a348e459561..78d78cfee783 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js @@ -20,7 +20,7 @@ jest.mock('../../../Core/Devtools/symbolicateStackTrace'); const symbolicateStackTrace: JestMockFn< ReadonlyArray>, Promise, -> = (require('../../../Core/Devtools/symbolicateStackTrace').default: any); +> = require('../../../Core/Devtools/symbolicateStackTrace').default as any; const createStack = (methodNames: Array) => methodNames.map((methodName): StackFrame => ({ diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js index fc9905f1e75e..febc2b06ba94 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js @@ -116,7 +116,7 @@ describe('parseLogBoxLog', () => { name: '', isComponentError: false, componentStack: '', - stack: ([]: Array), + stack: [] as Array, id: 0, isFatal: true, }; @@ -153,7 +153,7 @@ describe('parseLogBoxLog', () => { name: '', isComponentError: false, componentStack: '', - stack: ([]: Array), + stack: [] as Array, id: 0, isFatal: true, }; @@ -213,7 +213,7 @@ If you are sure the module exists, try these steps: name: '', isComponentError: false, componentStack: '', - stack: ([]: Array), + stack: [] as Array, id: 0, isFatal: true, }; @@ -267,7 +267,7 @@ If you are sure the module exists, try these steps: name: '', isComponentError: false, componentStack: '', - stack: ([]: Array), + stack: [] as Array, id: 0, isFatal: true, }; @@ -315,7 +315,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets name: '', isComponentError: false, componentStack: '', - stack: ([]: Array), + stack: [] as Array, id: 0, isFatal: true, }; @@ -361,7 +361,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets name: '', isComponentError: false, componentStack: '', - stack: ([]: Array), + stack: [] as Array, id: 0, isFatal: true, }; diff --git a/packages/react-native/Libraries/LogBox/LogBox.js b/packages/react-native/Libraries/LogBox/LogBox.js index 7bf123fdaa7f..591786f7d78e 100644 --- a/packages/react-native/Libraries/LogBox/LogBox.js +++ b/packages/react-native/Libraries/LogBox/LogBox.js @@ -32,7 +32,7 @@ function convertLegacyComponentStack(componentStack: Stack): Stack { typeof firstFrame.content === 'string' ) { // Convert from legacy ComponentStack to Stack format - return (componentStack: $FlowFixMe).map(frame => ({ + return (componentStack as $FlowFixMe).map(frame => ({ methodName: frame.content, lineNumber: frame.location.row, column: frame.location.column, @@ -304,4 +304,4 @@ if (__DEV__) { }; } -export default (LogBox: ILogBox); +export default LogBox as ILogBox; diff --git a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js index cd65c8781a2e..a28b0fec30cc 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js @@ -63,6 +63,6 @@ export class _LogBoxInspectorContainer extends React.Component { }; } -export default (LogBoxData.withSubscription( +export default LogBoxData.withSubscription( _LogBoxInspectorContainer, -): React.ComponentType<{}>); +) as React.ComponentType<{}>; diff --git a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js index c121a16b4e36..972df20dd73c 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js @@ -100,6 +100,6 @@ const styles = StyleSheet.create({ }, }); -export default (LogBoxData.withSubscription( +export default LogBoxData.withSubscription( _LogBoxNotificationContainer, -): React.ComponentType<{}>); +) as React.ComponentType<{}>; diff --git a/packages/react-native/Libraries/LogBox/__tests__/LogBox-test.js b/packages/react-native/Libraries/LogBox/__tests__/LogBox-test.js index b0891c450241..c045cf122eb8 100644 --- a/packages/react-native/Libraries/LogBox/__tests__/LogBox-test.js +++ b/packages/react-native/Libraries/LogBox/__tests__/LogBox-test.js @@ -17,7 +17,7 @@ const LogBox = require('../LogBox').default; declare var console: any; function mockFilterResult(returnValues: $FlowFixMe) { - (LogBoxData.checkWarningFilter: any).mockReturnValue({ + (LogBoxData.checkWarningFilter as any).mockReturnValue({ finalFormat: '...', forceDialogImmediately: false, suppressDialog_LEGACY: false, diff --git a/packages/react-native/Libraries/Pressability/Pressability.js b/packages/react-native/Libraries/Pressability/Pressability.js index e2a06655eb7e..8e04ee5cffa8 100644 --- a/packages/react-native/Libraries/Pressability/Pressability.js +++ b/packages/react-native/Libraries/Pressability/Pressability.js @@ -560,8 +560,8 @@ export default class Pressability { ReactNativeFeatureFlags.shouldPressibilityUseW3CPointerEventsForHover() ) { const hoverPointerEvents = { - onPointerEnter: (undefined: void | (PointerEvent => void)), - onPointerLeave: (undefined: void | (PointerEvent => void)), + onPointerEnter: undefined as void | (PointerEvent => void), + onPointerLeave: undefined as void | (PointerEvent => void), }; const {onHoverIn, onHoverOut} = this._config; if (onHoverIn != null) { diff --git a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js index 8f4de8f53690..05a46d31e9bd 100644 --- a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js +++ b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js @@ -29,7 +29,7 @@ function getMock, TReturn>( if (!jest.isMockFunction(fn)) { throw new Error('Function must be mock function'); } - return (fn: $FlowFixMe); + return fn as $FlowFixMe; } const createMockPressability = (overrides: ?Partial) => { @@ -186,7 +186,7 @@ const createMockPressEvent = ( } const nativeEvent = { - changedTouches: ([]: Array), + changedTouches: [] as Array, force: 1, identifier: 42, locationX: pageX, @@ -195,7 +195,7 @@ const createMockPressEvent = ( pageY, target: 42, timestamp: 1075881600000, - touches: ([]: Array), + touches: [] as Array, }; nativeEvent.changedTouches.push(nativeEvent); diff --git a/packages/react-native/Libraries/ReactNative/AppContainer-dev.js b/packages/react-native/Libraries/ReactNative/AppContainer-dev.js index 0b5f67d4ced0..7eee9c75f8e7 100644 --- a/packages/react-native/Libraries/ReactNative/AppContainer-dev.js +++ b/packages/react-native/Libraries/ReactNative/AppContainer-dev.js @@ -29,7 +29,7 @@ import {useRef} from 'react'; const {useEffect, useState, useCallback} = React; -const reactDevToolsHook: ReactDevToolsGlobalHook = (window: $FlowFixMe) +const reactDevToolsHook: ReactDevToolsGlobalHook = (window as $FlowFixMe) .__REACT_DEVTOOLS_GLOBAL_HOOK__; // Required for React DevTools to view / edit React Native styles in Flipper. diff --git a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js index ee53d50e1caf..0f1edf031d0f 100644 --- a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +++ b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js @@ -258,11 +258,11 @@ function diffProperties( if (!attributeConfigHasProcess) { // functions are converted to booleans as markers that the associated // events should be sent from native. - nextProp = (true: any); + nextProp = true as any; // If nextProp is not a function, then don't bother changing prevProp // since nextProp will win and go into the updatePayload regardless. if (typeof prevProp === 'function') { - prevProp = (true: any); + prevProp = true as any; } } } @@ -270,9 +270,9 @@ function diffProperties( // An explicit value of undefined is treated as a null because it overrides // any other preceding value. if (typeof nextProp === 'undefined') { - nextProp = (null: any); + nextProp = null as any; if (typeof prevProp === 'undefined') { - prevProp = (null: any); + prevProp = null as any; } } @@ -313,7 +313,7 @@ function diffProperties( // case: !Object is the default case if (defaultDiffer(prevProp, nextProp)) { // a normal leaf has changed - (updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[ + (updatePayload || (updatePayload = {} as {[string]: $FlowFixMe}))[ propKey ] = nextProp; } @@ -333,7 +333,7 @@ function diffProperties( ? // $FlowFixMe[incompatible-use] found when upgrading Flow attributeConfig.process(nextProp) : nextProp; - (updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[ + (updatePayload || (updatePayload = {} as {[string]: $FlowFixMe}))[ propKey ] = nextValue; } @@ -347,13 +347,13 @@ function diffProperties( updatePayload, prevProp, nextProp, - ((attributeConfig: any): AttributeConfiguration), + attributeConfig as any as AttributeConfiguration, ); if (removedKeyCount > 0 && updatePayload) { restoreDeletedValuesInNestedArray( updatePayload, nextProp, - ((attributeConfig: any): AttributeConfiguration), + attributeConfig as any as AttributeConfiguration, ); removedKeys = null; } @@ -389,11 +389,11 @@ function diffProperties( ) { // case: CustomAttributeConfiguration | !Object // Flag the leaf property for removal by sending a sentinel. - (updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[ + (updatePayload || (updatePayload = {} as {[string]: $FlowFixMe}))[ propKey ] = null; if (!removedKeys) { - removedKeys = ({}: {[string]: boolean}); + removedKeys = {} as {[string]: boolean}; } if (!removedKeys[propKey]) { removedKeys[propKey] = true; @@ -406,7 +406,7 @@ function diffProperties( updatePayload = clearNestedProperty( updatePayload, prevProp, - ((attributeConfig: any): AttributeConfiguration), + attributeConfig as any as AttributeConfiguration, ); } } @@ -429,9 +429,9 @@ function addNestedProperty( for (const propKey in props) { const prop = props[propKey]; - const attributeConfig = ((validAttributes[ + const attributeConfig = validAttributes[ propKey - ]: any): AttributeConfiguration); + ] as any as AttributeConfiguration; if (attributeConfig == null) { continue; @@ -466,7 +466,7 @@ function addNestedProperty( if (newValue !== undefined) { if (!payload) { - payload = ({}: {[string]: $FlowFixMe}); + payload = {} as {[string]: $FlowFixMe}; } payload[propKey] = newValue; continue; diff --git a/packages/react-native/Libraries/ReactNative/requireNativeComponent.js b/packages/react-native/Libraries/ReactNative/requireNativeComponent.js index 786593125c30..96016159f59d 100644 --- a/packages/react-native/Libraries/ReactNative/requireNativeComponent.js +++ b/packages/react-native/Libraries/ReactNative/requireNativeComponent.js @@ -29,8 +29,8 @@ const getNativeComponentAttributes = const requireNativeComponent = ( uiViewClassName: string, ): HostComponent => - ((createReactNativeComponentClass(uiViewClassName, () => + createReactNativeComponentClass(uiViewClassName, () => getNativeComponentAttributes(uiViewClassName), - ): any): HostComponent); + ) as any as HostComponent; export default requireNativeComponent; diff --git a/packages/react-native/Libraries/Settings/Settings.ios.js b/packages/react-native/Libraries/Settings/Settings.ios.js index e5fa348e90b4..03074a8b38a0 100644 --- a/packages/react-native/Libraries/Settings/Settings.ios.js +++ b/packages/react-native/Libraries/Settings/Settings.ios.js @@ -20,7 +20,7 @@ const subscriptions: Array<{ const Settings = { _settings: (NativeSettingsManager && - NativeSettingsManager.getConstants().settings: any), + NativeSettingsManager.getConstants().settings) as any, get(key: string): unknown { // $FlowFixMe[object-this-reference] diff --git a/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.android.js b/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.android.js index 69607a794118..2647776e3549 100644 --- a/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.android.js +++ b/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.android.js @@ -19,7 +19,7 @@ type LocalNativeColorValue = { export const PlatformColor = (...names: Array): NativeColorValue => { /* $FlowExpectedError[incompatible-type] * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Android platform */ - return ({resource_paths: names}: LocalNativeColorValue); + return {resource_paths: names} as LocalNativeColorValue; }; export const normalizeColorObject = ( @@ -27,7 +27,7 @@ export const normalizeColorObject = ( ): ?ProcessedColorValue => { /* $FlowExpectedError[incompatible-type] * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Android platform */ - if ('resource_paths' in (color: LocalNativeColorValue)) { + if ('resource_paths' in (color as LocalNativeColorValue)) { return color; } return null; diff --git a/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.ios.js b/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.ios.js index b3e5ddcf3bcd..50af1b60828c 100644 --- a/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +++ b/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypes.ios.js @@ -24,7 +24,7 @@ type LocalNativeColorValue = { export const PlatformColor = (...names: Array): NativeColorValue => { // $FlowExpectedError[incompatible-type] LocalNativeColorValue is the iOS LocalNativeColorValue type - return ({semantic: names}: LocalNativeColorValue); + return {semantic: names} as LocalNativeColorValue; }; export type DynamicColorIOSTuplePrivate = { @@ -37,7 +37,7 @@ export type DynamicColorIOSTuplePrivate = { export const DynamicColorIOSPrivate = ( tuple: DynamicColorIOSTuplePrivate, ): ColorValue => { - return ({ + return { dynamic: { light: tuple.light, dark: tuple.dark, @@ -46,7 +46,7 @@ export const DynamicColorIOSPrivate = ( }, /* $FlowExpectedError[incompatible-type] * LocalNativeColorValue is the actual type of the opaque NativeColorValue on iOS platform */ - }: LocalNativeColorValue); + } as LocalNativeColorValue; }; const _normalizeColorObject = ( diff --git a/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js b/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js index 6ae30580f429..4010f9995dc2 100644 --- a/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +++ b/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js @@ -16,36 +16,36 @@ const imageStyle = {tintColor: 'rgb(0, 0, 0)'}; const textStyle = {color: 'rgb(0, 0, 0)'}; export function testGoodCompose() { - (StyleSheet.compose(imageStyle, imageStyle): ImageStyleProp); + StyleSheet.compose(imageStyle, imageStyle) as ImageStyleProp; - (StyleSheet.compose(textStyle, textStyle): TextStyleProp); + StyleSheet.compose(textStyle, textStyle) as TextStyleProp; - (StyleSheet.compose(null, null): TextStyleProp); + StyleSheet.compose(null, null) as TextStyleProp; - (StyleSheet.compose(textStyle, null): TextStyleProp); + StyleSheet.compose(textStyle, null) as TextStyleProp; - (StyleSheet.compose( + StyleSheet.compose( textStyle, Math.random() < 0.5 ? textStyle : null, - ): TextStyleProp); + ) as TextStyleProp; - (StyleSheet.compose([textStyle], null): TextStyleProp); + StyleSheet.compose([textStyle], null) as TextStyleProp; - (StyleSheet.compose([textStyle], null): TextStyleProp); + StyleSheet.compose([textStyle], null) as TextStyleProp; - (StyleSheet.compose([textStyle], [textStyle]): TextStyleProp); + StyleSheet.compose([textStyle], [textStyle]) as TextStyleProp; } export function testBadCompose() { // $FlowExpectedError[incompatible-type] - Incompatible type. - (StyleSheet.compose(textStyle, textStyle): ImageStyleProp); + StyleSheet.compose(textStyle, textStyle) as ImageStyleProp; // $FlowExpectedError[incompatible-type] - Incompatible type. - (StyleSheet.compose([textStyle], null): ImageStyleProp); + StyleSheet.compose([textStyle], null) as ImageStyleProp; // $FlowExpectedError[incompatible-type] - Incompatible type. - (StyleSheet.compose( + StyleSheet.compose( Math.random() < 0.5 ? textStyle : null, null, - ): ImageStyleProp); + ) as ImageStyleProp; } diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index 5a1e760da1b2..8e7b29cb6096 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -190,20 +190,20 @@ const TextImpl: component( if (processedStyle != null) { let overrides: ?{...TextStyleInternal} = null; if (typeof processedStyle.fontWeight === 'number') { - overrides = overrides || ({}: {...TextStyleInternal}); + overrides = overrides || ({} as {...TextStyleInternal}); overrides.fontWeight = // $FlowFixMe[incompatible-type] - (String(processedStyle.fontWeight): TextStyleInternal['fontWeight']); + String(processedStyle.fontWeight) as TextStyleInternal['fontWeight']; } if (processedStyle.userSelect != null) { _selectable = userSelectToSelectableMap[processedStyle.userSelect]; - overrides = overrides || ({}: {...TextStyleInternal}); + overrides = overrides || ({} as {...TextStyleInternal}); overrides.userSelect = undefined; } if (processedStyle.verticalAlign != null) { - overrides = overrides || ({}: {...TextStyleInternal}); + overrides = overrides || ({} as {...TextStyleInternal}); overrides.textAlignVertical = verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign]; overrides.verticalAlign = undefined; diff --git a/packages/react-native/Libraries/Text/TextNativeComponent.js b/packages/react-native/Libraries/Text/TextNativeComponent.js index 55fc55e1560c..11c869113337 100644 --- a/packages/react-native/Libraries/Text/TextNativeComponent.js +++ b/packages/react-native/Libraries/Text/TextNativeComponent.js @@ -77,16 +77,16 @@ const virtualTextViewConfig = { // Additional note: Our long term plan is to reduce the overhead of the // and wrappers so that we no longer have any reason to export these APIs. export const NativeText: HostComponent = - (createReactNativeComponentClass('RCTText', () => + createReactNativeComponentClass('RCTText', () => createViewConfig(textViewConfig), - ): any); + ) as any; export const NativeVirtualText: HostComponent = !global.RN$Bridgeless && !UIManager.hasViewManagerConfig('RCTVirtualText') ? NativeText : (createReactNativeComponentClass('RCTVirtualText', () => createViewConfig(virtualTextViewConfig), - ): any); + ) as any); export const NativeSelectableText: HostComponent = enablePreparedTextLayout() @@ -95,5 +95,5 @@ export const NativeSelectableText: HostComponent = ...textViewConfig, uiViewClassName: 'RCTSelectableText', }), - ): any) + ) as any) : NativeText; diff --git a/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js b/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js index 88765dc208d5..a29fed1f0efb 100644 --- a/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js +++ b/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js @@ -106,14 +106,14 @@ function maximumDepthError( } function expectNoConsoleWarn() { - (jest: $FlowFixMe).spyOn(console, 'warn').mockImplementation((...args) => { + (jest as $FlowFixMe).spyOn(console, 'warn').mockImplementation((...args) => { expect(args).toBeFalsy(); }); } function expectNoConsoleError() { let hasNotFailed = true; - (jest: $FlowFixMe).spyOn(console, 'error').mockImplementation((...args) => { + (jest as $FlowFixMe).spyOn(console, 'error').mockImplementation((...args) => { if (hasNotFailed) { hasNotFailed = false; // set false to prevent infinite recursion expect(args).toBeFalsy(); @@ -172,7 +172,7 @@ function renderWithStrictMode(element: React.Node): ReactTestRendererType { const WorkAroundBugWithStrictModeInTestRenderer = (prps: { children: React.Node, }) => prps.children; - const StrictMode = (React: $FlowFixMe).StrictMode; + const StrictMode = (React as $FlowFixMe).StrictMode; return ReactTestRenderer.create( {element} @@ -217,7 +217,7 @@ function scrollToBottom(instance: ReactTestInstance) { // To make error messages a little bit better, we attach a custom toString // implementation to a predicate function withMessage(fn: Predicate, message: string): Predicate { - (fn: any).toString = () => message; + (fn as any).toString = () => message; return fn; } diff --git a/packages/react-native/Libraries/Utilities/binaryToBase64.js b/packages/react-native/Libraries/Utilities/binaryToBase64.js index cf107ea400b3..4188ae07b7a0 100644 --- a/packages/react-native/Libraries/Utilities/binaryToBase64.js +++ b/packages/react-native/Libraries/Utilities/binaryToBase64.js @@ -24,7 +24,7 @@ function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): string { throw new Error('data must be ArrayBuffer or typed array'); } // Already checked that `data` is `DataView` in `ArrayBuffer.isView(data)` - const {buffer, byteOffset, byteLength}: DataView = (data: $FlowFixMe); + const {buffer, byteOffset, byteLength}: DataView = data as $FlowFixMe; return base64.fromByteArray(new Uint8Array(buffer, byteOffset, byteLength)); } diff --git a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js index acc8f9cc0ab6..4ef170fd7d2f 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js @@ -27,7 +27,7 @@ function codegenNativeCommands( }; }); - return ((commandObj: any): T); + return commandObj as any as T; } export default codegenNativeCommands; diff --git a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js index b0f1c6fba59a..cb5ece90df68 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js @@ -64,10 +64,10 @@ function codegenNativeComponent( } } - return (requireNativeComponent( + return requireNativeComponent( // $FlowFixMe[incompatible-type] componentNameInUse, - ): HostComponent); + ) as HostComponent; } export default codegenNativeComponent; diff --git a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js index 082c1a492ede..7e7b6b04a84d 100644 --- a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +++ b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js @@ -43,7 +43,7 @@ function deepFreezeAndThrowOnMutationInDev>( } // $FlowFixMe[not-an-object] `object` can be an array, but Object.keys works with arrays too - const keys = Object.keys((object: {...} | Array)); + const keys = Object.keys(object as {...} | Array); // $FlowFixMe[method-unbinding] added when improving typing for this parameters const hasOwnProperty = Object.prototype.hasOwnProperty; diff --git a/packages/react-native/Libraries/Utilities/stringifySafe.js b/packages/react-native/Libraries/Utilities/stringifySafe.js index 9b724afc6555..58fab39e0ae0 100644 --- a/packages/react-native/Libraries/Utilities/stringifySafe.js +++ b/packages/react-native/Libraries/Utilities/stringifySafe.js @@ -64,7 +64,7 @@ export function createStringifySafeWithLimits(limits: { retval = `{ ... object with ${keys.length} keys ... }`; } else if (keys.length > maxObjectKeysLimit) { // Return a sample of the keys. - retval = ({}: {[string]: unknown}); + retval = {} as {[string]: unknown}; for (let k of keys.slice(0, maxObjectKeysLimit)) { retval[k] = value[k]; } diff --git a/packages/react-native/Libraries/__flowtests__/ReactNativeTypes-flowtest.js b/packages/react-native/Libraries/__flowtests__/ReactNativeTypes-flowtest.js index d9340374288e..57c5c8910737 100644 --- a/packages/react-native/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +++ b/packages/react-native/Libraries/__flowtests__/ReactNativeTypes-flowtest.js @@ -15,7 +15,7 @@ import * as React from 'react'; function takesHostComponentInstance(instance: HostInstance | null): void {} -const MyHostComponent = (('Host': any): HostComponent<{...}>); +const MyHostComponent = 'Host' as any as HostComponent<{...}>; { diff --git a/packages/react-native/Libraries/promiseRejectionTrackingOptions.js b/packages/react-native/Libraries/promiseRejectionTrackingOptions.js index b003420627aa..95fcf1c093d0 100644 --- a/packages/react-native/Libraries/promiseRejectionTrackingOptions.js +++ b/packages/react-native/Libraries/promiseRejectionTrackingOptions.js @@ -39,7 +39,7 @@ const rejectionTrackingOptions: NonNullable[0]> = { message = typeof rejection === 'string' ? rejection - : JSON.stringify((rejection: $FlowFixMe)); + : JSON.stringify(rejection as $FlowFixMe); } } diff --git a/packages/react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js b/packages/react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js index 99738ca71609..4548e3832864 100644 --- a/packages/react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +++ b/packages/react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js @@ -18,19 +18,19 @@ const emitter = new EventEmitter<{ }>(); const subscription = emitter.addListener('void', unknown => { - (unknown: void); + unknown as void; }); subscription.remove(); emitter.addListener('string', foo => { - (foo: string); + foo as string; }); emitter.addListener('strings', (foo, bar) => { - (foo: string); - (bar: string); + foo as string; + bar as string; }); emitter.addListener('error', error => { - (error: Error); + error as Error; }); emitter.emit('void'); diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/getInspectorDataForViewAtPoint.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/getInspectorDataForViewAtPoint.js index 227b9843ef78..b1708149036f 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/getInspectorDataForViewAtPoint.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/getInspectorDataForViewAtPoint.js @@ -26,14 +26,14 @@ export type ReactRenderer = { }; type AttachedRendererEventPayload = {id: number, renderer: ReactRenderer}; -const reactDevToolsHook = (window: any).__REACT_DEVTOOLS_GLOBAL_HOOK__; +const reactDevToolsHook = (window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__; invariant( Boolean(reactDevToolsHook), 'getInspectorDataForViewAtPoint should not be used if React DevTools hook is not injected', ); const renderers: Array = Array.from( - (window: any).__REACT_DEVTOOLS_GLOBAL_HOOK__.renderers.values(), + (window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__.renderers.values(), ); const appendRenderer = ({renderer}: AttachedRendererEventPayload) => diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js index dcc08369e0ff..79ac843936ba 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js @@ -44,7 +44,7 @@ function ensureExternalInspectionAPI( disable: onDisable, }; // $FlowFixMe[prop-missing] Initializing global API for DevTools communication - (global: $FlowFixMe).__EXTERNAL_INSPECTION__ = api; + (global as $FlowFixMe).__EXTERNAL_INSPECTION__ = api; return api; } __EXTERNAL_INSPECTION__.enable = onEnable; diff --git a/packages/react-native/src/private/devsupport/devmenu/specs/NativeDevMenu.js b/packages/react-native/src/private/devsupport/devmenu/specs/NativeDevMenu.js index 461e875cc14c..163855a1321a 100644 --- a/packages/react-native/src/private/devsupport/devmenu/specs/NativeDevMenu.js +++ b/packages/react-native/src/private/devsupport/devmenu/specs/NativeDevMenu.js @@ -19,4 +19,4 @@ export interface Spec extends TurboModule { +setHotLoadingEnabled: (enabled: boolean) => void; } -export default (TurboModuleRegistry.getEnforcing('DevMenu'): Spec); +export default TurboModuleRegistry.getEnforcing('DevMenu') as Spec; diff --git a/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js b/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js index 122e7bcc522c..7a09b9cf0f2f 100644 --- a/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js +++ b/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js @@ -28,6 +28,6 @@ export interface Spec extends TurboModule { +getReloadAndProfileConfig: () => ReloadAndProfileConfig; } -export default (TurboModuleRegistry.get( +export default TurboModuleRegistry.get( 'ReactDevToolsRuntimeSettingsModule', -): ?Spec); +) as ?Spec; diff --git a/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsSettingsManager.js b/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsSettingsManager.js index 35de062d4e06..fc647e66a64a 100644 --- a/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsSettingsManager.js +++ b/packages/react-native/src/private/devsupport/rndevtools/specs/NativeReactDevToolsSettingsManager.js @@ -17,6 +17,6 @@ export interface Spec extends TurboModule { +getGlobalHookSettings: () => ?string; } -export default (TurboModuleRegistry.get( +export default TurboModuleRegistry.get( 'ReactDevToolsSettingsManager', -): ?Spec); +) as ?Spec; diff --git a/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js b/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js index 1879582f8fa2..d722feb6039b 100644 --- a/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js +++ b/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js @@ -33,17 +33,17 @@ function getExtendedError( /* $FlowFixMe[class-object-subtyping] added when improving typing for * this parameters */ // $FlowFixMe[incompatible-type] - error = (errorValue: ExtendedError); + error = errorValue as ExtendedError; } else if (typeof errorValue === 'string') { /* $FlowFixMe[class-object-subtyping] added when improving typing for * this parameters */ // $FlowFixMe[incompatible-type] - error = (new SyntheticError(errorValue): ExtendedError); + error = new SyntheticError(errorValue) as ExtendedError; } else { /* $FlowFixMe[class-object-subtyping] added when improving typing for * this parameters */ // $FlowFixMe[incompatible-type] - error = (new SyntheticError('Unspecified error'): ExtendedError); + error = new SyntheticError('Unspecified error') as ExtendedError; } try { // $FlowFixMe[incompatible-use] this is in try/catch. diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js index 2259e9213639..123a768622d2 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js @@ -48,9 +48,9 @@ type RCTActivityIndicatorViewNativeProps = Readonly<{ size?: WithDefault<'small' | 'large', 'small'>, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'ActivityIndicatorView', { paperComponentName: 'RCTActivityIndicatorView', }, -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js index 22ce1ab1872c..6c935ae61dec 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js @@ -119,6 +119,6 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['openDrawer', 'closeDrawer'], }); -export default (codegenNativeComponent( +export default codegenNativeComponent( 'AndroidDrawerLayout', -): NativeType); +) as NativeType; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js index b417a6409bda..b5eb7511c39b 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js @@ -21,7 +21,7 @@ type AndroidHorizontalScrollContentViewNativeProps = Readonly<{ type NativeType = HostComponent; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'AndroidHorizontalScrollContentView', {interfaceOnly: true}, -): NativeType); +) as NativeType; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js index 35acd8319d6e..7d2385c79781 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js @@ -69,6 +69,6 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['setNativeRefreshing'], }); -export default (codegenNativeComponent( +export default codegenNativeComponent( 'AndroidSwipeRefreshLayout', -): NativeType); +) as NativeType; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js index c91e734cf832..14bff1e74b4c 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js @@ -57,9 +57,9 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['setNativeValue'], }); -export default (codegenNativeComponent( +export default codegenNativeComponent( 'AndroidSwitch', { interfaceOnly: true, }, -): NativeType); +) as NativeType; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js index 178951bf2b4d..924267092a0d 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js @@ -57,6 +57,6 @@ export const Commands: NativeCommands = codegenNativeCommands({ ], }); -export default (codegenNativeComponent( +export default codegenNativeComponent( 'DebuggingOverlay', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js index 1c2f055c1892..2e0b59cdeedd 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js @@ -31,9 +31,9 @@ type AndroidProgressBarNativeProps = Readonly<{ testID?: WithDefault, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'AndroidProgressBar', { interfaceOnly: true, }, -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js index e72d19befa59..061717b08918 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js @@ -65,10 +65,10 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['setNativeRefreshing'], }); -export default (codegenNativeComponent( +export default codegenNativeComponent( 'PullToRefreshView', { paperComponentName: 'RCTRefreshControl', excludedPlatforms: ['android'], }, -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js index 334ca0efe282..66e1e025590f 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js @@ -19,11 +19,11 @@ type InputAccessoryNativeProps = Readonly<{ backgroundColor?: ?ColorValue, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'InputAccessory', { interfaceOnly: true, paperComponentName: 'RCTInputAccessoryView', excludedPlatforms: ['android'], }, -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js index a27f5b3b3e4e..eaf91f167efd 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js @@ -147,10 +147,10 @@ type RCTModalHostViewNativeProps = Readonly<{ identifier?: WithDefault, }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'ModalHostView', { interfaceOnly: true, paperComponentName: 'RCTModalHostView', }, -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js index d697433169ec..546f4fa6e425 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js @@ -19,10 +19,10 @@ type RCTSafeAreaViewNativeProps = Readonly<{ // No props }>; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'SafeAreaView', { paperComponentName: 'RCTSafeAreaView', interfaceOnly: true, }, -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js index 3d6feb97cb72..6c6a2bcc2f04 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js @@ -55,8 +55,8 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['setValue'], }); -export default (codegenNativeComponent('Switch', { +export default codegenNativeComponent('Switch', { paperComponentName: 'RCTSwitch', excludedPlatforms: ['android'], interfaceOnly: true, -}): ComponentType); +}) as ComponentType; diff --git a/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js b/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js index f7c79c3a4ee8..b99df0ac2242 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +++ b/packages/react-native/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js @@ -21,6 +21,6 @@ type UnimplementedNativeViewNativeProps = Readonly<{ // NOTE: This component is not implemented in paper // Do not require this file in paper builds -export default (codegenNativeComponent( +export default codegenNativeComponent( 'UnimplementedNativeView', -): HostComponent); +) as HostComponent; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityInfo.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityInfo.js index 358134c9ed1b..8f566494188d 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityInfo.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityInfo.js @@ -39,4 +39,4 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.get('AccessibilityInfo'): ?Spec); +export default TurboModuleRegistry.get('AccessibilityInfo') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js index de79663d418b..cc1693d0a830 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js @@ -67,4 +67,4 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.get('AccessibilityManager'): ?Spec); +export default TurboModuleRegistry.get('AccessibilityManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeActionSheetManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeActionSheetManager.js index 1141499c2862..4177737cc53e 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeActionSheetManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeActionSheetManager.js @@ -53,4 +53,4 @@ export interface Spec extends TurboModule { +dismissActionSheet?: () => void; } -export default (TurboModuleRegistry.get('ActionSheetManager'): ?Spec); +export default TurboModuleRegistry.get('ActionSheetManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAlertManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAlertManager.js index 312a01713f03..43510a83c4ab 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAlertManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAlertManager.js @@ -32,4 +32,4 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.get('AlertManager'): ?Spec); +export default TurboModuleRegistry.get('AlertManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppState.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppState.js index a80e4c2f1aeb..8e39fc4f4527 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppState.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppState.js @@ -30,4 +30,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.getEnforcing('AppState'): Spec); +export default TurboModuleRegistry.getEnforcing('AppState') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppearance.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppearance.js index d7bc36160eaf..29296fe87921 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppearance.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppearance.js @@ -27,4 +27,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.get('Appearance'): ?Spec); +export default TurboModuleRegistry.get('Appearance') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeBlobModule.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeBlobModule.js index b997a7f88553..6fc6cb1a349c 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeBlobModule.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeBlobModule.js @@ -58,4 +58,4 @@ if (NativeModule != null) { }; } -export default (NativeBlobModule: ?Spec); +export default NativeBlobModule as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeClipboard.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeClipboard.js index ef3c10f92ff3..be7a5b71582f 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeClipboard.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeClipboard.js @@ -18,4 +18,4 @@ export interface Spec extends TurboModule { +setString: (content: string) => void; } -export default (TurboModuleRegistry.getEnforcing('Clipboard'): Spec); +export default TurboModuleRegistry.getEnforcing('Clipboard') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js index 71ba4d6fdd69..c33a8309e70b 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js @@ -22,4 +22,4 @@ export interface Spec extends TurboModule { +hide: () => void; } -export default (TurboModuleRegistry.get('DevLoadingView'): ?Spec); +export default TurboModuleRegistry.get('DevLoadingView') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevSettings.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevSettings.js index 02de0392248f..6234049f72ff 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevSettings.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDevSettings.js @@ -30,4 +30,4 @@ export interface Spec extends TurboModule { +setIsShakeToShowDevMenuEnabled: (enabled: boolean) => void; } -export default (TurboModuleRegistry.getEnforcing('DevSettings'): Spec); +export default TurboModuleRegistry.getEnforcing('DevSettings') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceEventManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceEventManager.js index 8894d45215dd..dd498408d85c 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceEventManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceEventManager.js @@ -16,4 +16,4 @@ export interface Spec extends TurboModule { +invokeDefaultBackPressHandler: () => void; } -export default (TurboModuleRegistry.get('DeviceEventManager'): ?Spec); +export default TurboModuleRegistry.get('DeviceEventManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid.js index d64b5deb2e41..215fbd6601ff 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid.js @@ -45,4 +45,4 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.get('DialogManagerAndroid'): ?Spec); +export default TurboModuleRegistry.get('DialogManagerAndroid') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFileReaderModule.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFileReaderModule.js index 8b3b7617378e..dc88374aabe2 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFileReaderModule.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFileReaderModule.js @@ -17,6 +17,6 @@ export interface Spec extends TurboModule { +readAsText: (data: Object, encoding: string) => Promise; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'FileReaderModule', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFrameRateLogger.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFrameRateLogger.js index 3b51a796666f..8792cc9ae3c6 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFrameRateLogger.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeFrameRateLogger.js @@ -19,4 +19,4 @@ export interface Spec extends TurboModule { +endScroll: () => void; } -export default (TurboModuleRegistry.get('FrameRateLogger'): ?Spec); +export default TurboModuleRegistry.get('FrameRateLogger') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeHeadlessJsTaskSupport.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeHeadlessJsTaskSupport.js index 3bdf3acf6102..471204e3c38e 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeHeadlessJsTaskSupport.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeHeadlessJsTaskSupport.js @@ -17,4 +17,4 @@ export interface Spec extends TurboModule { +notifyTaskRetry: (taskId: number) => Promise; } -export default (TurboModuleRegistry.get('HeadlessJsTaskSupport'): ?Spec); +export default TurboModuleRegistry.get('HeadlessJsTaskSupport') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeI18nManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeI18nManager.js index bede3bcedea1..dbd9135987d4 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeI18nManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeI18nManager.js @@ -25,4 +25,4 @@ export interface Spec extends TurboModule { swapLeftAndRightInRTL: (flipStyles: boolean) => void; } -export default (TurboModuleRegistry.get('I18nManager'): ?Spec); +export default TurboModuleRegistry.get('I18nManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageEditor.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageEditor.js index 37718d92dd03..e43706c9b01b 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageEditor.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageEditor.js @@ -47,6 +47,6 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'ImageEditingManager', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid.js index 35d3de62770b..c60d7a4267c8 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid.js @@ -27,4 +27,4 @@ export interface Spec extends TurboModule { +queryCache: (uris: Array) => Promise; } -export default (TurboModuleRegistry.getEnforcing('ImageLoader'): Spec); +export default TurboModuleRegistry.getEnforcing('ImageLoader') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js index 7188390e5ae2..c9cf98c5a0ef 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js @@ -34,4 +34,4 @@ export interface Spec extends TurboModule { +queryCache: (uris: Array) => Promise; } -export default (TurboModuleRegistry.getEnforcing('ImageLoader'): Spec); +export default TurboModuleRegistry.getEnforcing('ImageLoader') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid.js index ac9ac5d6a401..7fee26fb4b0a 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid.js @@ -21,6 +21,6 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'ImageStoreManager', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreIOS.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreIOS.js index 006df5102fc8..83054f085b57 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreIOS.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeImageStoreIOS.js @@ -28,6 +28,6 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'ImageStoreManager', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeIntentAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeIntentAndroid.js index 46f2a9e7fe72..ef8b4d4828c6 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeIntentAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeIntentAndroid.js @@ -27,4 +27,4 @@ export interface Spec extends TurboModule { ) => Promise; } -export default (TurboModuleRegistry.get('IntentAndroid'): ?Spec); +export default TurboModuleRegistry.get('IntentAndroid') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeJSCHeapCapture.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeJSCHeapCapture.js index a9ae5ddcaa2f..cbd257b9af48 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeJSCHeapCapture.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeJSCHeapCapture.js @@ -16,4 +16,4 @@ export interface Spec extends TurboModule { +captureComplete: (path: string, error: ?string) => void; } -export default (TurboModuleRegistry.get('JSCHeapCapture'): ?Spec); +export default TurboModuleRegistry.get('JSCHeapCapture') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeKeyboardObserver.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeKeyboardObserver.js index 9a9e456dae9b..456615af0144 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeKeyboardObserver.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeKeyboardObserver.js @@ -17,4 +17,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.get('KeyboardObserver'): ?Spec); +export default TurboModuleRegistry.get('KeyboardObserver') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLinkingManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLinkingManager.js index 60d1aa0f1fef..98f5a319722c 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLinkingManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLinkingManager.js @@ -24,4 +24,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.get('LinkingManager'): ?Spec); +export default TurboModuleRegistry.get('LinkingManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLogBox.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLogBox.js index bf4267426bf3..75926a289c80 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLogBox.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeLogBox.js @@ -17,4 +17,4 @@ export interface Spec extends TurboModule { +hide: () => void; } -export default (TurboModuleRegistry.get('LogBox'): ?Spec); +export default TurboModuleRegistry.get('LogBox') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js index 103501231753..0ac1400ccb17 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js @@ -18,4 +18,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.get('ModalManager'): ?Spec); +export default TurboModuleRegistry.get('ModalManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingAndroid.js index 164db3723ec3..8de52013daf4 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingAndroid.js @@ -34,4 +34,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.getEnforcing('Networking'): Spec); +export default TurboModuleRegistry.getEnforcing('Networking') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js index 3bc05cf4db3b..05fc5118dae6 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js @@ -35,4 +35,4 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.getEnforcing('Networking'): Spec); +export default TurboModuleRegistry.getEnforcing('Networking') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js index 52fef71d9bf4..24dc4bc654f4 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js @@ -75,4 +75,4 @@ export interface Spec extends TurboModule { ) => Promise<{[permission: PermissionType]: PermissionStatus, ...}>; } -export default (TurboModuleRegistry.get('PermissionsAndroid'): ?Spec); +export default TurboModuleRegistry.get('PermissionsAndroid') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsAndroid.js index 5ed3f879af99..8b1dff5bf885 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsAndroid.js @@ -39,6 +39,6 @@ export interface Spec extends TurboModule { +getAndroidID: () => string; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'PlatformConstants', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsIOS.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsIOS.js index 03477d4a14db..110557795733 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsIOS.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePlatformConstantsIOS.js @@ -32,6 +32,6 @@ export interface Spec extends TurboModule { +getConstants: () => PlatformConstantsIOS; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'PlatformConstants', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePushNotificationManagerIOS.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePushNotificationManagerIOS.js index 61e3207ada9b..3c0f30919d21 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativePushNotificationManagerIOS.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativePushNotificationManagerIOS.js @@ -98,6 +98,6 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.get( +export default TurboModuleRegistry.get( 'PushNotificationManager', -): ?Spec); +) as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeRedBox.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeRedBox.js index 03db14a00c8e..c16d64bf58f8 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeRedBox.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeRedBox.js @@ -17,4 +17,4 @@ export interface Spec extends TurboModule { +dismiss: () => void; } -export default (TurboModuleRegistry.get('RedBox'): ?Spec); +export default TurboModuleRegistry.get('RedBox') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js index 4b643c34d8da..2cfb9ccb8184 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js @@ -64,6 +64,6 @@ export interface Spec extends TurboModule { +getImageUrl?: () => Promise; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'SampleTurboModule', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSegmentFetcher.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSegmentFetcher.js index 42d12fd358c3..69a0400b6d61 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSegmentFetcher.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSegmentFetcher.js @@ -25,4 +25,4 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.getEnforcing('SegmentFetcher'): Spec); +export default TurboModuleRegistry.getEnforcing('SegmentFetcher') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSettingsManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSettingsManager.js index 5f20809ca4e6..c9b6f48c1a8e 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSettingsManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSettingsManager.js @@ -20,6 +20,6 @@ export interface Spec extends TurboModule { +deleteValues: (values: Array) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'SettingsManager', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeShareModule.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeShareModule.js index 3ddb767b3727..fb676c3f77b3 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeShareModule.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeShareModule.js @@ -20,4 +20,4 @@ export interface Spec extends TurboModule { ) => Promise<{action: string}>; } -export default (TurboModuleRegistry.get('ShareModule'): ?Spec); +export default TurboModuleRegistry.get('ShareModule') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSoundManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSoundManager.js index 9bff5d1bcce2..6ecd2954c9c0 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSoundManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeSoundManager.js @@ -19,4 +19,4 @@ export interface Spec extends TurboModule { +playTouchSound: () => void; } -export default (TurboModuleRegistry.get('SoundManager'): ?Spec); +export default TurboModuleRegistry.get('SoundManager') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeTiming.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeTiming.js index d781403f893e..48b475f71dc8 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeTiming.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeTiming.js @@ -24,4 +24,4 @@ export interface Spec extends TurboModule { +setSendIdleEvents: (sendIdleEvents: boolean) => void; } -export default (TurboModuleRegistry.get('Timing'): ?Spec); +export default TurboModuleRegistry.get('Timing') as ?Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeToastAndroid.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeToastAndroid.js index 5d91ace6d06c..84ed5fc58ba8 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeToastAndroid.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeToastAndroid.js @@ -35,4 +35,4 @@ export interface Spec extends TurboModule { ) => void; } -export default (TurboModuleRegistry.getEnforcing('ToastAndroid'): Spec); +export default TurboModuleRegistry.getEnforcing('ToastAndroid') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeUIManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeUIManager.js index c012f6aae8ed..9603db949952 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeUIManager.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeUIManager.js @@ -184,4 +184,4 @@ export interface Spec extends TurboModule { +blur?: (reactTag: number) => void; } -export default (TurboModuleRegistry.getEnforcing('UIManager'): Spec); +export default TurboModuleRegistry.getEnforcing('UIManager') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeVibration.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeVibration.js index 64704c8d7700..6387e218788d 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeVibration.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeVibration.js @@ -21,4 +21,4 @@ export interface Spec extends TurboModule { +cancel: () => void; } -export default (TurboModuleRegistry.getEnforcing('Vibration'): Spec); +export default TurboModuleRegistry.getEnforcing('Vibration') as Spec; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeWebSocketModule.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeWebSocketModule.js index e48223552a7d..8032c9a8252c 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeWebSocketModule.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeWebSocketModule.js @@ -29,6 +29,6 @@ export interface Spec extends TurboModule { +removeListeners: (count: number) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'WebSocketModule', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/testing/fantom/specs/NativeCPUTime.js b/packages/react-native/src/private/testing/fantom/specs/NativeCPUTime.js index e4cbbf28098c..e8639d6d7910 100644 --- a/packages/react-native/src/private/testing/fantom/specs/NativeCPUTime.js +++ b/packages/react-native/src/private/testing/fantom/specs/NativeCPUTime.js @@ -21,4 +21,4 @@ export interface Spec extends TurboModule { +hasAccurateCPUTimeNanosForBenchmarks: () => boolean; } -export default (TurboModuleRegistry.getEnforcing('CPUTimeCxx'): Spec); +export default TurboModuleRegistry.getEnforcing('CPUTimeCxx') as Spec; diff --git a/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js b/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js index f10f0a8fecb7..9005466d30ba 100644 --- a/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js +++ b/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js @@ -28,6 +28,6 @@ export interface Spec extends TurboModule { +setRootNodeSize: (surfaceId: Int32, width: Float, height: Float) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeFantomTestSpecificMethodsCxx', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/utilities/toExtendedError.js b/packages/react-native/src/private/utilities/toExtendedError.js index 988a72796f45..31481492da17 100644 --- a/packages/react-native/src/private/utilities/toExtendedError.js +++ b/packages/react-native/src/private/utilities/toExtendedError.js @@ -26,5 +26,5 @@ export default function toExtendedError(value: unknown): ExtendedError { const error = toError(value); // ExtendedError extends Error, so this cast is safe for the LogBox system // $FlowFixMe[incompatible-type] ExtendedError extends Error, this cast is safe - return (error: ExtendedError); + return error as ExtendedError; } diff --git a/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js b/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js index 28f9e4419d3a..1cb40bc1286f 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js +++ b/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js @@ -448,4 +448,4 @@ export interface RefinedSpec { // might end up loading this but not using it. // 2. We lose automatic backwards compatibility checks because of this. // $FlowExpectedError[incompatible-type] -export default (TurboModuleRegistry.get('NativeDOMCxx'): RefinedSpec); +export default TurboModuleRegistry.get('NativeDOMCxx') as RefinedSpec; diff --git a/packages/react-native/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js b/packages/react-native/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js index 1b5f835fe8fa..84b36e88ab6c 100644 --- a/packages/react-native/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +++ b/packages/react-native/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js @@ -31,6 +31,6 @@ export interface Spec extends TurboModule { +cancelIdleCallback: (handle: IdleCallbackID) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeIdleCallbacksCxx', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js b/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js index cbe579b82744..f2fd6f171a5a 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js @@ -47,6 +47,6 @@ export interface Spec extends TurboModule { +takeRecords: () => ReadonlyArray; } -export default (TurboModuleRegistry.get( +export default TurboModuleRegistry.get( 'NativeIntersectionObserverCxx', -): ?Spec); +) as ?Spec; diff --git a/packages/react-native/src/private/webapis/microtasks/specs/NativeMicrotasks.js b/packages/react-native/src/private/webapis/microtasks/specs/NativeMicrotasks.js index c6be40a63ffb..1f742d3053c5 100644 --- a/packages/react-native/src/private/webapis/microtasks/specs/NativeMicrotasks.js +++ b/packages/react-native/src/private/webapis/microtasks/specs/NativeMicrotasks.js @@ -16,6 +16,6 @@ export interface Spec extends TurboModule { +queueMicrotask: (callback: () => unknown) => void; } -export default (TurboModuleRegistry.getEnforcing( +export default TurboModuleRegistry.getEnforcing( 'NativeMicrotasksCxx', -): Spec); +) as Spec; diff --git a/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js b/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js index ade4886087f4..62c92ba5aed2 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +++ b/packages/react-native/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js @@ -50,6 +50,6 @@ export interface Spec extends TurboModule { +takeRecords: () => ReadonlyArray; } -export default (TurboModuleRegistry.get( +export default TurboModuleRegistry.get( 'NativeMutationObserverCxx', -): ?Spec); +) as ?Spec; diff --git a/packages/react-native/src/private/webapis/performance/internals/RawPerformanceEntry.js b/packages/react-native/src/private/webapis/performance/internals/RawPerformanceEntry.js index 6ef10b6980be..c553856cafb7 100644 --- a/packages/react-native/src/private/webapis/performance/internals/RawPerformanceEntry.js +++ b/packages/react-native/src/private/webapis/performance/internals/RawPerformanceEntry.js @@ -119,7 +119,7 @@ export function performanceEntryTypeToRaw( return RawPerformanceEntryTypeValues.RESOURCE; default: // Verify exhaustive check with Flow - (type: empty); + (type) as empty; throw new TypeError( `performanceEntryTypeToRaw: unexpected performance entry type received: ${type}`, ); diff --git a/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js b/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js index 47025dd39068..ccbb4c0e58a3 100644 --- a/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js +++ b/packages/react-native/src/private/webapis/performance/specs/NativePerformance.js @@ -101,4 +101,4 @@ export interface Spec extends TurboModule { +clearEventCountsForTesting: () => void; } -export default (TurboModuleRegistry.get('NativePerformanceCxx'): ?Spec); +export default TurboModuleRegistry.get('NativePerformanceCxx') as ?Spec; diff --git a/packages/rn-tester/IntegrationTests/IntegrationTestsApp.js b/packages/rn-tester/IntegrationTests/IntegrationTestsApp.js index cb2b54dd23be..c1f9cf2c760a 100644 --- a/packages/rn-tester/IntegrationTests/IntegrationTestsApp.js +++ b/packages/rn-tester/IntegrationTests/IntegrationTestsApp.js @@ -50,7 +50,7 @@ type Test = any; class IntegrationTestsApp extends React.Component<{...}, $FlowFixMe> { state: {test: ?Test} = { - test: (null: ?Test), + test: null as ?Test, }; render(): React.Node { diff --git a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js index 4a47880084f5..f854257df9a6 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js @@ -98,6 +98,6 @@ export function callNativeMethodToRemoveOverlays( ); } -export default (requireNativeComponent( +export default requireNativeComponent( 'RNTMyLegacyNativeView', -): HostComponent); +) as HostComponent; diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js index 093b8d80af7d..b5fbf11f8e4f 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js @@ -70,6 +70,6 @@ export const Commands: NativeCommands = codegenNativeCommands({ ], }); -export default (codegenNativeComponent( +export default codegenNativeComponent( 'RNTMyNativeView', -): MyNativeViewType); +) as MyNativeViewType; diff --git a/packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.js b/packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.js index ad01c7549045..589360363a32 100644 --- a/packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.js +++ b/packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.js @@ -116,6 +116,6 @@ export interface Spec extends TurboModule { +promiseAssert: () => Promise; } -export default (TurboModuleRegistry.get( +export default TurboModuleRegistry.get( 'NativeCxxModuleExampleCxx', -): ?Spec); +) as ?Spec; diff --git a/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js b/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js index 05069d6089c1..68fb3b9d1d64 100644 --- a/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js +++ b/packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js @@ -19,6 +19,6 @@ type NativeProps = Readonly<{ export type ReportFullyDrawnViewType = HostComponent; -export default (codegenNativeComponent( +export default codegenNativeComponent( 'RNTReportFullyDrawnView', -): ReportFullyDrawnViewType); +) as ReportFullyDrawnViewType; diff --git a/packages/rn-tester/js/examples/ActivityIndicator/ActivityIndicatorExample.js b/packages/rn-tester/js/examples/ActivityIndicator/ActivityIndicatorExample.js index 6b9f6a9de885..e69057166264 100644 --- a/packages/rn-tester/js/examples/ActivityIndicator/ActivityIndicatorExample.js +++ b/packages/rn-tester/js/examples/ActivityIndicator/ActivityIndicatorExample.js @@ -60,7 +60,7 @@ const styles = StyleSheet.create({ }, }); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.category = 'UI'; exports.framework = 'React'; exports.title = 'ActivityIndicator'; diff --git a/packages/rn-tester/js/examples/Alert/AlertExample.js b/packages/rn-tester/js/examples/Alert/AlertExample.js index 70c5ccf86a88..e394dc85b5bc 100644 --- a/packages/rn-tester/js/examples/Alert/AlertExample.js +++ b/packages/rn-tester/js/examples/Alert/AlertExample.js @@ -452,7 +452,7 @@ export const examples = [ }, ]; -export default ({ +export default { framework: 'React', title: 'Alerts', category: 'UI', @@ -462,4 +462,4 @@ export default ({ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See * https://fburl.com/workplace/6291gfvu */ examples, -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/Animated/AnimatedIndex.js b/packages/rn-tester/js/examples/Animated/AnimatedIndex.js index 3fd82fc9c393..b30e8ef29190 100644 --- a/packages/rn-tester/js/examples/Animated/AnimatedIndex.js +++ b/packages/rn-tester/js/examples/Animated/AnimatedIndex.js @@ -25,7 +25,7 @@ import RotatingImagesExample from './RotatingImagesExample'; import TransformBounceExample from './TransformBounceExample'; import TransformStylesExample from './TransformStylesExample'; -export default ({ +export default { framework: 'React', title: 'Animated', category: 'UI', @@ -50,4 +50,4 @@ export default ({ PressabilityWithNativeDrivers, PanGestureExample, ], -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/Animated/ColorStylesExample.js b/packages/rn-tester/js/examples/Animated/ColorStylesExample.js index 5abcded22ea8..3a7a20683d90 100644 --- a/packages/rn-tester/js/examples/Animated/ColorStylesExample.js +++ b/packages/rn-tester/js/examples/Animated/ColorStylesExample.js @@ -162,9 +162,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Color Styles', name: 'colorStyles', description: 'Animations of color styles.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/CombineExample.js b/packages/rn-tester/js/examples/Animated/CombineExample.js index 8ee9a8120854..4ab7b016ee3c 100644 --- a/packages/rn-tester/js/examples/Animated/CombineExample.js +++ b/packages/rn-tester/js/examples/Animated/CombineExample.js @@ -16,13 +16,13 @@ import * as React from 'react'; import {useState} from 'react'; import {Animated, StyleSheet, Text, TextInput, View} from 'react-native'; -export default ({ +export default { title: 'Combine Example', name: 'Combine View', description: 'Change the opacity of the view by combining different Animated.Values.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; component CombineExample() { const [aValue, setAValue] = useState('0.4'); diff --git a/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js b/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js index 6808f10382fd..d3d3f2708970 100644 --- a/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js +++ b/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js @@ -127,12 +127,12 @@ component CompositeAnimationsWithEasingExample() { ); } -export default ({ +export default { title: 'Composite Animations with Easing', name: 'compositeAnimationsWithEasing', description: ('Sequence, parallel, delay, and ' + - 'stagger with different easing functions.': string), + 'stagger with different easing functions.') as string, expect: 'The 3 views will animate their `left` position based on their animation configurations.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/ComposingExample.js b/packages/rn-tester/js/examples/Animated/ComposingExample.js index e94c5b4d3fca..a2e7431e5965 100644 --- a/packages/rn-tester/js/examples/Animated/ComposingExample.js +++ b/packages/rn-tester/js/examples/Animated/ComposingExample.js @@ -255,9 +255,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Composing', name: 'composing', description: 'Combine multiple animations using composition functions', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js b/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js index b0e7b0e1bfe2..cf6dde0e3a45 100644 --- a/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js +++ b/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js @@ -24,13 +24,13 @@ component AnimatedContinuousInteractionsExample() { ); } -export default ({ +export default { title: 'Continuous Interactions', name: 'continuousInteractions', description: ('Gesture events, chaining, 2D ' + 'values, interrupting and transitioning ' + - 'animations, etc.': string), + 'animations, etc.') as string, render() { return ; }, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/EasingExample.js b/packages/rn-tester/js/examples/Animated/EasingExample.js index 386e12f15e4c..e589e3b8fe36 100644 --- a/packages/rn-tester/js/examples/Animated/EasingExample.js +++ b/packages/rn-tester/js/examples/Animated/EasingExample.js @@ -189,10 +189,10 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Easing', name: 'easing', description: 'The Easing module implements common easing functions. This module is used by Animated.timing() to convey physically believable motion in animations.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/FadeInViewExample.js b/packages/rn-tester/js/examples/Animated/FadeInViewExample.js index 08bfe01d79ff..16b4b27fe6b5 100644 --- a/packages/rn-tester/js/examples/Animated/FadeInViewExample.js +++ b/packages/rn-tester/js/examples/Animated/FadeInViewExample.js @@ -83,13 +83,13 @@ component FadeInExample() { ); } -export default ({ +export default { title: 'FadeInView', name: 'fadeInView', description: ('Uses a simple timing animation to ' + 'bring opacity from 0 to 1 when the component ' + - 'mounts.': string), + 'mounts.') as string, expect: 'FadeInView box should animate from opacity 0 to 1. \nExpect no animation when hiding.\nHiding the view mid-animation should not affect next animation.', render: (): React.Node => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/LoopingExample.js b/packages/rn-tester/js/examples/Animated/LoopingExample.js index 22a6acff3892..4601bb67645a 100644 --- a/packages/rn-tester/js/examples/Animated/LoopingExample.js +++ b/packages/rn-tester/js/examples/Animated/LoopingExample.js @@ -17,12 +17,12 @@ import * as React from 'react'; import {useEffect, useMemo, useState} from 'react'; import {Animated, StyleSheet, Text, View} from 'react-native'; -export default ({ +export default { title: 'Looping Example', name: 'loopingView', description: 'Native looping animation that shrinks and fades out a view.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; component LoopingView(useNativeDriver: boolean, running: boolean) { const opacity = useMemo(() => new Animated.Value(1), []); diff --git a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js index c4044e8e06a6..5790d105f41d 100644 --- a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js +++ b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js @@ -124,7 +124,7 @@ component MovingBoxExample() { ); } -export default ({ +export default { title: 'Moving box example', name: 'movingView', description: @@ -132,4 +132,4 @@ export default ({ expect: 'During animation, removing box from layout will stop the animation and box will stay in its current position.\nStarting animation when box is not rendered and rendering mid-way does not affect animation.\nReset will reset the animation to its starting position.', render: (): React.Node => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/PanGestureExample.js b/packages/rn-tester/js/examples/Animated/PanGestureExample.js index f01b2da85608..cc65d6f75f14 100644 --- a/packages/rn-tester/js/examples/Animated/PanGestureExample.js +++ b/packages/rn-tester/js/examples/Animated/PanGestureExample.js @@ -247,9 +247,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Pan Gesture', name: 'panGesture', description: 'Animations driven by pan gesture.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js b/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js index a16d35211615..7c6782c79832 100644 --- a/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js +++ b/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js @@ -67,9 +67,9 @@ component PressableWithNativeDriver() { ); } -export default ({ +export default { title: 'Pressability With Native Driver', name: 'pressabilityWithNativeDrivers', description: 'Pressabile animated with Native Drivers', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js b/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js index 1db3dc145ad0..fadd78badcf3 100644 --- a/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js +++ b/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js @@ -103,11 +103,11 @@ component RotatingImagesExample() { ); } -export default ({ +export default { title: 'Rotating Images', name: 'rotatingImages', description: 'Simple Animated.Image rotation.', expect: 'Transform animation on image in scale, rotation, and translation. JS driver will ignore any calls to `start` on running animation. Native driver will re-start the animation.', render: RotatingImagesExample, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/TransformBounceExample.js b/packages/rn-tester/js/examples/Animated/TransformBounceExample.js index 151b0ce5aa92..ed5944769565 100644 --- a/packages/rn-tester/js/examples/Animated/TransformBounceExample.js +++ b/packages/rn-tester/js/examples/Animated/TransformBounceExample.js @@ -112,7 +112,7 @@ component TransformBounceExample() { ); } -export default ({ +export default { title: 'Transform Bounce', name: 'transformBounce', expect: 'Transform animation on rotation, translation, scale of View', @@ -120,6 +120,6 @@ export default ({ 'spring with custom constants and mapped to an ' + 'ordered set of transforms. Each transform has ' + 'an interpolation to convert the value into the ' + - 'right range and units.': string), + 'right range and units.') as string, render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Animated/TransformStylesExample.js b/packages/rn-tester/js/examples/Animated/TransformStylesExample.js index 3da1dda0421f..c9a4942ae7f7 100644 --- a/packages/rn-tester/js/examples/Animated/TransformStylesExample.js +++ b/packages/rn-tester/js/examples/Animated/TransformStylesExample.js @@ -163,9 +163,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Transform Styles', name: 'transformStyles', description: 'Variations of transform styles.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js b/packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js index f8eb3d25d773..689123b02329 100644 --- a/packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js +++ b/packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js @@ -19,11 +19,11 @@ const canUseBackend = ReactNativeFeatureFlags.useSharedAnimatedBackend() && ReactNativeFeatureFlags.cxxNativeAnimatedEnabled(); -export default ({ +export default { framework: 'React', title: 'Animation Backend', category: 'UI', description: `Examples demonstrating the Animation Backend for layout-updating animations. ${canUseBackend ? '' : 'You need to enable c++ Animated and the Animation Backend to see these examples.'}`, showIndividualExamples: true, examples: canUseBackend ? [PlaygroundExample, SwipeableListExample] : [], -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js b/packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js index 5bf011860ba2..a343729e47fe 100644 --- a/packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js +++ b/packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js @@ -126,9 +126,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Chessboard', name: 'chessboard', description: 'Combine animating layout with state updates', render: (): React.Node => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js b/packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js index 2ede306fa51d..35e7d47aca6a 100644 --- a/packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js +++ b/packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js @@ -278,9 +278,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Swipeable List', name: 'swipeableList', description: 'A swipeable list with width animation', render: (): React.Node => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Border/BorderExample.js b/packages/rn-tester/js/examples/Border/BorderExample.js index cc4876ca748c..6b36f32e4432 100644 --- a/packages/rn-tester/js/examples/Border/BorderExample.js +++ b/packages/rn-tester/js/examples/Border/BorderExample.js @@ -259,7 +259,7 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Border', category: 'UI', description: 'Demonstrates some of the border styles available to Views.', @@ -623,4 +623,4 @@ export default ({ }, }, ], -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/Button/ButtonExample.js b/packages/rn-tester/js/examples/Button/ButtonExample.js index 55409a8a126c..115398fa119c 100644 --- a/packages/rn-tester/js/examples/Button/ButtonExample.js +++ b/packages/rn-tester/js/examples/Button/ButtonExample.js @@ -47,7 +47,7 @@ exports.examples = [ name: 'color-red', description: ('Note: On iOS, the color prop controls the color of the text. On ' + - 'Android, the color adjusts the background color of the button.': string), + 'Android, the color adjusts the background color of the button.') as string, render: function (): React.Node { return ( @@ -71,7 +71,7 @@ exports.examples = [ name: 'two-buttons-flexbox', description: ('Two buttons wrapped inside view with justifyContent: spaceBetween,' + - 'This layout strategy lets the title define the width of the button': string), + 'This layout strategy lets the title define the width of the button') as string, render: function (): React.Node { return ( @@ -163,7 +163,7 @@ exports.examples = [ { title: 'Button with accessibilityLabel="label"', description: ('Note: This prop changes the text that a screen ' + - 'reader announces (there are no visual differences).': string), + 'reader announces (there are no visual differences).') as string, render: function (): React.Node { return ( @@ -185,7 +185,7 @@ exports.examples = [ { title: 'Button with aria-label="label"', description: ('Note: This prop changes the text that a screen ' + - 'reader announces (there are no visual differences).': string), + 'reader announces (there are no visual differences).') as string, render: function (): React.Node { return ( @@ -208,7 +208,7 @@ exports.examples = [ title: 'Button with accessibilityState={{disabled: true}}', description: ('Note: This prop will announce on TalkBack that the button is disabled. ' + - 'The "disabled" prop has higher precedence on the state of the component': string), + 'The "disabled" prop has higher precedence on the state of the component') as string, render: function (): React.Node { return ( diff --git a/packages/rn-tester/js/examples/Crash/CrashExample.js b/packages/rn-tester/js/examples/Crash/CrashExample.js index 86893460bfd8..b2515d16b94e 100644 --- a/packages/rn-tester/js/examples/Crash/CrashExample.js +++ b/packages/rn-tester/js/examples/Crash/CrashExample.js @@ -14,7 +14,7 @@ import type {Node} from 'react'; import * as React from 'react'; import {Button} from 'react-native'; -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.framework = 'React'; exports.title = 'Crash'; exports.category = 'Basic'; diff --git a/packages/rn-tester/js/examples/DisplayContents/DisplayContentsExample.js b/packages/rn-tester/js/examples/DisplayContents/DisplayContentsExample.js index 175c71f78b42..d6f35179bebf 100644 --- a/packages/rn-tester/js/examples/DisplayContents/DisplayContentsExample.js +++ b/packages/rn-tester/js/examples/DisplayContents/DisplayContentsExample.js @@ -47,7 +47,7 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Display: contents', category: 'UI', description: @@ -218,4 +218,4 @@ export default ({ }, }, ], -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js index bb3458e48edd..8b75a69184b3 100644 --- a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js +++ b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js @@ -67,25 +67,25 @@ function CompatibilityAnimatedPointerMove(): React.Node { { translateX: xCoord.interpolate({ inputRange: [0, WIDTH], - outputRange: ([0, WIDTH / 2]: number[]), + outputRange: [0, WIDTH / 2] as number[], }), }, { translateY: yCoord.interpolate({ inputRange: [0, HEIGHT], - outputRange: ([0, HEIGHT / 2]: number[]), + outputRange: [0, HEIGHT / 2] as number[], }), }, { scaleX: xCoord.interpolate({ inputRange: [0, WIDTH], - outputRange: ([0, WIDTH]: number[]), + outputRange: [0, WIDTH] as number[], }), }, { scaleY: yCoord.interpolate({ inputRange: [0, HEIGHT], - outputRange: ([0, HEIGHT]: number[]), + outputRange: [0, HEIGHT] as number[], }), }, ], @@ -96,7 +96,7 @@ function CompatibilityAnimatedPointerMove(): React.Node { ); } -export default ({ +export default { name: 'compatibility_animatedevent_pointer_move', description: 'An AnimatedEvent example on onPointerMove. The blue box should scale to pointer event offset values within black box', @@ -104,4 +104,4 @@ export default ({ render(): React.Node { return ; }, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js index c5fc10ad0fa3..fd3282998338 100644 --- a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js +++ b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js @@ -54,7 +54,7 @@ function CompatibilityNativeGestureHandling(): React.Node { ); } -export default ({ +export default { name: 'compatibility_native_gesture', title: 'Native Gesture Handling Example', description: @@ -62,4 +62,4 @@ export default ({ render(): React.Node { return ; }, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js b/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js index edda7691b56e..baab2e15277b 100644 --- a/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js +++ b/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js @@ -84,11 +84,11 @@ function ManyPointersPropertiesExample(): React.Node { ); } -export default ({ +export default { name: 'many_pointers_properties_example', description: 'Display of properties for multiple pointers', title: 'Display Properties of many pointers', render(): React.Node { return ; }, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js index b8ba306ff90c..29fe99f1e3a4 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers.js @@ -32,8 +32,8 @@ function PointerEventAttributesHoverablePointersTestCase( ) { const {harness} = props; - const detected_pointertypesRef = useRef(({}: {[string]: boolean})); - const detected_eventTypesRef = useRef(({}: {[string]: boolean})); + const detected_pointertypesRef = useRef({} as {[string]: boolean}); + const detected_eventTypesRef = useRef({} as {[string]: boolean}); const expectedPointerIdRef = useRef(NaN); const [square1Visible, setSquare1Visible] = useState(true); @@ -188,7 +188,7 @@ function PointerEventAttributesHoverablePointersTestCase( eventList.length ) { setSquare1Visible(false); - detected_eventTypesRef.current = ({}: {[string]: boolean}); + detected_eventTypesRef.current = {} as {[string]: boolean}; setSquare2Visible(true); expectedPointerIdRef.current = NaN; } diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js index 4aec343c3018..c51870c1f1e0 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers.js @@ -31,8 +31,8 @@ function PointerEventAttributesNoHoverPointersTestCase( ) { const {harness} = props; - const detected_pointertypesRef = useRef(({}: {[string]: boolean})); - const detected_eventTypesRef = useRef(({}: {[string]: boolean})); + const detected_pointertypesRef = useRef({} as {[string]: boolean}); + const detected_eventTypesRef = useRef({} as {[string]: boolean}); const expectedPointerIdRef = useRef(NaN); const [square1Visible, setSquare1Visible] = useState(true); @@ -156,7 +156,7 @@ function PointerEventAttributesNoHoverPointersTestCase( eventList.length ) { setSquare1Visible(false); - detected_eventTypesRef.current = ({}: {[string]: boolean}); + detected_eventTypesRef.current = {} as {[string]: boolean}; setSquare2Visible(true); expectedPointerIdRef.current = NaN; } diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js index e45a7defda72..9981088303e0 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js @@ -24,7 +24,7 @@ function PointerEventPointerMoveTestCase( ) { const {harness} = props; - const detectedPointerTypesRef = useRef(({}: {[string]: boolean})); + const detectedPointerTypesRef = useRef({} as {[string]: boolean}); const testPointerMove = harness.useAsyncTest('pointermove event received'); const handlers = useTestEventHandler( diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js index 6e7448a3643e..69ea788cc88d 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js @@ -45,7 +45,7 @@ function PointerEventPrimaryTouchPointerTestCase( ) { const {harness} = props; - const detected_eventsRef = useRef(({}: {[string]: boolean})); + const detected_eventsRef = useRef({} as {[string]: boolean}); const handleIncomingPointerEvent = useCallback( (boxLabel: string, eventType: string, isPrimary: boolean) => { diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js index 9ac07d70b637..cdcef788d216 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js @@ -444,9 +444,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Basic', name: 'basic', description: 'Simple list of items', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js b/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js index f71892372404..d5a1c8280f4f 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js @@ -77,10 +77,10 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Content Inset', name: 'contentInset', description: 'The amount by which the scroll view content is inset from the edges of the scroll view.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js b/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js index d0596d8de445..1ffcfafa32f8 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js @@ -37,9 +37,9 @@ export component FlatList_inverted() { ); } -export default ({ +export default { title: 'Inverted', name: 'inverted', description: 'Test inverted prop on FlatList', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-maintainVisibleContentPosition.js b/packages/rn-tester/js/examples/FlatList/FlatList-maintainVisibleContentPosition.js index f674b5aec423..f46ee0cd8ea6 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-maintainVisibleContentPosition.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-maintainVisibleContentPosition.js @@ -91,9 +91,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'maintainVisibleContentPosition', name: 'maintainVisibleContentPosition', description: 'Test maintainVisibleContentPosition prop on FlatList', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js index a0b043de57f4..4b54ba987c8d 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js @@ -196,9 +196,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'MultiColumn', name: 'multicolumn', description: 'Performant, scrollable grid of data', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-nested.js b/packages/rn-tester/js/examples/FlatList/FlatList-nested.js index 3abbe4d80fd7..d48f005c1c3c 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-nested.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-nested.js @@ -329,9 +329,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Nested', description: 'Nested FlatLists of same and opposite orientation', name: 'nested', render: NestedListExample, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onEndReached.js b/packages/rn-tester/js/examples/FlatList/FlatList-onEndReached.js index 9354ecc9ad5b..132778d07b87 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onEndReached.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onEndReached.js @@ -42,7 +42,7 @@ export component FlatList_onEndReached() { ); } -export default ({ +export default { title: 'onEndReached', name: 'onEndReached', description: @@ -50,4 +50,4 @@ export default ({ render: function () { return ; }, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js b/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js index 0424dc43db0f..0e5e6d5ef9ca 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js @@ -46,7 +46,7 @@ export component FlatList_onStartReached() { ); } -export default ({ +export default { title: 'onStartReached', name: 'onStartReached', description: @@ -54,4 +54,4 @@ export default ({ render: function () { return ; }, -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-noWaitForInteraction.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-noWaitForInteraction.js index d21359ac1390..d5744dbbfc3d 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-noWaitForInteraction.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-noWaitForInteraction.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {FlatList_BaseOnViewableItemsChanged} from './FlatList-BaseOnViewableItemsChanged'; import * as React from 'react'; -export default ({ +export default { title: 'onViewableItemsChanged horizontal', name: 'onViewableItemsChanged-horizontal-noWaitForInteraction', description: @@ -27,4 +27,4 @@ export default ({ waitForInteraction={false} /> ), -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-offScreen.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-offScreen.js index 94f0ec5c31b2..7711d7b17425 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-offScreen.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-offScreen.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {FlatList_BaseOnViewableItemsChanged} from './FlatList-BaseOnViewableItemsChanged'; import * as React from 'react'; -export default ({ +export default { title: 'onViewableItemsChanged horizontal', name: 'onViewableItemsChanged-horizontal-offScreen', description: 'E2E Test:\nonViewableItemsChanged-horizontal-offScreen', @@ -26,4 +26,4 @@ export default ({ waitForInteraction={true} /> ), -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-waitForInteraction.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-waitForInteraction.js index f0a25e3aff98..41e297e3136a 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-waitForInteraction.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-horizontal-waitForInteraction.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {FlatList_BaseOnViewableItemsChanged} from './FlatList-BaseOnViewableItemsChanged'; import * as React from 'react'; -export default ({ +export default { title: 'onViewableItemsChanged horizontal', name: 'onViewableItemsChanged-horizontal-waitForInteraction', description: @@ -27,4 +27,4 @@ export default ({ waitForInteraction={true} /> ), -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-noWaitForInteraction.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-noWaitForInteraction.js index 50dd25f69383..401b136ddce9 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-noWaitForInteraction.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-noWaitForInteraction.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {FlatList_BaseOnViewableItemsChanged} from './FlatList-BaseOnViewableItemsChanged'; import * as React from 'react'; -export default ({ +export default { title: 'onViewableItemsChanged', name: 'onViewableItemsChanged_noWaitForInteraction', description: 'E2E Test:\nonViewableItemsChanged-noWaitForInteraction', @@ -23,4 +23,4 @@ export default ({ render: () => ( ), -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-offScreen.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-offScreen.js index 7accf7f4f465..0165714a38d8 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-offScreen.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-offScreen.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {FlatList_BaseOnViewableItemsChanged} from './FlatList-BaseOnViewableItemsChanged'; import * as React from 'react'; -export default ({ +export default { title: 'onViewableItemsChanged offScreen', name: 'onViewableItemsChanged-offScreen', description: 'E2E Test:\nonViewableItemsChanged-offScreen', @@ -26,4 +26,4 @@ export default ({ waitForInteraction={true} /> ), -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-waitForInteraction.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-waitForInteraction.js index d8c203ea7ea7..fa7c4d457db2 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-waitForInteraction.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged-waitForInteraction.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {FlatList_BaseOnViewableItemsChanged} from './FlatList-BaseOnViewableItemsChanged'; import * as React from 'react'; -export default ({ +export default { title: 'onViewableItemsChanged', name: 'onViewableItemsChanged-waitForInteraction', description: 'E2E Test:\nonViewableItemsChanged-waitForInteraction', @@ -23,4 +23,4 @@ export default ({ render: () => ( ), -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js index 60f6ddad19f8..750a9026e226 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js @@ -15,11 +15,11 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {FlatList_BaseOnViewableItemsChanged} from './FlatList-BaseOnViewableItemsChanged'; import * as React from 'react'; -export default ({ +export default { title: 'FlatList onViewableItemsChanged', name: 'onViewableItemsChanged', description: 'Test onViewableItemsChanged behavior', render: () => ( ), -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js b/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js index e3f1f1feda8e..7154d7020488 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js @@ -64,9 +64,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Sticky Headers', name: 'stickyHeaders', description: 'Test sticky headers on FlatList', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-withSeparators.js b/packages/rn-tester/js/examples/FlatList/FlatList-withSeparators.js index dd04d4505fdf..548be0dea48c 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-withSeparators.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-withSeparators.js @@ -60,9 +60,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'FlatList with Separators', name: 'separators', description: 'Tap to see pressed states for separator components.', render: () => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js b/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js index d4ab2f7ae921..58071eeef0d5 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js +++ b/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js @@ -28,7 +28,7 @@ import onViewableItemsChanged_waitForInteractionExample from './FlatList-onViewa import StickyHeadersExample from './FlatList-stickyHeaders'; import WithSeparatorsExample from './FlatList-withSeparators'; -export default ({ +export default { framework: 'React', title: 'FlatList', category: 'ListView', @@ -54,4 +54,4 @@ export default ({ onViewableItemsChanged_offScreen, onViewableItemsChanged_horizontal_offScreen, ], -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/Image/ImageExample.js b/packages/rn-tester/js/examples/Image/ImageExample.js index d928b06832b6..1147e6bf7d1c 100644 --- a/packages/rn-tester/js/examples/Image/ImageExample.js +++ b/packages/rn-tester/js/examples/Image/ImageExample.js @@ -909,7 +909,7 @@ const styles = StyleSheet.create({ }, }); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.framework = 'React'; exports.title = 'Image'; exports.category = 'Basic'; @@ -920,7 +920,7 @@ exports.examples = [ { title: 'Plain Network Image with `source` prop.', description: ('If the `source` prop `uri` property is prefixed with ' + - '"http", then it will be downloaded from the network.': string), + '"http", then it will be downloaded from the network.') as string, render: function (): React.Node { return ; }, @@ -928,7 +928,7 @@ exports.examples = [ { title: 'Plain Network Image with `src` prop.', description: ('If the `src` prop is defined with ' + - '"http", then it will be downloaded from the network.': string), + '"http", then it will be downloaded from the network.') as string, render: function (): React.Node { return ; }, @@ -937,7 +937,7 @@ exports.examples = [ title: 'Multiple Image Source using the `srcSet` prop.', description: ('A list of comma separated uris along with scale are provided in `srcSet`.' + - 'An appropriate value will be used based on the scale of the device.': string), + 'An appropriate value will be used based on the scale of the device.') as string, render: function (): React.Node { return ( ; }, @@ -962,7 +962,7 @@ exports.examples = [ name: 'static-image', description: ('Static assets should be placed in the source code tree, and ' + - 'required in the same way as JavaScript modules.': string), + 'required in the same way as JavaScript modules.') as string, render: function (): React.Node { return ( @@ -1218,7 +1218,7 @@ exports.examples = [ title: 'Tint Color', name: 'tint-color', description: ('The `tintColor` prop changes all the non-alpha ' + - 'pixels to the tint color.': string), + 'pixels to the tint color.') as string, render: function (): React.Node { return ( @@ -1370,7 +1370,7 @@ exports.examples = [ { title: 'Object Fit', description: ('The `objectFit` style prop controls how the image is ' + - 'rendered within the frame.': string), + 'rendered within the frame.') as string, render: function (): React.Node { return ( @@ -1438,7 +1438,7 @@ exports.examples = [ { title: 'Resize Mode', description: ('The `resizeMode` style prop controls how the image is ' + - 'rendered within the frame.': string), + 'rendered within the frame.') as string, render: function (): React.Node { return ( @@ -1552,7 +1552,7 @@ exports.examples = [ ('When the image is resized, the corners of the size specified ' + 'by capInsets will stay a fixed size, but the center content and ' + 'borders of the image will be stretched. This is useful for creating ' + - 'resizable rounded buttons, shadows, and other resizable assets.': string), + 'resizable rounded buttons, shadows, and other resizable assets.') as string, render: function (): React.Node { return ; }, @@ -1568,7 +1568,7 @@ exports.examples = [ title: 'MultipleSourcesExample', description: ('The `source` prop allows passing in an array of uris, so that native to choose which image ' + - 'to diplay based on the size of the of the target image': string), + 'to diplay based on the size of the of the target image') as string, render: function (): React.Node { return ; }, @@ -1576,7 +1576,7 @@ exports.examples = [ { title: 'Legacy local image', description: ('Images shipped with the native bundle, but not managed ' + - 'by the JS packager': string), + 'by the JS packager') as string, render: function (): React.Node { return ; }, @@ -1629,7 +1629,7 @@ exports.examples = [ { title: 'Accessibility', description: - ('If the `accessible` (boolean) prop is set to True, the image will be indicated as an accessbility element.': string), + 'If the `accessible` (boolean) prop is set to True, the image will be indicated as an accessbility element.' as string, render: function (): React.Node { return ; }, @@ -1637,7 +1637,7 @@ exports.examples = [ { title: 'Accessibility Label', description: - ('When an element is marked as accessibile (using the accessibility prop), it is good practice to set an accessibilityLabel on the image to provide a description of the element to people who use VoiceOver. VoiceOver will read this string when people select this element.': string), + 'When an element is marked as accessibile (using the accessibility prop), it is good practice to set an accessibilityLabel on the image to provide a description of the element to people who use VoiceOver. VoiceOver will read this string when people select this element.' as string, render: function (): React.Node { return ( ; }, @@ -1675,7 +1675,7 @@ exports.examples = [ { title: 'Loading Indicator Source', description: - ('This prop is used to set the resource that will be used as the loading indicator for the image (displayed until the image is ready to be displayed).': string), + 'This prop is used to set the resource that will be used as the loading indicator for the image (displayed until the image is ready to be displayed).' as string, render: function (): React.Node { return ; }, @@ -1683,7 +1683,7 @@ exports.examples = [ { title: 'On Layout', description: - ('This prop is used to set the handler function to be called when the image is mounted or its layout changes. The function receives an event with `{nativeEvent: {layout: {x, y, width, height}}}`': string), + 'This prop is used to set the handler function to be called when the image is mounted or its layout changes. The function receives an event with `{nativeEvent: {layout: {x, y, width, height}}}`' as string, render: function (): React.Node { return ; }, @@ -1691,7 +1691,7 @@ exports.examples = [ { title: 'On Partial Load', description: - ('This prop is used to set the handler function to be called when the partial load of the image is complete. This is meant for progressive JPEG loads.': string), + 'This prop is used to set the handler function to be called when the partial load of the image is complete. This is meant for progressive JPEG loads.' as string, render: function (): React.Node { return ; }, diff --git a/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js b/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js index bff02276eb22..3c620dc3db22 100644 --- a/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js +++ b/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js @@ -123,7 +123,7 @@ export const examples: Array = [ render(): React.Node { return ( )}} + actual={{resource_paths: [] as Array}} expected={undefined}> {backgroundColor => ( diff --git a/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js b/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js index 48eef4eacba3..c7c0b8922770 100644 --- a/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js +++ b/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js @@ -33,7 +33,7 @@ exports.examples = [ ('This example tests the native JSResponderHandler: when the user ' + 'scrolls on the right side of the ScrollView (white area located on the' + ' right side of the gray area), the touch event is managed by native ' + - 'which blocks the scroll event.': string), + 'which blocks the scroll event.') as string, render: function (): React.Node { const views = []; diff --git a/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js b/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js index e333c19b5842..4ee3377ff31f 100644 --- a/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js +++ b/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js @@ -253,7 +253,7 @@ exports.examples = [ title: 'Keyboard Avoiding View with different behaviors', description: ('Specify how to react to the presence of the keyboard. Android and iOS both interact' + - 'with this prop differently. On both iOS and Android, setting behavior is recommended.': string), + 'with this prop differently. On both iOS and Android, setting behavior is recommended.') as string, render(): React.Node { return ; }, @@ -262,7 +262,7 @@ exports.examples = [ title: 'Keyboard Avoiding View with keyboardVerticalOffset={distance}', description: ('This is the distance between the top of the user screen and the react native' + - 'view, may be non-zero in some use cases. Defaults to 0.': string), + 'view, may be non-zero in some use cases. Defaults to 0.') as string, render(): React.Node { return ; }, diff --git a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js index bfbb985f83a1..ceb21252e3aa 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js @@ -156,7 +156,7 @@ const styles = StyleSheet.create({ exports.title = 'Layout Events'; exports.category = 'UI'; exports.description = ('Examples that show how Layout events can be used to ' + - 'measure view size and position.': string); + 'measure view size and position.') as string; exports.examples = [ { title: 'LayoutEventExample', diff --git a/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js b/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js index f3d4c7044531..6135bc3137a4 100644 --- a/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js +++ b/packages/rn-tester/js/examples/LayoutConformance/LayoutConformanceExample.js @@ -72,7 +72,7 @@ function LayoutConformanceBox(): React.Node { ); } -export default ({ +export default { title: 'LayoutConformance', description: 'Examples laid out in compatibility mode will show a red bar, not present in examples with conformant layout.', @@ -103,4 +103,4 @@ export default ({ ), }, ], -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/Modal/ModalOnShow.js b/packages/rn-tester/js/examples/Modal/ModalOnShow.js index 6f043eb2cd91..3c46aff997db 100644 --- a/packages/rn-tester/js/examples/Modal/ModalOnShow.js +++ b/packages/rn-tester/js/examples/Modal/ModalOnShow.js @@ -132,10 +132,10 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: "Modal's onShow/onDismiss", name: 'onShow', description: 'onShow and onDismiss (iOS only) callbacks are called when a modal is shown/dismissed', render: (): React.Node => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Modal/ModalPresentation.js b/packages/rn-tester/js/examples/Modal/ModalPresentation.js index 39cf3e97130f..cabf3b5f648c 100644 --- a/packages/rn-tester/js/examples/Modal/ModalPresentation.js +++ b/packages/rn-tester/js/examples/Modal/ModalPresentation.js @@ -381,9 +381,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { description: 'Modals can be presented with or without animation', name: 'basic', render: (): React.Node => , title: 'Modal Presentation', -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js index 09fea74bd42c..442f6a736113 100644 --- a/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js +++ b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js @@ -228,37 +228,39 @@ const styles = StyleSheet.create({ export const title = 'Performance API Examples'; export const category = 'Basic'; export const description = 'Shows the performance API provided in React Native'; -export const examples: Array = ([ - { - title: 'performance.memory', - render: (): React.Node => { - return ; +export const examples: Array = ( + [ + { + title: 'performance.memory', + render: (): React.Node => { + return ; + }, }, - }, - { - title: 'performance.reactNativeStartupTiming', - render: (): React.Node => { - return ; + { + title: 'performance.reactNativeStartupTiming', + render: (): React.Node => { + return ; + }, }, - }, - { - title: 'PerformanceObserver (marks and measures)', - render: (): React.Node => { - return ; + { + title: 'PerformanceObserver (marks and measures)', + render: (): React.Node => { + return ; + }, }, - }, - { - title: 'PerformanceObserver (events)', - render: (): React.Node => { - return ; + { + title: 'PerformanceObserver (events)', + render: (): React.Node => { + return ; + }, }, - }, - PerformanceObserver.supportedEntryTypes.includes('longtask') - ? { - title: 'PerformanceObserver (long tasks)', - render: (): React.Node => { - return ; - }, - } - : null, -]: Array).filter(Boolean); + PerformanceObserver.supportedEntryTypes.includes('longtask') + ? { + title: 'PerformanceObserver (long tasks)', + render: (): React.Node => { + return ; + }, + } + : null, + ] as Array +).filter(Boolean); diff --git a/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js b/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js index 94f9eedbadbb..96a643b9bdf4 100644 --- a/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js +++ b/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js @@ -147,7 +147,7 @@ const styles = StyleSheet.create({ }, }); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.framework = 'React'; exports.title = 'PermissionsAndroid'; exports.category = 'Android'; diff --git a/packages/rn-tester/js/examples/Playground/RNTesterPlayground.js b/packages/rn-tester/js/examples/Playground/RNTesterPlayground.js index d37d0d4a9154..8e6b10479de7 100644 --- a/packages/rn-tester/js/examples/Playground/RNTesterPlayground.js +++ b/packages/rn-tester/js/examples/Playground/RNTesterPlayground.js @@ -30,9 +30,9 @@ const styles = StyleSheet.create({ }, }); -export default ({ +export default { title: 'Playground', name: 'playground', description: 'Test out new features and ideas.', render: (): React.Node => , -}: RNTesterModuleExample); +} as RNTesterModuleExample; diff --git a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js index a88dac42909e..28bf3ec27c57 100644 --- a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js +++ b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js @@ -463,5 +463,5 @@ exports.framework = 'React'; exports.title = 'Pointer Events'; exports.category = 'Basic'; exports.description = ('Demonstrates the use of the pointerEvents prop of a ' + - 'View to control how touches should be handled.': string); -exports.examples = (exampleClasses.map(infoToExample): Array); + 'View to control how touches should be handled.') as string; +exports.examples = exampleClasses.map(infoToExample) as Array; diff --git a/packages/rn-tester/js/examples/Pressable/PressableExample.js b/packages/rn-tester/js/examples/Pressable/PressableExample.js index a81d4147c46c..0e2f6c035a43 100644 --- a/packages/rn-tester/js/examples/Pressable/PressableExample.js +++ b/packages/rn-tester/js/examples/Pressable/PressableExample.js @@ -374,7 +374,7 @@ const examples = [ { title: 'Change child based on Press', description: - ('You should be able to press the button, move your finger while pressing, and release it with the proper status updates.': string), + 'You should be able to press the button, move your finger while pressing, and release it with the proper status updates.' as string, render(): React.Node { return ( @@ -402,7 +402,7 @@ const examples = [ title: 'Pressable feedback events', name: 'feedback-events', description: (' components accept onPress, onPressIn, ' + - 'onPressOut, and onLongPress as props.': string), + 'onPressOut, and onLongPress as props.') as string, render: function (): React.Node { return ; }, @@ -410,7 +410,7 @@ const examples = [ { title: 'Pressable with Ripple and Animated child', description: - ('Pressable can have an AnimatedComponent as a direct child.': string), + 'Pressable can have an AnimatedComponent as a direct child.' as string, platform: 'android', render: function (): React.Node { const mScale = new Animated.Value(1); @@ -437,7 +437,7 @@ const examples = [ { title: 'Pressable with custom Ripple', description: - ("Pressable can specify ripple's radius, color and borderless params": string), + "Pressable can specify ripple's radius, color and borderless params" as string, platform: 'android', render: function (): React.Node { const nativeFeedbackButton = { @@ -523,7 +523,7 @@ const examples = [ title: 'Pressable delay for events', description: (' also accept delayPressIn, ' + 'delayPressOut, and delayLongPress as props. These props impact the ' + - 'timing of feedback events.': string), + 'timing of feedback events.') as string, render: function (): React.Node { return ; }, @@ -542,7 +542,7 @@ const examples = [ name: 'hit-slop', description: (' components accept hitSlop prop which extends the touch area ' + - 'without changing the view bounds.': string), + 'without changing the view bounds.') as string, render: function (): React.Node { return ; }, @@ -550,7 +550,7 @@ const examples = [ { title: 'Pressable Native Methods', description: - (' components expose native methods like `measure`.': string), + ' components expose native methods like `measure`.' as string, render: function (): React.Node { return ; }, @@ -559,7 +559,7 @@ const examples = [ title: 'Disabled Pressable', description: (' components accept disabled prop which prevents ' + - 'any interaction with component': string), + 'any interaction with component') as string, render: function (): React.Node { return ; }, @@ -567,14 +567,14 @@ const examples = [ { title: 'Pressable with aria-label="label"', description: ('Note: This prop changes the text that a screen ' + - 'reader announces (there are no visual differences).': string), + 'reader announces (there are no visual differences).') as string, render: function (): React.Node { return ; }, }, { title: 'Pressable with box-shadow', - description: ('Pressables with box-shadow': string), + description: 'Pressables with box-shadow' as string, render: function PressableWithBoxShadow(): React.Node { const [parentColor, setParentColor] = useState('red'); const [childColor, setChildColor] = useState('blue'); @@ -612,7 +612,7 @@ const examples = [ ...PressableExampleFbInternal.examples, ]; -module.exports = ({ +module.exports = { title: 'Pressable', documentationURL: 'https://reactnative.dev/docs/pressable', category: 'UI', @@ -621,4 +621,4 @@ module.exports = ({ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See * https://fburl.com/workplace/6291gfvu */ examples, -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/RTL/RTLExample.js b/packages/rn-tester/js/examples/RTL/RTLExample.js index 66977b1ea06d..c8fa0a915a11 100644 --- a/packages/rn-tester/js/examples/RTL/RTLExample.js +++ b/packages/rn-tester/js/examples/RTL/RTLExample.js @@ -735,7 +735,7 @@ exports.examples = [ { title: 'Default Text Alignment', description: ('In iOS, it depends on active language. ' + - 'In Android, it depends on the text content.': string), + 'In Android, it depends on the text content.') as string, render: function (): React.MixedElement { return ; }, @@ -743,7 +743,7 @@ exports.examples = [ { title: "Using textAlign: 'left'", description: ('In iOS/Android, text alignment flips regardless of ' + - 'languages or text content.': string), + 'languages or text content.') as string, render: function (): React.MixedElement { return ( ; }, diff --git a/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js b/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js index a72b0817cc5c..0acfd5776968 100644 --- a/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js +++ b/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js @@ -77,7 +77,7 @@ const styles = StyleSheet.create({ }, }); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.framework = 'React'; exports.title = 'SafeAreaView'; exports.category = 'UI'; @@ -97,7 +97,7 @@ exports.examples = [ ('`DeviceInfo.isIPhoneX_deprecated` returns true only on iPhone X. ' + 'Note: This prop is deprecated and will be removed in a future ' + 'release. Please use this only for a quick and temporary solution. ' + - 'Use instead.': string), + 'Use instead.') as string, render: (): React.Node => , }, ] as Array; diff --git a/packages/rn-tester/js/examples/Share/ShareExample.js b/packages/rn-tester/js/examples/Share/ShareExample.js index 03a2d17c7498..8a654c0cccda 100644 --- a/packages/rn-tester/js/examples/Share/ShareExample.js +++ b/packages/rn-tester/js/examples/Share/ShareExample.js @@ -22,7 +22,7 @@ const shareMessage = () => { Share.share({ message: ('Our top priority for React Native is to match the expectations people have for each platform. This is why React Native renders to platform primitives. We value native look-and-feel over cross-platform consistency.' + - 'For example, the TextInput in React Native renders to a UITextField on iOS. This ensures that integration with password managers and keyboard controls work out of the box. By using platform primitives, React Native apps are also able to stay up-to-date with design and behavior changes from new releases of Android and iOS.': string), + 'For example, the TextInput in React Native renders to a UITextField on iOS. This ensures that integration with password managers and keyboard controls work out of the box. By using platform primitives, React Native apps are also able to stay up-to-date with design and behavior changes from new releases of Android and iOS.') as string, }); }; @@ -33,7 +33,7 @@ const shareText = () => { title: 'Massive Scale', message: ('Hundreds of screens in the Facebook app are implemented with React Native. The Facebook app is used by billions of people on a huge range of devices. This is why we invest in the most challenging problems at scale.' + - 'Deploying React Native in our apps lets us identify problems that we wouldn’t see at a smaller scale. For example, Facebook focuses on improving performance across a broad spectrum of devices from the newest iPhone to many older generations of Android devices. This focus informs our architecture projects such as Hermes, Fabric, and TurboModules.': string), + 'Deploying React Native in our apps lets us identify problems that we wouldn’t see at a smaller scale. For example, Facebook focuses on improving performance across a broad spectrum of devices from the newest iPhone to many older generations of Android devices. This focus informs our architecture projects such as Hermes, Fabric, and TurboModules.') as string, url: 'https://reactnative.dev/blog/2020/07/17/react-native-principles', }, { @@ -92,7 +92,7 @@ const SharedAction = () => { { title: 'Create native apps', message: - ('React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces.': string), + 'React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces.' as string, url: 'https://reactnative.dev/', }, { diff --git a/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js b/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js index 7df3686e5438..7c303802e279 100644 --- a/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js +++ b/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js @@ -35,7 +35,7 @@ module.exports = { title: 'SwipeableCardExample', description: ('This example creates a swipeable card using PanResponder. ' + - 'Under the hood, JSResponderHandler should prevent scroll when the card is being swiped.': string), + 'Under the hood, JSResponderHandler should prevent scroll when the card is being swiped.') as string, render: function (): React.Node { return ; }, diff --git a/packages/rn-tester/js/examples/Text/TextExample.android.js b/packages/rn-tester/js/examples/Text/TextExample.android.js index b46af7717479..f0896eae6080 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.android.js +++ b/packages/rn-tester/js/examples/Text/TextExample.android.js @@ -1768,11 +1768,11 @@ const styles = StyleSheet.create({ }, }); -module.exports = ({ +module.exports = { title: 'Text', documentationURL: 'https://reactnative.dev/docs/text', category: 'Basic', description: 'Base component for rendering styled text.', displayName: 'TextExample', examples, -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/Text/TextExample.ios.js b/packages/rn-tester/js/examples/Text/TextExample.ios.js index a377e4ac0778..68b4a103a87e 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.ios.js +++ b/packages/rn-tester/js/examples/Text/TextExample.ios.js @@ -575,7 +575,7 @@ const examples = [ title: 'iOS System Font Families (iOS only)', name: 'iOSSystemFontFamilies', description: - ('Shows system font families including system-ui/ui-sans-serif, ui-serif, ui-monospace, and ui-rounded': string), + 'Shows system font families including system-ui/ui-sans-serif, ui-serif, ui-monospace, and ui-rounded' as string, render: function (): React.Node { const baseTextStyle = {fontSize: 20}; return ( @@ -925,7 +925,7 @@ const examples = [ name: 'nested', description: ('Nested text components will inherit the styles of their ' + 'parents (only backgroundColor is inherited from non-Text parents). ' + - ' only supports other and raw text (strings) as children.': string), + ' only supports other and raw text (strings) as children.') as string, render: function (): React.Node { return ( @@ -1601,11 +1601,11 @@ const examples = [ ...TextSharedExamples, ]; -module.exports = ({ +module.exports = { title: 'Text', documentationURL: 'https://reactnative.dev/docs/text', category: 'Basic', description: 'Base component for rendering styled text.', displayName: 'TextExample', examples, -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js index c5fb829b6f2e..b74ac5e8f15e 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js @@ -508,11 +508,11 @@ const examples: Array = [ }, ]; -module.exports = ({ - displayName: (undefined: ?string), +module.exports = { + displayName: undefined as ?string, title: 'TextInput', documentationURL: 'https://reactnative.dev/docs/textinput', category: 'Basic', description: 'Single and multi-line text inputs.', examples, -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js index 0ddd6ee95080..a3e0621e8bfa 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js @@ -1053,11 +1053,11 @@ const textInputExamples: Array = [ }, ]; -module.exports = ({ - displayName: (undefined: ?string), +module.exports = { + displayName: undefined as ?string, title: 'TextInput', documentationURL: 'https://reactnative.dev/docs/TextInput', category: 'Basic', description: 'Single and multi-line text inputs.', examples: textInputExamples, -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js index 324c13e31710..3aa30acc36ac 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js @@ -921,7 +921,7 @@ function AutogrowingTextInputExample({ ); } -module.exports = ([ +module.exports = [ { title: 'Auto-focus & select text on focus', render: function (): React.Node { @@ -1288,4 +1288,4 @@ module.exports = ([ ); }, }, -]: Array); +] as Array; diff --git a/packages/rn-tester/js/examples/Timer/TimerExample.js b/packages/rn-tester/js/examples/Timer/TimerExample.js index 71b31327f0cb..a80bdbac9f65 100644 --- a/packages/rn-tester/js/examples/Timer/TimerExample.js +++ b/packages/rn-tester/js/examples/Timer/TimerExample.js @@ -324,7 +324,7 @@ exports.examples = [ title: 'this.setTimeout(fn, t)', description: ('Execute function fn t milliseconds in the future. If ' + 't === 0, it will be enqueued immediately in the next event loop. ' + - 'Larger values will fire on the closest frame.': string), + 'Larger values will fire on the closest frame.') as string, render: function (): React.Node { return ( @@ -373,7 +373,7 @@ exports.examples = [ { title: 'this.setInterval(fn, t)', description: ('Execute function fn every t milliseconds until cancelled ' + - 'or component is unmounted.': string), + 'or component is unmounted.') as string, render: function (): React.Node { return ; }, diff --git a/packages/rn-tester/js/examples/Touchable/TouchableExample.js b/packages/rn-tester/js/examples/Touchable/TouchableExample.js index a7c7c5c69620..868a682ee5d7 100644 --- a/packages/rn-tester/js/examples/Touchable/TouchableExample.js +++ b/packages/rn-tester/js/examples/Touchable/TouchableExample.js @@ -664,7 +664,7 @@ const styles = StyleSheet.create({ }, }); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.description = 'Touchable and onPress examples.'; exports.title = 'Touchable* and onPress'; exports.category = 'UI'; @@ -677,7 +677,7 @@ exports.examples = [ 'black background under the single child view. This works best when the ' + 'child view is fully opaque, although it can be made to work as a simple ' + 'background color change as well with the activeOpacity and ' + - 'underlayColor props.': string), + 'underlayColor props.') as string, render(): React.Node { return ; }, @@ -692,7 +692,7 @@ exports.examples = [ { title: 'TouchableNativeFeedback with Animated child', description: ('TouchableNativeFeedback can have an AnimatedComponent as a' + - 'direct child.': string), + 'direct child.') as string, platform: 'android', render(): React.Node { const mScale = new Animated.Value(1); @@ -746,7 +746,7 @@ exports.examples = [ title: 'Touchable feedback events', name: 'feedback-events', description: (' components accept onPress, onPressIn, ' + - 'onPressOut, and onLongPress as props.': string), + 'onPressOut, and onLongPress as props.') as string, render(): React.MixedElement { return ; }, @@ -755,7 +755,7 @@ exports.examples = [ title: 'Touchable delay for events', description: (' components also accept delayPressIn, ' + 'delayPressOut, and delayLongPress as props. These props impact the ' + - 'timing of feedback events.': string), + 'timing of feedback events.') as string, render(): React.MixedElement { return ; }, @@ -774,7 +774,7 @@ exports.examples = [ name: 'hit-slop', description: (' components accept hitSlop prop which extends the touch area ' + - 'without changing the view bounds.': string), + 'without changing the view bounds.') as string, render(): React.MixedElement { return ; }, @@ -782,7 +782,7 @@ exports.examples = [ { title: 'Touchable Native Methods', description: - ('Some components expose native methods like `measure`.': string), + 'Some components expose native methods like `measure`.' as string, render(): React.MixedElement { return ; }, @@ -790,7 +790,7 @@ exports.examples = [ { title: 'Custom Ripple Radius (Android-only)', description: - ('Ripple radius on TouchableNativeFeedback can be controlled': string), + 'Ripple radius on TouchableNativeFeedback can be controlled' as string, render(): React.MixedElement { return ; }, @@ -799,7 +799,7 @@ exports.examples = [ title: 'Disabled Touchable*', description: (' components accept disabled prop which prevents ' + - 'any interaction with component': string), + 'any interaction with component') as string, render(): React.MixedElement { return ; }, diff --git a/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js b/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js index 1bd83920c293..286eccb76c94 100644 --- a/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js @@ -17,7 +17,7 @@ const { } = require('./SampleLegacyModuleExample'); const React = require('react'); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.title = 'Legacy Native Module'; exports.category = 'Basic'; exports.description = 'Usage of legacy Native Module'; diff --git a/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js b/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js index 65771081a170..439a3e071680 100644 --- a/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; const NativeCxxModuleExampleExample = require('./NativeCxxModuleExampleExample'); const React = require('react'); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.title = 'Cxx TurboModule'; exports.category = 'Basic'; exports.description = 'Usage of Cxx TurboModule'; diff --git a/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js b/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js index b3174fa72121..25236453d54c 100644 --- a/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js @@ -15,7 +15,7 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; const SampleTurboModuleExample = require('./SampleTurboModuleExample'); const React = require('react'); -exports.displayName = (undefined: ?string); +exports.displayName = undefined as ?string; exports.title = 'TurboModule'; exports.category = 'Basic'; exports.description = 'Usage of TurboModule'; diff --git a/packages/rn-tester/js/examples/View/ViewExample.js b/packages/rn-tester/js/examples/View/ViewExample.js index 773dda2440fd..6069a64a955e 100644 --- a/packages/rn-tester/js/examples/View/ViewExample.js +++ b/packages/rn-tester/js/examples/View/ViewExample.js @@ -768,12 +768,12 @@ function FocusBlurExample(): React.Node { ); } -export default ({ +export default { title: 'View', documentationURL: 'https://reactnative.dev/docs/view', category: 'Basic', description: ('Basic building block of all UI, examples that ' + - 'demonstrate some of the many styles available.': string), + 'demonstrate some of the many styles available.') as string, displayName: 'ViewExample', examples: [ { @@ -1438,4 +1438,4 @@ export default ({ render: FocusBlurExample, }, ], -}: RNTesterModule); +} as RNTesterModule; diff --git a/packages/rn-tester/js/examples/XHR/XHRExample.js b/packages/rn-tester/js/examples/XHR/XHRExample.js index 99a292913441..98b5a1ea6ee3 100644 --- a/packages/rn-tester/js/examples/XHR/XHRExample.js +++ b/packages/rn-tester/js/examples/XHR/XHRExample.js @@ -24,7 +24,7 @@ exports.framework = 'React'; exports.title = 'XMLHttpRequest'; exports.category = 'Basic'; exports.description = ('Example that demonstrates upload and download ' + - 'requests using XMLHttpRequest.': string); + 'requests using XMLHttpRequest.') as string; exports.examples = [ { title: 'File Download', diff --git a/packages/rn-tester/js/utils/RNTesterList.android.js b/packages/rn-tester/js/utils/RNTesterList.android.js index be56f596a0de..468bdcfa0f36 100644 --- a/packages/rn-tester/js/utils/RNTesterList.android.js +++ b/packages/rn-tester/js/utils/RNTesterList.android.js @@ -153,255 +153,257 @@ const Components: Array = [ ...RNTesterListFbInternal.Components, ]; -const APIs: Array = ([ - { - key: 'AccessibilityExample', - category: 'Basic', - module: require('../examples/Accessibility/AccessibilityExample'), - }, - { - key: 'AccessibilityAndroidExample', - category: 'Android', - module: require('../examples/Accessibility/AccessibilityAndroidExample'), - }, - { - key: 'AlertExample', - category: 'UI', - module: require('../examples/Alert/AlertExample').default, - }, - { - key: 'AnimatedIndex', - category: 'UI', - module: require('../examples/Animated/AnimatedIndex').default, - }, - { - key: 'AnimationBackendIndex', - category: 'UI', - module: require('../examples/AnimationBackend/AnimationBackendIndex') - .default, - }, - { - key: 'Animation - GratuitousAnimation', - category: 'UI', - module: require('../examples/AnimatedGratuitousApp/AnExApp'), - }, - { - key: 'AppearanceExample', - category: 'UI', - module: require('../examples/Appearance/AppearanceExample'), - }, - { - key: 'AppStateExample', - category: 'Basic', - module: require('../examples/AppState/AppStateExample'), - }, - { - key: 'ContentURLAndroid', - category: 'Android', - module: require('../examples/ContentURLAndroid/ContentURLAndroid'), - }, - { - key: 'URLExample', - category: 'Basic', - module: require('../examples/Urls/UrlExample'), - }, - { - key: 'BorderExample', - category: 'UI', - module: require('../examples/Border/BorderExample').default, - }, - { - key: 'CrashExample', - category: 'Basic', - module: require('../examples/Crash/CrashExample'), - }, - { - key: 'DevSettings', - category: 'Basic', - module: require('../examples/DevSettings/DevSettingsExample'), - }, - { - key: 'Dimensions', - category: 'UI', - module: require('../examples/Dimensions/DimensionsExample'), - }, - { - key: 'DisplayContentsExample', - category: 'UI', - module: require('../examples/DisplayContents/DisplayContentsExample') - .default, - }, - { - key: 'FocusEventsExample', - module: require('../examples/FocusEventsExample/FocusEventsExample') - .default, - }, - { - key: 'InvalidPropsExample', - module: require('../examples/InvalidProps/InvalidPropsExample'), - }, - { - key: 'Keyboard', - category: 'Basic', - module: require('../examples/Keyboard/KeyboardExample').default, - }, - { - key: 'LayoutEventsExample', - category: 'UI', - module: require('../examples/Layout/LayoutEventsExample'), - }, - { - key: 'LinkingExample', - category: 'Basic', - module: require('../examples/Linking/LinkingExample'), - }, - { - key: 'LayoutAnimationExample', - category: 'UI', - module: require('../examples/Layout/LayoutAnimationExample'), - }, - { - key: 'LayoutExample', - category: 'UI', - module: require('../examples/Layout/LayoutExample'), - }, - { - key: 'NativeAnimationsExample', - category: 'UI', - module: require('../examples/NativeAnimation/NativeAnimationsExample'), - }, - { - key: 'OrientationChangeExample', - category: 'UI', - module: require('../examples/OrientationChange/OrientationChangeExample'), - }, - { - key: 'PanResponderExample', - category: 'Basic', - module: require('../examples/PanResponder/PanResponderExample'), - }, - { - key: 'PixelRatio', - category: 'UI', - module: require('../examples/PixelRatio/PixelRatioExample'), - }, - { - key: 'PermissionsExampleAndroid', - category: 'Android', - module: require('../examples/PermissionsAndroid/PermissionsExample'), - }, - { - key: 'PlatformColorExample', - category: 'UI', - module: require('../examples/PlatformColor/PlatformColorExample'), - }, - { - key: 'PointerEventsExample', - category: 'Basic', - module: require('../examples/PointerEvents/PointerEventsExample'), - }, - { - key: 'RTLExample', - category: 'Basic', - module: require('../examples/RTL/RTLExample'), - }, - { - key: 'ShareExample', - category: 'Basic', - module: require('../examples/Share/ShareExample'), - }, - { - key: 'TimerExample', - category: 'UI', - module: require('../examples/Timer/TimerExample'), - }, - { - key: 'ToastAndroidExample', - category: 'Android', - module: require('../examples/ToastAndroid/ToastAndroidExample'), - }, - { - key: 'TransformExample', - category: 'UI', - module: require('../examples/Transform/TransformExample'), - }, - { - key: 'FilterExample', - category: 'UI', - module: require('../examples/Filter/FilterExample'), - }, - { - key: 'LinearGradientExample', - category: 'UI', - module: require('../examples/LinearGradient/LinearGradientExample'), - }, - { - key: 'RadialGradientExample', - category: 'UI', - module: require('../examples/RadialGradient/RadialGradientExample'), - }, - { - key: 'BackgroundImageExample', - category: 'UI', - module: require('../examples/BackgroundImage/BackgroundImageExample'), - }, - { - key: 'MixBlendModeExample', - category: 'UI', - module: require('../examples/MixBlendMode/MixBlendModeExample'), - }, - { - key: 'VibrationExample', - category: 'Basic', - module: require('../examples/Vibration/VibrationExample'), - }, - { - key: 'WebSocketExample', - category: 'Basic', - module: require('../examples/WebSocket/WebSocketExample'), - }, - { - key: 'XHRExample', - category: 'Basic', - module: require('../examples/XHR/XHRExample'), - }, - { - key: 'TurboModuleExample', - category: 'Basic', - module: require('../examples/TurboModule/TurboModuleExample'), - }, - { - key: 'LegacyModuleExample', - module: require('../examples/TurboModule/LegacyModuleExample'), - }, - { - key: 'TurboCxxModuleExample', - category: 'Basic', - module: require('../examples/TurboModule/TurboCxxModuleExample'), - }, - // Basic check to detect the availability of the IntersectionObserver API. - // $FlowExpectedError[cannot-resolve-name] - ...(typeof IntersectionObserver === 'function' - ? [ - { - key: 'IntersectionObserver', - category: 'UI', - module: require('../examples/IntersectionObserver/IntersectionObserverIndex'), - }, - ] - : []), - // Basic check to detect the availability of the modern Performance API. - ...(typeof performance.getEntries === 'function' - ? [ - { - key: 'PerformanceApiExample', - category: 'Basic', - module: require('../examples/Performance/PerformanceApiExample'), - }, - ] - : []), - ...RNTesterListFbInternal.APIs, -]: Array).filter(Boolean); +const APIs: Array = ( + [ + { + key: 'AccessibilityExample', + category: 'Basic', + module: require('../examples/Accessibility/AccessibilityExample'), + }, + { + key: 'AccessibilityAndroidExample', + category: 'Android', + module: require('../examples/Accessibility/AccessibilityAndroidExample'), + }, + { + key: 'AlertExample', + category: 'UI', + module: require('../examples/Alert/AlertExample').default, + }, + { + key: 'AnimatedIndex', + category: 'UI', + module: require('../examples/Animated/AnimatedIndex').default, + }, + { + key: 'AnimationBackendIndex', + category: 'UI', + module: require('../examples/AnimationBackend/AnimationBackendIndex') + .default, + }, + { + key: 'Animation - GratuitousAnimation', + category: 'UI', + module: require('../examples/AnimatedGratuitousApp/AnExApp'), + }, + { + key: 'AppearanceExample', + category: 'UI', + module: require('../examples/Appearance/AppearanceExample'), + }, + { + key: 'AppStateExample', + category: 'Basic', + module: require('../examples/AppState/AppStateExample'), + }, + { + key: 'ContentURLAndroid', + category: 'Android', + module: require('../examples/ContentURLAndroid/ContentURLAndroid'), + }, + { + key: 'URLExample', + category: 'Basic', + module: require('../examples/Urls/UrlExample'), + }, + { + key: 'BorderExample', + category: 'UI', + module: require('../examples/Border/BorderExample').default, + }, + { + key: 'CrashExample', + category: 'Basic', + module: require('../examples/Crash/CrashExample'), + }, + { + key: 'DevSettings', + category: 'Basic', + module: require('../examples/DevSettings/DevSettingsExample'), + }, + { + key: 'Dimensions', + category: 'UI', + module: require('../examples/Dimensions/DimensionsExample'), + }, + { + key: 'DisplayContentsExample', + category: 'UI', + module: require('../examples/DisplayContents/DisplayContentsExample') + .default, + }, + { + key: 'FocusEventsExample', + module: require('../examples/FocusEventsExample/FocusEventsExample') + .default, + }, + { + key: 'InvalidPropsExample', + module: require('../examples/InvalidProps/InvalidPropsExample'), + }, + { + key: 'Keyboard', + category: 'Basic', + module: require('../examples/Keyboard/KeyboardExample').default, + }, + { + key: 'LayoutEventsExample', + category: 'UI', + module: require('../examples/Layout/LayoutEventsExample'), + }, + { + key: 'LinkingExample', + category: 'Basic', + module: require('../examples/Linking/LinkingExample'), + }, + { + key: 'LayoutAnimationExample', + category: 'UI', + module: require('../examples/Layout/LayoutAnimationExample'), + }, + { + key: 'LayoutExample', + category: 'UI', + module: require('../examples/Layout/LayoutExample'), + }, + { + key: 'NativeAnimationsExample', + category: 'UI', + module: require('../examples/NativeAnimation/NativeAnimationsExample'), + }, + { + key: 'OrientationChangeExample', + category: 'UI', + module: require('../examples/OrientationChange/OrientationChangeExample'), + }, + { + key: 'PanResponderExample', + category: 'Basic', + module: require('../examples/PanResponder/PanResponderExample'), + }, + { + key: 'PixelRatio', + category: 'UI', + module: require('../examples/PixelRatio/PixelRatioExample'), + }, + { + key: 'PermissionsExampleAndroid', + category: 'Android', + module: require('../examples/PermissionsAndroid/PermissionsExample'), + }, + { + key: 'PlatformColorExample', + category: 'UI', + module: require('../examples/PlatformColor/PlatformColorExample'), + }, + { + key: 'PointerEventsExample', + category: 'Basic', + module: require('../examples/PointerEvents/PointerEventsExample'), + }, + { + key: 'RTLExample', + category: 'Basic', + module: require('../examples/RTL/RTLExample'), + }, + { + key: 'ShareExample', + category: 'Basic', + module: require('../examples/Share/ShareExample'), + }, + { + key: 'TimerExample', + category: 'UI', + module: require('../examples/Timer/TimerExample'), + }, + { + key: 'ToastAndroidExample', + category: 'Android', + module: require('../examples/ToastAndroid/ToastAndroidExample'), + }, + { + key: 'TransformExample', + category: 'UI', + module: require('../examples/Transform/TransformExample'), + }, + { + key: 'FilterExample', + category: 'UI', + module: require('../examples/Filter/FilterExample'), + }, + { + key: 'LinearGradientExample', + category: 'UI', + module: require('../examples/LinearGradient/LinearGradientExample'), + }, + { + key: 'RadialGradientExample', + category: 'UI', + module: require('../examples/RadialGradient/RadialGradientExample'), + }, + { + key: 'BackgroundImageExample', + category: 'UI', + module: require('../examples/BackgroundImage/BackgroundImageExample'), + }, + { + key: 'MixBlendModeExample', + category: 'UI', + module: require('../examples/MixBlendMode/MixBlendModeExample'), + }, + { + key: 'VibrationExample', + category: 'Basic', + module: require('../examples/Vibration/VibrationExample'), + }, + { + key: 'WebSocketExample', + category: 'Basic', + module: require('../examples/WebSocket/WebSocketExample'), + }, + { + key: 'XHRExample', + category: 'Basic', + module: require('../examples/XHR/XHRExample'), + }, + { + key: 'TurboModuleExample', + category: 'Basic', + module: require('../examples/TurboModule/TurboModuleExample'), + }, + { + key: 'LegacyModuleExample', + module: require('../examples/TurboModule/LegacyModuleExample'), + }, + { + key: 'TurboCxxModuleExample', + category: 'Basic', + module: require('../examples/TurboModule/TurboCxxModuleExample'), + }, + // Basic check to detect the availability of the IntersectionObserver API. + // $FlowExpectedError[cannot-resolve-name] + ...(typeof IntersectionObserver === 'function' + ? [ + { + key: 'IntersectionObserver', + category: 'UI', + module: require('../examples/IntersectionObserver/IntersectionObserverIndex'), + }, + ] + : []), + // Basic check to detect the availability of the modern Performance API. + ...(typeof performance.getEntries === 'function' + ? [ + { + key: 'PerformanceApiExample', + category: 'Basic', + module: require('../examples/Performance/PerformanceApiExample'), + }, + ] + : []), + ...RNTesterListFbInternal.APIs, + ] as Array +).filter(Boolean); const Playgrounds: Array = [ { diff --git a/packages/rn-tester/js/utils/RNTesterList.ios.js b/packages/rn-tester/js/utils/RNTesterList.ios.js index afe569acd4fd..18fdc72e7df7 100644 --- a/packages/rn-tester/js/utils/RNTesterList.ios.js +++ b/packages/rn-tester/js/utils/RNTesterList.ios.js @@ -156,220 +156,222 @@ const Components: Array = [ ...RNTesterListFbInternal.Components, ]; -const APIs: Array = ([ - { - key: 'AccessibilityExample', - module: require('../examples/Accessibility/AccessibilityExample'), - }, - { - key: 'AccessibilityIOSExample', - module: require('../examples/Accessibility/AccessibilityIOSExample'), - category: 'iOS', - }, - { - key: 'ActionSheetIOSExample', - module: require('../examples/ActionSheetIOS/ActionSheetIOSExample'), - category: 'iOS', - }, - { - key: 'AlertExample', - module: require('../examples/Alert/AlertExample').default, - category: 'UI', - }, - { - key: 'AnimatedIndex', - module: require('../examples/Animated/AnimatedIndex').default, - }, - { - key: 'AnimationBackendIndex', - module: require('../examples/AnimationBackend/AnimationBackendIndex') - .default, - }, - { - key: 'AnExApp', - module: require('../examples/AnimatedGratuitousApp/AnExApp'), - }, - { - key: 'AppearanceExample', - module: require('../examples/Appearance/AppearanceExample'), - }, - { - key: 'AppStateExample', - module: require('../examples/AppState/AppStateExample'), - }, - { - key: 'URLExample', - category: 'Basic', - module: require('../examples/Urls/UrlExample'), - }, - { - key: 'BorderExample', - module: require('../examples/Border/BorderExample').default, - }, - { - key: 'BoxShadowExample', - module: require('../examples/BoxShadow/BoxShadowExample'), - }, - { - key: 'CrashExample', - module: require('../examples/Crash/CrashExample'), - }, - { - key: 'CursorExample', - module: require('../examples/Cursor/CursorExample'), - }, - { - key: 'DevSettings', - module: require('../examples/DevSettings/DevSettingsExample'), - }, - { - key: 'Dimensions', - module: require('../examples/Dimensions/DimensionsExample'), - }, - { - key: 'DisplayContentsExample', - category: 'UI', - module: require('../examples/DisplayContents/DisplayContentsExample') - .default, - }, - { - key: 'InvalidPropsExample', - module: require('../examples/InvalidProps/InvalidPropsExample'), - }, - { - key: 'Keyboard', - module: require('../examples/Keyboard/KeyboardExample').default, - }, - { - key: 'LayoutAnimationExample', - module: require('../examples/Layout/LayoutAnimationExample'), - }, - { - key: 'LayoutExample', - module: require('../examples/Layout/LayoutExample'), - }, - { - key: 'LinkingExample', - module: require('../examples/Linking/LinkingExample'), - }, - { - key: 'NativeAnimationsExample', - module: require('../examples/NativeAnimation/NativeAnimationsExample'), - }, - { - key: 'OrientationChangeExample', - module: require('../examples/OrientationChange/OrientationChangeExample'), - }, - { - key: 'PanResponderExample', - module: require('../examples/PanResponder/PanResponderExample'), - }, - { - key: 'PlatformColorExample', - module: require('../examples/PlatformColor/PlatformColorExample'), - }, - { - key: 'PixelRatio', - module: require('../examples/PixelRatio/PixelRatioExample'), - }, - { - key: 'PointerEventsExample', - module: require('../examples/PointerEvents/PointerEventsExample'), - }, - { - key: 'RCTRootViewIOSExample', - module: require('../examples/RCTRootView/RCTRootViewIOSExample'), - }, - { - key: 'RTLExample', - module: require('../examples/RTL/RTLExample'), - }, - { - key: 'ShareExample', - module: require('../examples/Share/ShareExample'), - }, - { - key: 'SnapshotExample', - module: require('../examples/Snapshot/SnapshotExample'), - }, - { - key: 'TimerExample', - module: require('../examples/Timer/TimerExample'), - }, - { - key: 'TransformExample', - module: require('../examples/Transform/TransformExample'), - }, - { - key: 'FilterExample', - module: require('../examples/Filter/FilterExample'), - }, - { - key: 'LinearGradientExample', - category: 'UI', - module: require('../examples/LinearGradient/LinearGradientExample'), - }, - { - key: 'RadialGradientExample', - category: 'UI', - module: require('../examples/RadialGradient/RadialGradientExample'), - }, - { - key: 'BackgroundImageExample', - category: 'UI', - module: require('../examples/BackgroundImage/BackgroundImageExample'), - }, - { - key: 'MixBlendModeExample', - module: require('../examples/MixBlendMode/MixBlendModeExample'), - }, - { - key: 'TurboModuleExample', - module: require('../examples/TurboModule/TurboModuleExample'), - }, - { - key: 'LegacyModuleExample', - module: require('../examples/TurboModule/LegacyModuleExample'), - }, - { - key: 'TurboCxxModuleExample', - module: require('../examples/TurboModule/TurboCxxModuleExample'), - }, - { - key: 'VibrationExample', - module: require('../examples/Vibration/VibrationExample'), - }, - { - key: 'WebSocketExample', - module: require('../examples/WebSocket/WebSocketExample'), - }, - { - key: 'XHRExample', - module: require('../examples/XHR/XHRExample'), - }, - // Basic check to detect the availability of the IntersectionObserver API. - // $FlowExpectedError[cannot-resolve-name] - ...(typeof IntersectionObserver === 'function' - ? [ - { - key: 'IntersectionObserver', - category: 'UI', - module: require('../examples/IntersectionObserver/IntersectionObserverIndex'), - }, - ] - : []), - // Basic check to detect the availability of the modern Performance API. - ...(typeof performance.getEntries === 'function' - ? [ - { - key: 'PerformanceApiExample', - category: 'Basic', - module: require('../examples/Performance/PerformanceApiExample'), - }, - ] - : []), - ...RNTesterListFbInternal.APIs, -]: Array).filter(Boolean); +const APIs: Array = ( + [ + { + key: 'AccessibilityExample', + module: require('../examples/Accessibility/AccessibilityExample'), + }, + { + key: 'AccessibilityIOSExample', + module: require('../examples/Accessibility/AccessibilityIOSExample'), + category: 'iOS', + }, + { + key: 'ActionSheetIOSExample', + module: require('../examples/ActionSheetIOS/ActionSheetIOSExample'), + category: 'iOS', + }, + { + key: 'AlertExample', + module: require('../examples/Alert/AlertExample').default, + category: 'UI', + }, + { + key: 'AnimatedIndex', + module: require('../examples/Animated/AnimatedIndex').default, + }, + { + key: 'AnimationBackendIndex', + module: require('../examples/AnimationBackend/AnimationBackendIndex') + .default, + }, + { + key: 'AnExApp', + module: require('../examples/AnimatedGratuitousApp/AnExApp'), + }, + { + key: 'AppearanceExample', + module: require('../examples/Appearance/AppearanceExample'), + }, + { + key: 'AppStateExample', + module: require('../examples/AppState/AppStateExample'), + }, + { + key: 'URLExample', + category: 'Basic', + module: require('../examples/Urls/UrlExample'), + }, + { + key: 'BorderExample', + module: require('../examples/Border/BorderExample').default, + }, + { + key: 'BoxShadowExample', + module: require('../examples/BoxShadow/BoxShadowExample'), + }, + { + key: 'CrashExample', + module: require('../examples/Crash/CrashExample'), + }, + { + key: 'CursorExample', + module: require('../examples/Cursor/CursorExample'), + }, + { + key: 'DevSettings', + module: require('../examples/DevSettings/DevSettingsExample'), + }, + { + key: 'Dimensions', + module: require('../examples/Dimensions/DimensionsExample'), + }, + { + key: 'DisplayContentsExample', + category: 'UI', + module: require('../examples/DisplayContents/DisplayContentsExample') + .default, + }, + { + key: 'InvalidPropsExample', + module: require('../examples/InvalidProps/InvalidPropsExample'), + }, + { + key: 'Keyboard', + module: require('../examples/Keyboard/KeyboardExample').default, + }, + { + key: 'LayoutAnimationExample', + module: require('../examples/Layout/LayoutAnimationExample'), + }, + { + key: 'LayoutExample', + module: require('../examples/Layout/LayoutExample'), + }, + { + key: 'LinkingExample', + module: require('../examples/Linking/LinkingExample'), + }, + { + key: 'NativeAnimationsExample', + module: require('../examples/NativeAnimation/NativeAnimationsExample'), + }, + { + key: 'OrientationChangeExample', + module: require('../examples/OrientationChange/OrientationChangeExample'), + }, + { + key: 'PanResponderExample', + module: require('../examples/PanResponder/PanResponderExample'), + }, + { + key: 'PlatformColorExample', + module: require('../examples/PlatformColor/PlatformColorExample'), + }, + { + key: 'PixelRatio', + module: require('../examples/PixelRatio/PixelRatioExample'), + }, + { + key: 'PointerEventsExample', + module: require('../examples/PointerEvents/PointerEventsExample'), + }, + { + key: 'RCTRootViewIOSExample', + module: require('../examples/RCTRootView/RCTRootViewIOSExample'), + }, + { + key: 'RTLExample', + module: require('../examples/RTL/RTLExample'), + }, + { + key: 'ShareExample', + module: require('../examples/Share/ShareExample'), + }, + { + key: 'SnapshotExample', + module: require('../examples/Snapshot/SnapshotExample'), + }, + { + key: 'TimerExample', + module: require('../examples/Timer/TimerExample'), + }, + { + key: 'TransformExample', + module: require('../examples/Transform/TransformExample'), + }, + { + key: 'FilterExample', + module: require('../examples/Filter/FilterExample'), + }, + { + key: 'LinearGradientExample', + category: 'UI', + module: require('../examples/LinearGradient/LinearGradientExample'), + }, + { + key: 'RadialGradientExample', + category: 'UI', + module: require('../examples/RadialGradient/RadialGradientExample'), + }, + { + key: 'BackgroundImageExample', + category: 'UI', + module: require('../examples/BackgroundImage/BackgroundImageExample'), + }, + { + key: 'MixBlendModeExample', + module: require('../examples/MixBlendMode/MixBlendModeExample'), + }, + { + key: 'TurboModuleExample', + module: require('../examples/TurboModule/TurboModuleExample'), + }, + { + key: 'LegacyModuleExample', + module: require('../examples/TurboModule/LegacyModuleExample'), + }, + { + key: 'TurboCxxModuleExample', + module: require('../examples/TurboModule/TurboCxxModuleExample'), + }, + { + key: 'VibrationExample', + module: require('../examples/Vibration/VibrationExample'), + }, + { + key: 'WebSocketExample', + module: require('../examples/WebSocket/WebSocketExample'), + }, + { + key: 'XHRExample', + module: require('../examples/XHR/XHRExample'), + }, + // Basic check to detect the availability of the IntersectionObserver API. + // $FlowExpectedError[cannot-resolve-name] + ...(typeof IntersectionObserver === 'function' + ? [ + { + key: 'IntersectionObserver', + category: 'UI', + module: require('../examples/IntersectionObserver/IntersectionObserverIndex'), + }, + ] + : []), + // Basic check to detect the availability of the modern Performance API. + ...(typeof performance.getEntries === 'function' + ? [ + { + key: 'PerformanceApiExample', + category: 'Basic', + module: require('../examples/Performance/PerformanceApiExample'), + }, + ] + : []), + ...RNTesterListFbInternal.APIs, + ] as Array +).filter(Boolean); const Playgrounds: Array = [ { diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index 7a48d91be4d0..df53cc7ddb78 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -971,15 +971,15 @@ class VirtualizedList extends StateSafePureComponent< // 2a. Add a cell for ListEmptyComponent if applicable const itemCount = this.props.getItemCount(data); if (itemCount === 0 && ListEmptyComponent) { - const element: ExactReactElement_DEPRECATED = ((isValidElement( - ListEmptyComponent, - ) ? ( - ListEmptyComponent - ) : ( - // $FlowFixMe[not-a-component] - // $FlowFixMe[incompatible-type] - - )): any); + const element: ExactReactElement_DEPRECATED = ( + isValidElement(ListEmptyComponent) ? ( + ListEmptyComponent + ) : ( + // $FlowFixMe[not-a-component] + // $FlowFixMe[incompatible-type] + + ) + ) as any; cells.push( ) + ? ([] as Array) : undefined; let itemCount = 0; @@ -615,7 +615,7 @@ function ItemWithSeparator( highlighted={leadingSeparatorHiglighted} {...leadingSeparatorProps} /> - )): any); + )) as any); const separator = SeparatorComponent != null && ((React.isValidElement(SeparatorComponent) ? ( @@ -627,7 +627,7 @@ function ItemWithSeparator( highlighted={separatorHighlighted} {...separatorProps} /> - )): any); + )) as any); const RenderSeparator = leadingSeparator || separator; const firstSeparator = inverted === false ? leadingSeparator : separator; const secondSeparator = inverted === false ? separator : leadingSeparator;