diff --git a/packages/debugger-shell/src/electron/SettingsStore.js b/packages/debugger-shell/src/electron/SettingsStore.js index 1b2af48f6499..a6c283151ff4 100644 --- a/packages/debugger-shell/src/electron/SettingsStore.js +++ b/packages/debugger-shell/src/electron/SettingsStore.js @@ -9,7 +9,6 @@ * @oncall react_native */ -// $FlowFixMe[unclear-type] We have no Flow types for the Electron API. const {app} = require('electron') as any; const fs = require('node:fs'); const path = require('node:path'); diff --git a/packages/dev-middleware/src/__tests__/FetchUtils.js b/packages/dev-middleware/src/__tests__/FetchUtils.js index 226e2a79201d..78ddfe01d54b 100644 --- a/packages/dev-middleware/src/__tests__/FetchUtils.js +++ b/packages/dev-middleware/src/__tests__/FetchUtils.js @@ -79,7 +79,6 @@ export function withFetchSelfSignedCertsForAllTests( // For some reason, setting the `selfSignedCertDispatcher` with `setGlobalDispatcher` doesn't work. // Instead of using `setGlobalDispatcher`, we'll use a spy to intercept the fetch calls and add the dispatcher. fetchSpy.mockImplementation((url, options) => - // $FlowFixMe[cannot-spread-interface] fetchOriginal(url, { ...options, // $FlowFixMe[prop-missing]: dispatcher diff --git a/packages/dev-middleware/src/__tests__/InspectorDebuggerUtils.js b/packages/dev-middleware/src/__tests__/InspectorDebuggerUtils.js index ea2683b4c1ee..54c317253871 100644 --- a/packages/dev-middleware/src/__tests__/InspectorDebuggerUtils.js +++ b/packages/dev-middleware/src/__tests__/InspectorDebuggerUtils.js @@ -111,7 +111,6 @@ export class DebuggerMock extends DebuggerAgent { : this.handle.mock.calls; // $FlowFixMe[incompatible-use] // $FlowFixMe[prop-missing] - // $FlowFixMe[incompatible-type] const [response] = newHandleCalls.find(args => args[0].id === message.id); // $FlowFixMe[incompatible-type] // $FlowFixMe[incompatible-indexer] diff --git a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js index a55157433f37..bcf0b94d44b4 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js +++ b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js @@ -68,7 +68,6 @@ export async function sendFromTargetToDebugger< : debugger_.handle.mock.calls; // $FlowFixMe[incompatible-type] const [receivedMessage]: [Message] = newHandleCalls.find( - // $FlowFixMe[incompatible-type] (call: [Message]) => call[0].method === message.method, ); return receivedMessage; diff --git a/packages/dev-middleware/src/inspector-proxy/Device.js b/packages/dev-middleware/src/inspector-proxy/Device.js index dd18bfccc57b..0ea5ef97e1f8 100644 --- a/packages/dev-middleware/src/inspector-proxy/Device.js +++ b/packages/dev-middleware/src/inspector-proxy/Device.js @@ -500,7 +500,6 @@ export default class Device { }); const cdpDebugLogging = this.#cdpDebugLogging; - // $FlowFixMe[method-unbinding] const sendFunc = socket.send; // $FlowFixMe[cannot-write] socket.send = function (message: string) { @@ -1156,7 +1155,6 @@ export default class Device { // Fetch text, raising an exception if the text could not be fetched, // or is too large. async #fetchText(url: URL): Promise { - // $FlowFixMe[incompatible-call] Suppress arvr node-fetch flow error const response = await fetch(url); if (!response.ok) { throw new Error('HTTP ' + response.status + ' ' + response.statusText); diff --git a/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js b/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js index ac1f0263989f..b3aa7692e8e1 100644 --- a/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js +++ b/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js @@ -8,7 +8,6 @@ * @format */ -// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS import type {DebuggerSessionIDs} from '../types/EventReporter'; import {monitorEventLoopDelay, performance} from 'node:perf_hooks'; diff --git a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js index ecccdfd7f2c4..ff144cdd544c 100644 --- a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js +++ b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js @@ -333,7 +333,6 @@ export default class InspectorProxy implements InspectorProxyQueries { // well-behaved and the debugger is prepared to handle large messages. maxPayload: 0, }); - // $FlowFixMe[value-as-type] wss.on('connection', async (socket: WS, req) => { const wssTimestamp = Date.now(); @@ -492,7 +491,6 @@ export default class InspectorProxy implements InspectorProxyQueries { // well-behaved and the device is prepared to handle large messages. maxPayload: 0, // Verify the client is from an allowed origin. - // $FlowFixMe[incompatible-type] - `ws` definition is incomplete. verifyClient: ( info: Readonly<{ origin: string, @@ -522,7 +520,6 @@ export default class InspectorProxy implements InspectorProxyQueries { }, }); - // $FlowFixMe[value-as-type] wss.on('connection', async (socket: WS, req) => { const wssTimestamp = Date.now(); diff --git a/packages/jest-preset/jest/mockComponent.js b/packages/jest-preset/jest/mockComponent.js index 3b222ff0196f..4da5ebf99144 100644 --- a/packages/jest-preset/jest/mockComponent.js +++ b/packages/jest-preset/jest/mockComponent.js @@ -27,7 +27,7 @@ export default function mockComponent< moduleName: string, instanceMethods: ?interface {}, isESModule: TIsESModule, -): TIsESModule extends true // $FlowFixMe[incompatible-use] +): TIsESModule extends true ? ModuleDefault : TComponentModule & typeof instanceMethods { const RealComponent: TComponentType = isESModule diff --git a/packages/jest-preset/jest/setup.js b/packages/jest-preset/jest/setup.js index b6e48be6f8e4..884fc60272f5 100644 --- a/packages/jest-preset/jest/setup.js +++ b/packages/jest-preset/jest/setup.js @@ -43,8 +43,6 @@ Object.defineProperties(global, { configurable: true, enumerable: true, value: { - // $FlowFixMe[method-unbinding] - // $FlowFixMe[incompatible-type] now: jest.fn(Date.now), }, writable: true, @@ -177,7 +175,6 @@ mock( mock( // $FlowFixMe[cannot-resolve-module] 'm#react-native/Libraries/ReactNative/RendererProxy', - // $FlowFixMe[incompatible-type] - `./mocks/RendererProxy` is incomplete. 'm#./mocks/RendererProxy', ); mock( diff --git a/packages/polyfills/__tests__/consoleTable-itest.js b/packages/polyfills/__tests__/consoleTable-itest.js index d808eba8a62b..4580b0735587 100644 --- a/packages/polyfills/__tests__/consoleTable-itest.js +++ b/packages/polyfills/__tests__/consoleTable-itest.js @@ -233,7 +233,6 @@ describe('console.table(data, rows)', () => { {third: 7, fourth: 8}, {fifth: 9}, ], - // $FlowExpectedError[extra-arg] ['first', 'fifth'], ); expect(logFn).toHaveBeenCalledTimes(1); @@ -257,7 +256,6 @@ describe('console.table(data, rows)', () => { c: {third: 7, fourth: 8}, d: {fifth: 9}, }, - // $FlowExpectedError[extra-arg] ['first', 'fifth'], ); expect(logFn).toHaveBeenCalledTimes(1); diff --git a/packages/polyfills/__tests__/consoleTimeStamp-itest.js b/packages/polyfills/__tests__/consoleTimeStamp-itest.js index 713ee72eb5e8..89b517a9f7ac 100644 --- a/packages/polyfills/__tests__/consoleTimeStamp-itest.js +++ b/packages/polyfills/__tests__/consoleTimeStamp-itest.js @@ -16,7 +16,6 @@ describe('console.timeStamp()', () => { }); it("doesn't throw when label is not specified", () => { - // $FlowExpectedError[incompatible-call] not passing label intentionally expect(() => console.timeStamp()).not.toThrow(); }); diff --git a/packages/react-native-babel-preset/src/__tests__/__fixtures__/kitchen-sink-input.js b/packages/react-native-babel-preset/src/__tests__/__fixtures__/kitchen-sink-input.js index c87fd6c1ae7d..aacc86fef43f 100644 --- a/packages/react-native-babel-preset/src/__tests__/__fixtures__/kitchen-sink-input.js +++ b/packages/react-native-babel-preset/src/__tests__/__fixtures__/kitchen-sink-input.js @@ -128,7 +128,6 @@ function mergeConfigs( base: T, ...overrides: ReadonlyArray> ): T { - // $FlowExpectedError[incompatible-return] - Testing spread syntax // $FlowExpectedError[incompatible-type] - Testing spread syntax return {...base, ...overrides.reduce((acc, o) => ({...acc, ...o}), {})}; } diff --git a/packages/react-native-babel-transformer/src/index.js b/packages/react-native-babel-transformer/src/index.js index 00a626926757..1d42cc894d9f 100644 --- a/packages/react-native-babel-transformer/src/index.js +++ b/packages/react-native-babel-transformer/src/index.js @@ -100,7 +100,6 @@ const getBabelRC = (function () { // If a babel config file doesn't exist in the project then // the default preset for react-native will be used instead. // $FlowFixMe[incompatible-use] `extends` is missing in null or undefined. - // $FlowFixMe[incompatible-type] `extends` is missing in null or undefined. if (!babelRC.extends) { const { babelRuntimeModuleName, diff --git a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js index ebe1d2674f69..075b80c6586f 100644 --- a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js +++ b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js @@ -233,9 +233,7 @@ function getLocalImports( const objectImports = getImports(objectProps); // $FlowFixMe[incompatible-type] the type is guaranteed to be ObjectTypeAnnotation const localImports = getLocalImports(objectProps); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters objectImports.forEach(imports.add, imports); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters localImports.forEach(imports.add, imports); } @@ -243,9 +241,7 @@ function getLocalImports( imports.add('#include '); const objectImports = getImports(typeAnnotation.properties); const localImports = getLocalImports(typeAnnotation.properties); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters objectImports.forEach(imports.add, imports); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters localImports.forEach(imports.add, imports); } }); diff --git a/packages/react-native-codegen/src/generators/components/CppHelpers.js b/packages/react-native-codegen/src/generators/components/CppHelpers.js index aa352c4b56f4..af95ab35d368 100644 --- a/packages/react-native-codegen/src/generators/components/CppHelpers.js +++ b/packages/react-native-codegen/src/generators/components/CppHelpers.js @@ -162,7 +162,6 @@ function getImports( if (typeAnnotation.type === 'ObjectTypeAnnotation') { const objectImports = getImports(typeAnnotation.properties); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters objectImports.forEach(imports.add, imports); } }); diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index 6aeadb5a6e03..a3d2e2d4fc11 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -366,7 +366,6 @@ module.exports = { const argIncludes = getImports( event.typeAnnotation.argument.properties, ); - // $FlowFixMe[method-unbinding] argIncludes.forEach(extraIncludes.add, extraIncludes); } }); diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js index e5a745a9bc66..10be5d254755 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js @@ -356,7 +356,6 @@ module.exports = { ); const imports = getImports(component.props); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters imports.forEach(allImports.add, allImports); const replacedTemplate = ComponentTemplate({ diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index 986be0f4335e..0729cdd04bdc 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -893,9 +893,7 @@ module.exports = { const extendsImports = getExtendsImports(component.extendsProps); const imports = getLocalImports(component.props); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters extendsImports.forEach(allImports.add, allImports); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters imports.forEach(allImports.add, allImports); const replacedTemplate = ClassTemplate({ diff --git a/packages/react-native-codegen/src/generators/components/GenerateTests.js b/packages/react-native-codegen/src/generators/components/GenerateTests.js index 4779e0695c2e..85343585ef40 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateTests.js +++ b/packages/react-native-codegen/src/generators/components/GenerateTests.js @@ -104,7 +104,6 @@ function getTestCasesForProp( propName: propName, propValue: typeAnnotation.default != null ? typeAnnotation.default : true, }); - // $FlowFixMe[incompatible-type] /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition * roll out. See https://fburl.com/workplace/4oq3zi07. */ } else if (typeAnnotation.type === 'IntegerTypeAnnotation') { @@ -196,7 +195,6 @@ module.exports = { const name = `${componentName}Props`; const imports = getImports(component.props); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters imports.forEach(allImports.add, allImports); return generateTestsString(name, component); diff --git a/packages/react-native-codegen/src/parsers/flow/components/events.js b/packages/react-native-codegen/src/parsers/flow/components/events.js index 20e725c08ef8..0a31c9fb0212 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/events.js +++ b/packages/react-native-codegen/src/parsers/flow/components/events.js @@ -42,8 +42,6 @@ const { const {getTypeArguments} = require('../../utils'); function getPropertyType( - /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's - * LTI update could not be added via codemod */ name: string, optional: boolean, typeAnnotation: $FlowFixMe, diff --git a/packages/react-native-codegen/src/parsers/flow/components/index.js b/packages/react-native-codegen/src/parsers/flow/components/index.js index cd6c9515393e..5733bcc9f3ce 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/index.js +++ b/packages/react-native-codegen/src/parsers/flow/components/index.js @@ -20,7 +20,6 @@ const { const {getCommands} = require('./commands'); const {getEvents} = require('./events'); -// $FlowFixMe[signature-verification-failure] there's no flowtype for AST function buildComponentSchema( ast: $FlowFixMe, parser: Parser, diff --git a/packages/react-native-codegen/src/parsers/parsers-commons.js b/packages/react-native-codegen/src/parsers/parsers-commons.js index 583c30ec8f38..f1c20648f8f6 100644 --- a/packages/react-native-codegen/src/parsers/parsers-commons.js +++ b/packages/react-native-codegen/src/parsers/parsers-commons.js @@ -1131,8 +1131,6 @@ function buildPropSchema( }; } -/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's - * LTI update could not be added via codemod */ function getEventArgument( argumentProps: PropAST, parser: Parser, diff --git a/packages/react-native-codegen/src/parsers/parsers-primitives.js b/packages/react-native-codegen/src/parsers/parsers-primitives.js index 91dfc1b1b8fb..197d5cf8c983 100644 --- a/packages/react-native-codegen/src/parsers/parsers-primitives.js +++ b/packages/react-native-codegen/src/parsers/parsers-primitives.js @@ -537,7 +537,6 @@ function translateArrayTypeAnnotation( return wrapNullable(nullable, { type: 'ArrayTypeAnnotation', - // $FlowFixMe[incompatible-type] elementType: wrapNullable(isElementTypeNullable, _elementType), }); } catch (ex) { diff --git a/packages/react-native-codegen/src/parsers/typescript/components/index.js b/packages/react-native-codegen/src/parsers/typescript/components/index.js index 1aade8600852..ea26af67db43 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/index.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/index.js @@ -21,10 +21,8 @@ const {getCommands} = require('./commands'); const {getEvents} = require('./events'); const {categorizeProps} = require('./extends'); -// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser type PropsAST = Object; -// $FlowFixMe[signature-verification-failure] TODO(T108222691): Use flow-types for @babel/parser function buildComponentSchema( ast: $FlowFixMe, parser: Parser, diff --git a/packages/react-native-codegen/src/parsers/typescript/parser.js b/packages/react-native-codegen/src/parsers/typescript/parser.js index b95ab27c933b..a2f373cb08af 100644 --- a/packages/react-native-codegen/src/parsers/typescript/parser.js +++ b/packages/react-native-codegen/src/parsers/typescript/parser.js @@ -57,7 +57,6 @@ const { } = require('./components/componentsUtils'); const {typeScriptTranslateTypeAnnotation} = require('./modules'); const {parseTopLevelType} = require('./parseTopLevelType'); -// $FlowFixMe[untyped-import] Use flow-types for @babel/parser const babelParser = require('@babel/parser'); const invariant = require('invariant'); const fs = require('node:fs'); diff --git a/packages/react-native-compatibility-check/src/TypeDiffing.js b/packages/react-native-compatibility-check/src/TypeDiffing.js index 090f2a716b8e..65c257794087 100644 --- a/packages/react-native-compatibility-check/src/TypeDiffing.js +++ b/packages/react-native-compatibility-check/src/TypeDiffing.js @@ -1430,7 +1430,6 @@ function compareArrayTypesOutOfOrder( potentiallyRemovedElements, // I'm not sure how I should fix this FlowFixMe. It returns `undefined` // and has existed since the day it was written. Fixing it might break things. - // $FlowFixMe[method-unbinding] added when improving typing for this parameters nestedChanges.concat[[oldTypePosn, newTypePosn, currentResult]], ); case 'error': diff --git a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js index bac068ea8053..2929a71cb7ec 100644 --- a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -49,7 +49,6 @@ export type ShareActionSheetIOSOptions = Readonly<{ export type ShareActionSheetError = Readonly<{ domain: string, code: string, - // $FlowFixMe[unclear-type] userInfo?: ?Object, message: string, }>; @@ -127,11 +126,8 @@ const ActionSheetIOS = { RCTActionSheetManager.showActionSheetWithOptions( { ...remainingOptions, - // $FlowFixMe[incompatible-type] tintColor: processedTintColor, - // $FlowFixMe[incompatible-type] cancelButtonTintColor: processedCancelButtonTintColor, - // $FlowFixMe[incompatible-type] disabledButtonTintColor: processedDisabledButtonTintColor, destructiveButtonIndices, }, @@ -156,9 +152,7 @@ const ActionSheetIOS = { */ showShareActionSheetWithOptions( options: ShareActionSheetIOSOptions, - // $FlowFixMe[unclear-type] failureCallback: Function | ((error: ShareActionSheetError) => void), - // $FlowFixMe[unclear-type] successCallback: Function | ((success: boolean, method: ?string) => void), ) { invariant( diff --git a/packages/react-native/Libraries/Animated/AnimatedEvent.js b/packages/react-native/Libraries/Animated/AnimatedEvent.js index 40fb89ad6a6f..3c57616bbbfb 100644 --- a/packages/react-native/Libraries/Animated/AnimatedEvent.js +++ b/packages/react-native/Libraries/Animated/AnimatedEvent.js @@ -180,12 +180,10 @@ export class AnimatedEvent { this.__platformConfig = resolvedConfig.platformConfig; } - // $FlowFixMe[unclear-type] __addListener(callback: Function): void { this._listeners.push(callback); } - // $FlowFixMe[unclear-type] __removeListener(callback: Function): void { this._listeners = this._listeners.filter(listener => listener !== callback); } @@ -257,9 +255,6 @@ export class AnimatedEvent { } } else if (typeof recMapping === 'object') { for (const mappingKey in recMapping) { - /* $FlowFixMe[prop-missing] (>=0.120.0) This comment suppresses an - * error found when Flow v0.120 was deployed. To see the error, - * delete this comment and run Flow. */ traverse(recMapping[mappingKey], recEvt[mappingKey]); } } diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js index 58ad5b5b64f4..c33341ce5e80 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js @@ -959,7 +959,6 @@ test('useNativeDriver: JS-side _value is synced before the completion callback f if (finished) { // $FlowFixMe[prop-missing] _value is internal but stable for testing. _valueInCallback = _value._value; - // $FlowFixMe[prop-missing] _interpolationInCallback = _value .interpolate({inputRange: [0, 1], outputRange: [0.5, 1]}) .__getValue(); diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js index 422f1ff7d453..c60dbcbb3fee 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js @@ -275,7 +275,6 @@ describe('Animated', () => { expect(console.warn).toBeCalledWith( 'Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`', ); - // $FlowFixMe[prop-missing] console.warn.mockRestore(); }); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js index ae6d0bedeeb7..6557decb7083 100644 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js @@ -28,11 +28,9 @@ describe('AnimatedValue', () => { original.apply(NativeAnimatedHelper.API, args), ); // $FlowFixMe[prop-missing] - // $FlowFixMe[cannot-write] NativeAnimatedHelper.API[name] = spy; restoreAPI.push(() => { // $FlowFixMe[prop-missing] - // $FlowFixMe[cannot-write] NativeAnimatedHelper.API[name] = original; }); return spy; @@ -234,7 +232,6 @@ describe('AnimatedValue', () => { emitMockUpdate(node, 123, 50); - // $FlowFixMe[method-unbinding] const original = node.__onAnimatedValueUpdateReceived; const spy = jest.fn((...args: Array) => /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing diff --git a/packages/react-native/Libraries/Animated/__tests__/Interpolation-itest.js b/packages/react-native/Libraries/Animated/__tests__/Interpolation-itest.js index 615ab8a477c9..3fd46e7ae6c4 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Interpolation-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/Interpolation-itest.js @@ -259,11 +259,8 @@ describe('Interpolation', () => { outputRange: ['rgba(0, 100, 200, 0)', 'rgba(50, 150, 250, 0.4)'], }); - // $FlowFixMe[incompatible-call] expect(interpolation(0)).toBe('rgba(0, 100, 200, 0)'); - // $FlowFixMe[incompatible-call] expect(interpolation(0.5)).toBe('rgba(25, 125, 225, 0.2)'); - // $FlowFixMe[incompatible-call] expect(interpolation(1)).toBe('rgba(50, 150, 250, 0.4)'); }); @@ -447,7 +444,6 @@ describe('Interpolation', () => { const config = new AnimatedInterpolation( // $FlowFixMe[incompatible-type] {}, - // $FlowFixMe[incompatible-call] {inputRange: [0, 1], outputRange}, ).__getNativeConfig(); expect(config.outputRange).toEqual(expected); diff --git a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js index 4d33b7fe35ac..3fa95a750f48 100644 --- a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js @@ -109,7 +109,6 @@ export default class DecayAnimation extends Animation { this._lastValue = value; if (this.__active) { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters // $FlowFixMe[invalid-tuple-arity] this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } diff --git a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js index c27e50f42e8a..d9227ac30bc1 100644 --- a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js @@ -360,7 +360,6 @@ export default class SpringAnimation extends Animation { this.__notifyAnimationEnd({finished: true}); return; } - // $FlowFixMe[method-unbinding] added when improving typing for this parameters // $FlowFixMe[invalid-tuple-arity] this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } diff --git a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js index f5a5eb142de5..8da914a3d1e9 100644 --- a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js @@ -170,7 +170,6 @@ export default class TimingAnimation extends Animation { (this._toValue - this._fromValue), ); if (this.__active) { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters // $FlowFixMe[invalid-tuple-arity] this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this)); } diff --git a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js index 1607ebf96b34..4e0f09a3d3bb 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js @@ -81,15 +81,12 @@ const AnimatedScrollViewWithInvertedRefreshControl = }: { ref?: React.RefSetter, ...React.ComponentProps, - // $FlowFixMe[unclear-type] Same Flow type as `refreshControl` in ScrollView refreshControl: React.MixedElement, }) { // Split `props` into the animate-able props for the parent (RefreshControl) // and child (ScrollView). const {intermediatePropsForRefreshControl, intermediatePropsForScrollView} = useMemo(() => { - // $FlowFixMe[underconstrained-implicit-instantiation] - // $FlowFixMe[incompatible-type] const {outer, inner} = splitLayoutProps(flattenStyle(props.style)); return { intermediatePropsForRefreshControl: {style: outer}, diff --git a/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js b/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js index 65d8accefe40..26e9ceb2f335 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js @@ -14,7 +14,6 @@ import SectionList, {type SectionListProps} from '../../Lists/SectionList'; import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; -// $FlowFixMe[incompatible-type] const AnimatedSectionList: component< // $FlowExpectedError[unclear-type] ItemT = any, diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js index e906d9c760c7..4ea70843da38 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js @@ -119,7 +119,6 @@ export function getRgbaValueAndNativeColor( nativeColor?: NativeColorValue, }> { const processedColor: RgbaValue | NativeColorValue = - // $FlowFixMe[incompatible-type] - Type is verified above processColor(value as ColorValue | RgbaValue) ?? defaultColor; if (isRgbaValue(processedColor)) { // $FlowFixMe[incompatible-type] - Type is verified above diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js index 5018430f7f7e..e2078e439542 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -254,7 +254,6 @@ function createStringInterpolation( outputRange.every(output => output.components.every( (component, i) => - // $FlowFixMe[invalid-compare] typeof component === 'number' || component === firstOutput[i], ), ), @@ -267,8 +266,7 @@ function createStringInterpolation( isColor ? // $FlowFixMe[incompatible-type] output.components - : // $FlowFixMe[incompatible-call] - output.components.filter(c => typeof c === 'number'), + : output.components.filter(c => typeof c === 'number'), ); const interpolations = numericComponents[0].map((_, i) => createNumericInterpolation({ @@ -342,11 +340,6 @@ function checkInfiniteRange< invariant(arr.length >= 2, name + ' must have at least 2 elements'); invariant( arr.length !== 2 || arr[0] !== -Infinity || arr[1] !== Infinity, - /* $FlowFixMe[incompatible-type] (>=0.13.0) - In the addition expression - * below this comment, one or both of the operands may be something that - * doesn't cleanly convert to a string, like undefined, null, and object, - * etc. If you really mean this implicit string conversion, you can do - * something like String(myThing) */ // $FlowFixMe[unsafe-addition] name + ' cannot be ]-infinity;+infinity[ ' + arr, ); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js index 6b7529c95579..2a4a83f33916 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js @@ -21,8 +21,6 @@ const MAX_DEPTH = 5; export function isPlainObject( value: unknown, - /* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype - and ReactElement checks preserve the type refinement of `value`. */ ): value is Readonly<{[key: string]: unknown}> { const proto = value !== null && typeof value === 'object' diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js index 3b58c22e97fe..604ec5fcd5ff 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js @@ -202,7 +202,6 @@ export default class AnimatedProps extends AnimatedNode { return tuples; } - // $FlowFixMe[unclear-type] __getAnimatedValue(): Object { const props: {[key: string]: unknown} = {}; @@ -366,7 +365,6 @@ export default class AnimatedProps extends AnimatedNode { } } - // $FlowFixMe[unclear-type] __getNativeConfig(): Object { const platformConfig = this.__getPlatformConfig(); const propsConfig: {[key: string]: number} = {}; @@ -391,10 +389,8 @@ export default class AnimatedProps extends AnimatedNode { // Supported versions of JSC do not implement the newer Object.hasOwn. Remove // this shim when they do. -// $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = - // $FlowFixMe[method-unbinding] /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js index 1f94c9c5d577..c30f0926e5cc 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js @@ -188,7 +188,6 @@ export default class AnimatedStyle extends AnimatedWithChildren { } } - // $FlowFixMe[unclear-type] __getAnimatedValue(): Object { const style: {[key: string]: unknown} = {}; @@ -230,7 +229,6 @@ export default class AnimatedStyle extends AnimatedWithChildren { super.__makeNative(platformConfig); } - // $FlowFixMe[unclear-type] __getNativeConfig(): Object { const platformConfig = this.__getPlatformConfig(); const styleConfig: {[key: string]: ?number} = {}; @@ -257,10 +255,8 @@ export default class AnimatedStyle extends AnimatedWithChildren { // Supported versions of JSC do not implement the newer Object.hasOwn. Remove // this shim when they do. -// $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = - // $FlowFixMe[method-unbinding] /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js b/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js index ec92542abbdb..f532a5615515 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedTransform.js @@ -97,7 +97,6 @@ export default class AnimatedTransform extends AnimatedWithChildren { __getValueWithStaticTransforms( // $FlowFixMe[unclear-type] staticTransforms: ReadonlyArray, - // $FlowFixMe[unclear-type] ): ReadonlyArray { const values = []; mapTransforms(this._transforms, node => { diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js b/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js index 2e0a0311200c..c4d848714e63 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedWithChildren.js @@ -75,7 +75,6 @@ export default class AnimatedWithChildren extends AnimatedNode { const children = this._children; for (let ii = 0, length = children.length; ii < length; ii++) { const child = children[ii]; - // $FlowFixMe[method-unbinding] added when improving typing for this parameters if (child.__getValue) { child.__callListeners(child.__getValue()); } diff --git a/packages/react-native/Libraries/AppState/AppState.js b/packages/react-native/Libraries/AppState/AppState.js index 301aa0913af5..ed59878c792d 100644 --- a/packages/react-native/Libraries/AppState/AppState.js +++ b/packages/react-native/Libraries/AppState/AppState.js @@ -104,7 +104,6 @@ class AppStateImpl { // TODO: see above - this request just populates the value of `currentState` // when the module is first initialized. Would be better to get rid of the // prop and expose `getCurrentAppState` method directly. - // $FlowExpectedError[incompatible-call] NativeAppState.getCurrentAppState(appStateData => { // It's possible that the state will have changed here & listeners need to be notified if (!eventUpdated && this.currentState !== appStateData.app_state) { @@ -131,18 +130,15 @@ class AppStateImpl { } switch (type) { case 'change': - // $FlowFixMe[invalid-tuple-arity] Flow cannot refine handler based on the event type const changeHandler: (v: AppStateStatus) => void = handler; return emitter.addListener('appStateDidChange', appStateData => { changeHandler(appStateData.app_state); }); case 'memoryWarning': - // $FlowFixMe[invalid-tuple-arity] Flow cannot refine handler based on the event type const memoryWarningHandler: () => void = handler; return emitter.addListener('memoryWarning', memoryWarningHandler); case 'blur': case 'focus': - // $FlowFixMe[invalid-tuple-arity] Flow cannot refine handler based on the event type const focusOrBlurHandler: () => void = handler; return emitter.addListener('appStateFocusChange', hasFocus => { /* $FlowFixMe[invalid-compare] Error discovered during Constant diff --git a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js index 779648732741..3c761a30a797 100644 --- a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js +++ b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js @@ -74,15 +74,12 @@ class MessageQueue { // $FlowFixMe[cannot-write] this.callFunctionReturnFlushedQueue = - // $FlowFixMe[method-unbinding] added when improving typing for this parameters this.callFunctionReturnFlushedQueue.bind(this); // $FlowFixMe[cannot-write] - // $FlowFixMe[method-unbinding] added when improving typing for this parameters this.flushedQueue = this.flushedQueue.bind(this); // $FlowFixMe[cannot-write] this.invokeCallbackAndReturnFlushedQueue = - // $FlowFixMe[method-unbinding] added when improving typing for this parameters this.invokeCallbackAndReturnFlushedQueue.bind(this); } diff --git a/packages/react-native/Libraries/BatchedBridge/NativeModules.js b/packages/react-native/Libraries/BatchedBridge/NativeModules.js index c3642fe5fa95..a70797fc990e 100644 --- a/packages/react-native/Libraries/BatchedBridge/NativeModules.js +++ b/packages/react-native/Libraries/BatchedBridge/NativeModules.js @@ -101,8 +101,6 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { if (type === 'promise') { fn = function promiseMethodWrapper(...args: Array) { // In case we reject, capture a useful stack trace here. - /* $FlowFixMe[class-object-subtyping] added when improving typing for - * this parameters */ // $FlowFixMe[incompatible-type] const enqueueingFrameError: ExtendedError = new Error(); return new Promise((resolve, reject) => { @@ -175,8 +173,6 @@ function updateErrorWithErrorData( errorData: {message: string, ...}, error: ExtendedError, ): ExtendedError { - /* $FlowFixMe[class-object-subtyping] added when improving typing for this - * parameters */ // $FlowFixMe[incompatible-type] // $FlowFixMe[unsafe-object-assign] return Object.assign(error, errorData || {}); diff --git a/packages/react-native/Libraries/Blob/URL.js b/packages/react-native/Libraries/Blob/URL.js index 8386cc6d979d..8e4239b81033 100644 --- a/packages/react-native/Libraries/Blob/URL.js +++ b/packages/react-native/Libraries/Blob/URL.js @@ -21,7 +21,6 @@ if ( typeof NativeBlobModule.getConstants().BLOB_URI_SCHEME === 'string' ) { const constants = NativeBlobModule.getConstants(); - // $FlowFixMe[incompatible-type] asserted above // $FlowFixMe[unsafe-addition] BLOB_URL_PREFIX = constants.BLOB_URI_SCHEME + ':'; if (typeof constants.BLOB_URI_HOST === 'string') { @@ -78,7 +77,6 @@ export class URL { // Do nothing. } - // $FlowFixMe[missing-local-annot] constructor(url: string, base?: string | URL) { let baseUrl = null; if (base == null || base === '' || validateBaseUrl(url)) { diff --git a/packages/react-native/Libraries/Blob/URLSearchParams.js b/packages/react-native/Libraries/Blob/URLSearchParams.js index 5d05022a769a..7eed1838fa30 100644 --- a/packages/react-native/Libraries/Blob/URLSearchParams.js +++ b/packages/react-native/Libraries/Blob/URLSearchParams.js @@ -127,7 +127,6 @@ export class URLSearchParams { ); } - // $FlowFixMe[unsupported-syntax] [Symbol.iterator](): IteratorObject<[string, string]> { const entries: [string, string][] = []; @@ -137,7 +136,6 @@ export class URLSearchParams { } } - // $FlowFixMe[incompatible-use] return entries[Symbol.iterator](); } diff --git a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js index 46eb20693635..d7b6d253a079 100644 --- a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -451,7 +451,6 @@ const AccessibilityInfo = { */ addEventListener( eventName: K, - // $FlowFixMe[incompatible-type] - Flow bug with unions and generics (T128099423) handler: (...rest: AccessibilityEventDefinitions[K]) => void, ): EventSubscription { const deviceEventName = EventNames.get(eventName); diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js index e73577e68c0b..770e688e9bed 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -158,7 +158,6 @@ const ActivityIndicator: component( onLayout={onLayout} style={StyleSheet.compose(styles.container, style)}> {Platform.OS === 'android' ? ( - // $FlowFixMe[prop-missing] Flow doesn't know when this is the android component // $FlowFixMe[incompatible-type] ) : ( diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index f1cbd0fda2b8..f61d1bb01ffd 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -287,9 +287,6 @@ const Button: component( disabled={disabled} onPress={onPress} touchSoundDisabled={touchSoundDisabled} - // $FlowFixMe[incompatible-exact] - // $FlowFixMe[prop-missing] - // $FlowFixMe[incompatible-type] ref={ref}> diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index 0ee0b92b667c..95b0e51bff36 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -125,7 +125,6 @@ class DrawerLayoutAndroid * LTI update could not be added via codemod */ _onDrawerSlide = event => { if (this.props.onDrawerSlide) { - // $FlowFixMe[unused-promise] this.props.onDrawerSlide(event); } if (this.props.keyboardDismissMode === 'on-drag') { diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js index aa3f694ad0b5..3fd071667787 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js @@ -64,7 +64,6 @@ export default class DrawerLayoutAndroid throw new Error('DrawerLayoutAndroid is only available on Android'); } - // $FlowFixMe[unclear-type] setNativeProps(nativeProps: Object): void { throw new Error('DrawerLayoutAndroid is only available on Android'); } diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index f4bde323e46f..06daac0c40cd 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -47,7 +47,6 @@ const ProgressBarAndroid: component( ...props: ProgressBarAndroidProps ) = function ProgressBarAndroid({ ref: forwardedRef, - // $FlowFixMe[incompatible-type] styleAttr = 'Normal', indeterminate = true, animating = true, diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index a9445922d19f..05325de8306d 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -810,8 +810,6 @@ type ScrollViewBaseProps = Readonly<{ * * See [RefreshControl](docs/refreshcontrol.html). */ - /* $FlowFixMe[unclear-type] - how to handle generic type without existential - * operator? */ refreshControl?: ?React.MixedElement, children?: React.Node, /** @@ -1113,7 +1111,6 @@ class ScrollView extends React.Component { UIManager.measureLayout( nodeHandle, nullthrows(findNodeHandle<$FlowFixMe>(this)), - // $FlowFixMe[method-unbinding] added when improving typing for this parameters /* $FlowFixMe[incompatible-type] Error exposed after fixing this * typing unsoundness in flow */ this._textInputFocusError, @@ -1123,7 +1120,6 @@ class ScrollView extends React.Component { nodeHandle.measureLayout( this._innerView.nativeInstance, this._inputMeasureAndScrollToKeyboard, - // $FlowFixMe[method-unbinding] added when improving typing for this parameters /* $FlowFixMe[incompatible-type] Error exposed after fixing this * typing unsoundness in flow */ this._textInputFocusError, @@ -1797,14 +1793,10 @@ class ScrollView extends React.Component { this.props.contentContainerStyle, ]; if (__DEV__ && this.props.style !== undefined) { - // $FlowFixMe[underconstrained-implicit-instantiation] const style = flattenStyle(this.props.style); const childLayoutProps = ( ['alignItems', 'justifyContent'] as const - ).filter( - // $FlowFixMe[incompatible-use] - prop => style && style[prop] !== undefined, - ); + ).filter(prop => style && style[prop] !== undefined); invariant( childLayoutProps.length === 0, 'ScrollView child layout (' + @@ -1839,7 +1831,6 @@ class ScrollView extends React.Component { return ( this._setStickyHeaderRef(key, ref)} nextHeaderLayoutY={this._headerLayoutYs.get( this._getKeyForIndex(nextIndex, children), @@ -1973,7 +1964,6 @@ class ScrollView extends React.Component { if (Platform.OS === 'ios') { // On iOS the RefreshControl is a child of the ScrollView. return ( - // $FlowFixMe[incompatible-type] - Flow only knows element refs. {refreshControl} {contentContainer} @@ -1995,7 +1985,6 @@ class ScrollView extends React.Component { // Nested scroll should always be enabled to allow the child scroll view to handle events before passing them to the refresh control parent nestedScrollEnabled={props.nestedScrollEnabled ?? true} style={StyleSheet.compose(baseStyle, inner)} - // $FlowFixMe[incompatible-type] - Flow only knows element refs. ref={scrollViewRef}> {contentContainer} , @@ -2003,7 +1992,6 @@ class ScrollView extends React.Component { } } return ( - // $FlowFixMe[incompatible-type] - Flow only knows element refs. {contentContainer} diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index 4c7fc4a38f57..2753f6aad823 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -291,8 +291,6 @@ const ScrollViewStickyHeader: component( collapsable={false} nativeID={props.nativeID} onLayout={_onLayout} - /* $FlowFixMe[prop-missing] passthroughAnimatedPropExplicitValues isn't properly - included in the Animated.View flow type. */ ref={ref} style={[ child.props.style, diff --git a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js index 8ae8306e04dd..19c4d4855830 100644 --- a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js +++ b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js @@ -153,7 +153,6 @@ function mergePropsStack( for (const prop in cur) { // $FlowFixMe[invalid-computed-prop] dynamic merge over the known StackProps keys if (cur[prop] != null) { - // $FlowFixMe[invalid-computed-prop] dynamic merge over the known StackProps keys // $FlowFixMe[prop-missing] dynamic merge over the known StackProps keys prev[prop] = cur[prop]; } diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index 5e7cf328a24d..c32bab3de4d9 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -217,7 +217,6 @@ const Switch: component( native.value != null && native.value !== jsValue; if ( shouldUpdateNativeSwitch && - // $FlowFixMe[method-unbinding] nativeSwitchRef.current?.setNativeProps != null ) { if (Platform.OS === 'android') { diff --git a/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js b/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js index ada8aef2247a..70e02e738e17 100644 --- a/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js +++ b/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js @@ -99,7 +99,6 @@ const RCTTextInputViewConfig: PartialViewConfigWithoutName = { fontSize: true, fontWeight: true, fontVariant: true, - // flowlint-next-line untyped-import:off textShadowOffset: { diff: require('../../Utilities/differ/sizesDiffer').default, }, diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index 77dcb9829ec6..47ed4321ff10 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -551,7 +551,6 @@ function InternalTextInput(props: TextInputProps): React.Node { } if (overrides != null) { - // $FlowFixMe[incompatible-type] _style = [_style, overrides]; } } @@ -635,14 +634,9 @@ function InternalTextInput(props: TextInputProps): React.Node { }; textInput = ( - /* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up - * exactly with the props for TextInput. This will need to get fixed */ /* $FlowFixMe[incompatible-type] the types for AndroidTextInput don't * match up exactly with the props for TextInput. This will need to get * fixed */ - /* $FlowFixMe[incompatible-type-arg] the types for AndroidTextInput don't - * match up exactly with the props for TextInput. This will need to get - * fixed */ null; + : (background, useForeground: boolean) => null; TouchableNativeFeedback.displayName = 'TouchableNativeFeedback'; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 67ea871f5535..f31d2a81294c 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -174,8 +174,6 @@ class TouchableOpacity extends React.Component< } _getChildStyleOpacityWithDefault(): number { - // $FlowFixMe[underconstrained-implicit-instantiation] - // $FlowFixMe[prop-missing] const opacity = flattenStyle(this.props.style)?.opacity; return typeof opacity === 'number' ? opacity : 1; } @@ -260,7 +258,6 @@ class TouchableOpacity extends React.Component< this.props.onPress !== undefined && !this.props.disabled } - // $FlowFixMe[prop-missing] ref={this.props.hostRef} {...eventHandlersWithoutBlurAndFocus}> {this.props.children} @@ -278,11 +275,7 @@ class TouchableOpacity extends React.Component< this.state.pressability.configure(this._createPressabilityConfig()); if ( this.props.disabled !== prevProps.disabled || - // $FlowFixMe[underconstrained-implicit-instantiation] - // $FlowFixMe[prop-missing] flattenStyle(prevProps.style)?.opacity !== - // $FlowFixMe[underconstrained-implicit-instantiation] - // $FlowFixMe[prop-missing] flattenStyle(this.props.style)?.opacity ) { this._opacityInactive(250); diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 52ca2318f906..d0df8030b4aa 100755 --- a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -287,6 +287,5 @@ export default function TouchableWithoutFeedback( elementProps.accessibilityLabel = accessibilityLabel; } - // $FlowFixMe[incompatible-type] return cloneElement(element, elementProps, ...children); } diff --git a/packages/react-native/Libraries/Components/View/__tests__/View-benchmark-itest.js b/packages/react-native/Libraries/Components/View/__tests__/View-benchmark-itest.js index a59a854bb946..87fb21daff9f 100644 --- a/packages/react-native/Libraries/Components/View/__tests__/View-benchmark-itest.js +++ b/packages/react-native/Libraries/Components/View/__tests__/View-benchmark-itest.js @@ -211,7 +211,6 @@ Fantom.unstable_benchmark beforeEach: () => { root = Fantom.createRoot(); Fantom.runTask(() => root.render(original)); - // $FlowExpectedError[incompatible-type] testViews = reordered; }, afterEach: () => { @@ -258,7 +257,6 @@ Fantom.unstable_benchmark beforeEach: () => { root = Fantom.createRoot(); Fantom.runTask(() => root.render(original)); - // $FlowExpectedError[incompatible-type] testViews = reordered; }, afterEach: () => { diff --git a/packages/react-native/Libraries/Core/Devtools/__tests__/globalEvalWithSourceUrl-itest.js b/packages/react-native/Libraries/Core/Devtools/__tests__/globalEvalWithSourceUrl-itest.js index 3606b25d211c..8d28b39425ae 100644 --- a/packages/react-native/Libraries/Core/Devtools/__tests__/globalEvalWithSourceUrl-itest.js +++ b/packages/react-native/Libraries/Core/Devtools/__tests__/globalEvalWithSourceUrl-itest.js @@ -15,7 +15,6 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; const SOURCE_URL = 'split-chunk-under-test.bundle'; function getHelper(): (code: string, sourceUrl?: string) => unknown { - // $FlowFixMe[prop-missing] const helper = global.globalEvalWithSourceUrl; if (typeof helper !== 'function') { throw new Error( @@ -41,7 +40,6 @@ describe('globalEvalWithSourceUrl', () => { }); it('is installed on the bridgeless runtime', () => { - // $FlowFixMe[prop-missing] expect(typeof global.globalEvalWithSourceUrl).toBe('function'); }); diff --git a/packages/react-native/Libraries/Core/ExceptionsManager.js b/packages/react-native/Libraries/Core/ExceptionsManager.js index beb735273afd..bfa73b3dd32d 100644 --- a/packages/react-native/Libraries/Core/ExceptionsManager.js +++ b/packages/react-native/Libraries/Core/ExceptionsManager.js @@ -168,8 +168,6 @@ function handleException(e: unknown, isFatal: boolean) { } try { inExceptionHandler = true; - /* $FlowFixMe[class-object-subtyping] added when improving typing for this - * parameters */ // $FlowFixMe[incompatible-type] reportException(error, isFatal, reportToConsole); } finally { @@ -258,8 +256,6 @@ function reactConsoleErrorHandler(...args) { return; } reportException( - /* $FlowFixMe[class-object-subtyping] added when improving typing for this - * parameters */ // $FlowFixMe[incompatible-type] error, isFatal, diff --git a/packages/react-native/Libraries/Core/ExtendedError.js b/packages/react-native/Libraries/Core/ExtendedError.js index 4a76a2763748..c8e83fe71172 100644 --- a/packages/react-native/Libraries/Core/ExtendedError.js +++ b/packages/react-native/Libraries/Core/ExtendedError.js @@ -23,11 +23,8 @@ export type ExtendedError = Error & cause?: { name: string, message: string, - // $FlowFixMe[unclear-type] stackElements?: ReadonlyArray, - // $FlowFixMe[unclear-type] stackSymbols?: ReadonlyArray, - // $FlowFixMe[unclear-type] stackReturnAddresses?: ReadonlyArray, }, }; diff --git a/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js b/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js index 9b0a36dfedb3..a17712e4e4e4 100644 --- a/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js +++ b/packages/react-native/Libraries/Core/ReactFiberErrorDialog.js @@ -30,18 +30,12 @@ const ReactFiberErrorDialog = { // Typically, `errorValue` should be an error. However, other values such as // strings (or even null) are sometimes thrown. if (errorValue instanceof Error) { - /* $FlowFixMe[class-object-subtyping] added when improving typing for - * this parameters */ // $FlowFixMe[incompatible-type] 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) as ExtendedError; } else { - /* $FlowFixMe[class-object-subtyping] added when improving typing for - * this parameters */ // $FlowFixMe[incompatible-type] error = new SyntheticError('Unspecified error') as ExtendedError; } diff --git a/packages/react-native/Libraries/Core/Timers/__tests__/JSTimers-test.js b/packages/react-native/Libraries/Core/Timers/__tests__/JSTimers-test.js index 0f5ebec5ad49..0cbb852a9c97 100644 --- a/packages/react-native/Libraries/Core/Timers/__tests__/JSTimers-test.js +++ b/packages/react-native/Libraries/Core/Timers/__tests__/JSTimers-test.js @@ -31,7 +31,6 @@ describe('JSTimers', () => { }); afterEach(() => { - // $FlowFixMe[prop-missing] console.warn.mockRestore(); }); diff --git a/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js b/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js index ba1942c68c1f..55faf57d6ca0 100644 --- a/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js +++ b/packages/react-native/Libraries/Core/__tests__/ExceptionsManager-test.js @@ -206,11 +206,9 @@ function runExceptionsManagerTests() { expect(exceptionData.isFatal).toBe(false); expect(logToConsoleInReact).toBe(false); expect(console.error).toBeCalledTimes(1); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0]).toBeInstanceOf( ExceptionsManager.SyntheticError, ); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0].toString()).toBe(message); }); @@ -250,11 +248,9 @@ function runExceptionsManagerTests() { expect(exceptionData.isFatal).toBe(false); expect(logToConsoleInReact).toBe(false); expect(console.error).toBeCalledTimes(1); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0]).toBeInstanceOf( ExceptionsManager.SyntheticError, ); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0].toString()).toBe( 'Unspecified error', ); @@ -669,9 +665,7 @@ function runExceptionsManagerTests() { "const error = new Error('Some error happened');", ); expect(exceptionData.isFatal).toBe(true); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0]).toHaveLength(1); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0]).toBe(error); }); @@ -702,9 +696,7 @@ function runExceptionsManagerTests() { "const error = new Error('Some error happened');", ); expect(exceptionData.isFatal).toBe(false); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0]).toHaveLength(1); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0]).toBe(error); }); @@ -731,13 +723,10 @@ function runExceptionsManagerTests() { expect(exceptionData.name).toBe(null); expect(exceptionData.stack[0].file).toMatch(/ExceptionsManager\.js$/); expect(exceptionData.isFatal).toBe(true); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0]).toHaveLength(1); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0]).toBeInstanceOf( ExceptionsManager.SyntheticError, ); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0].toString()).toBe(message); }); @@ -768,9 +757,7 @@ function runExceptionsManagerTests() { expect(getLineFromFrame(exceptionData.stack[0])).toBe( "const error = new Error('Some error happened');", ); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0]).toHaveLength(1); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0]).toBe(error); }); @@ -790,9 +777,7 @@ function runExceptionsManagerTests() { expect(logBoxAddException).not.toBeCalled(); expect(nativeReportException).toBeCalledTimes(1); } - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0]).toHaveLength(1); - // $FlowFixMe[prop-missing] expect(console.error.mock.calls[0][0]).toBe(error); }); }); @@ -870,9 +855,7 @@ function runExceptionsManagerTests() { message: 'decorated: ' + beforeDecorator.message, }); expect(mockConsoleError).toBeCalledTimes(2); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[0][0]).toBe(error); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[1][0]).toBe(error); }); @@ -898,7 +881,6 @@ function runExceptionsManagerTests() { expect(nativeReportException).toBeCalledTimes(1); } expect(mockConsoleError).toBeCalledTimes(1); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[0][0]).toBe(error); }); @@ -931,11 +913,9 @@ function runExceptionsManagerTests() { ); } expect(mockConsoleError).toBeCalledTimes(2); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[0][0]).toMatch( /Logging an error within the decorator/, ); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[1][0]).toBe(error); }); @@ -976,11 +956,9 @@ function runExceptionsManagerTests() { } expect(mockConsoleError).toBeCalledTimes(2); // console.error calls are chained without exception pre-processing, so decorator doesn't apply - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[0][0].toString()).toMatch( /Error: Some error happened/, ); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[1][0]).toMatch( /Logging an error within the decorator/, ); @@ -1013,7 +991,6 @@ function runExceptionsManagerTests() { ); } expect(mockConsoleError).toBeCalledTimes(1); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[0][0]).toBe(error); }); @@ -1043,7 +1020,6 @@ function runExceptionsManagerTests() { ); } expect(mockConsoleError).toBeCalledTimes(1); - // $FlowFixMe[prop-missing] expect(mockConsoleError.mock.calls[0][0].toString()).toMatch( /Error: Some error happened/, ); diff --git a/packages/react-native/Libraries/Core/setUpGlobals.js b/packages/react-native/Libraries/Core/setUpGlobals.js index 0418fc0246ad..189bf5f4a512 100644 --- a/packages/react-native/Libraries/Core/setUpGlobals.js +++ b/packages/react-native/Libraries/Core/setUpGlobals.js @@ -36,6 +36,5 @@ global.process = global.process || {}; // $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it. global.process.env = global.process.env || {}; if (!global.process.env.NODE_ENV) { - // $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it. global.process.env.NODE_ENV = __DEV__ ? 'development' : 'production'; } diff --git a/packages/react-native/Libraries/Core/setUpXHR.js b/packages/react-native/Libraries/Core/setUpXHR.js index 52ed8f28e386..7078e9808179 100644 --- a/packages/react-native/Libraries/Core/setUpXHR.js +++ b/packages/react-native/Libraries/Core/setUpXHR.js @@ -38,11 +38,11 @@ polyfillGlobal( 'AbortController', () => require('../../src/private/webapis/dom/abort-api/AbortController') - .AbortController, // flowlint-line untyped-import:off + .AbortController, ); polyfillGlobal( 'AbortSignal', () => require('../../src/private/webapis/dom/abort-api/AbortSignal') - .AbortSignal_public, // flowlint-line untyped-import:off + .AbortSignal_public, ); diff --git a/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js b/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js index ef8d6f99c015..3ae68c2902df 100644 --- a/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js +++ b/packages/react-native/Libraries/Debugging/DebuggingOverlayRegistry.js @@ -109,9 +109,7 @@ class DebuggingOverlayRegistry { } // `instanceHandle` => Legacy renderer - // $FlowExpectedError[method-unbinding] if (instanceHandle.measure != null) { - // $FlowFixMe[incompatible-return] return instanceHandle; } @@ -124,8 +122,6 @@ class DebuggingOverlayRegistry { let iterator: ?ReadOnlyElement = instance; while (iterator != null) { for (const subscriber of this.#registry) { - /* $FlowFixMe[invalid-compare] Error discovered during Constant - * Condition roll out. See https://fburl.com/workplace/4oq3zi07. */ if (subscriber.rootViewRef.current === iterator) { return subscriber; } @@ -145,7 +141,6 @@ class DebuggingOverlayRegistry { for (const subscriber of this.#registry) { if ( subscriber.rootViewRef.current != null && - // $FlowFixMe[incompatible-call] There is a lot of stuff to untangle to make types for refs work. isChildPublicInstance(subscriber.rootViewRef.current, instance) ) { candidates.push(subscriber); @@ -186,7 +181,6 @@ class DebuggingOverlayRegistry { isChildPublicInstance( // $FlowFixMe[incompatible-type] There is a lot of stuff to untangle to make types for refs work. potentialParent.rootViewRef.current, - // $FlowFixMe[incompatible-call] There is a lot of stuff to untangle to make types for refs work. potentialChild.rootViewRef.current, ) ) { @@ -283,9 +277,7 @@ class DebuggingOverlayRegistry { continue; } - const {x: parentX, y: parentY} = - // $FlowFixMe[prop-missing] React Native View is not a descendant of ReactNativeElement yet. We should be able to remove it once Paper is no longer supported. - rootViewInstance.getBoundingClientRect(); + const {x: parentX, y: parentY} = rootViewInstance.getBoundingClientRect(); // DebuggingOverlay will scale to the same size as a Root view. Substract Root view position from the element position // to calculate the element's position relatively to its parent DebuggingOverlay. @@ -431,9 +423,7 @@ class DebuggingOverlayRegistry { return; } - const {x: parentX, y: parentY} = - // $FlowFixMe[prop-missing] React Native View is not a descendant of ReactNativeElement yet. We should be able to remove it once Paper is no longer supported. - rootViewInstance.getBoundingClientRect(); + const {x: parentX, y: parentY} = rootViewInstance.getBoundingClientRect(); // DebuggingOverlay will scale to the same size as a Root view. Substract Root view position from the element position // to calculate the element's position relatively to its parent DebuggingOverlay. diff --git a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js index 4d02c952e431..0156b120c1a1 100644 --- a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js @@ -77,10 +77,8 @@ export default class NativeEventEmitter< } const hasAddListener = - // $FlowFixMe[method-unbinding] added when improving typing for this parameters !!nativeModule && typeof nativeModule.addListener === 'function'; const hasRemoveListeners = - // $FlowFixMe[method-unbinding] added when improving typing for this parameters !!nativeModule && typeof nativeModule.removeListeners === 'function'; if (nativeModule && hasAddListener && hasRemoveListeners) { diff --git a/packages/react-native/Libraries/Image/ImageBackground.js b/packages/react-native/Libraries/Image/ImageBackground.js index 15e2243d98f2..312c8015d841 100644 --- a/packages/react-native/Libraries/Image/ImageBackground.js +++ b/packages/react-native/Libraries/Image/ImageBackground.js @@ -78,7 +78,6 @@ class ImageBackground extends React.Component { ...props } = this.props; - // $FlowFixMe[underconstrained-implicit-instantiation] const flattenedStyle = flattenStyle(style); return ( { importantForAccessibility={importantForAccessibility} style={style} ref={this._captureRef}> - {/* $FlowFixMe[incompatible-use] */} { // So, we have to proxy/reapply these styles explicitly for actual component. // This workaround should be removed after implementing proper support of // intrinsic content size of the . - // $FlowFixMe[prop-missing] width: flattenedStyle?.width, - // $FlowFixMe[prop-missing] height: flattenedStyle?.height, }, imageStyle, diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index b7ba61bf4cd9..cbda3b00b095 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -451,7 +451,6 @@ class FlatList extends React.PureComponent> { } } - // $FlowFixMe[missing-local-annot] componentDidUpdate(prevProps: FlatListProps) { invariant( prevProps.numColumns === this.props.numColumns, @@ -483,7 +482,6 @@ class FlatList extends React.PureComponent> { this._listRef = ref; }; - // $FlowFixMe[missing-local-annot] _checkProps(props: FlatListProps) { const { // $FlowFixMe[prop-missing] this prop doesn't exist, is only used for an invariant @@ -630,10 +628,8 @@ class FlatList extends React.PureComponent> { const render = (props: ListRenderItemInfo): React.Node => { if (ListItemComponent) { // $FlowFixMe[not-a-component] Component isn't valid - // $FlowFixMe[incompatible-type] Component isn't valid return ; } else if (renderItem) { - // $FlowFixMe[incompatible-type] return renderItem(props); } else { return null; @@ -686,7 +682,6 @@ class FlatList extends React.PureComponent> { const renderer = strictMode ? this._memoizedRenderer : this._renderer; return ( - // $FlowFixMe[incompatible-exact] - `restProps` (`Props`) is inexact. items.length} - // $FlowFixMe[missing-local-annot] getItem={(items, index) => items[index]} /> ); diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js index 87af44cca45c..4b28d3576729 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js @@ -469,8 +469,6 @@ export function withSubscription( } componentDidCatch(err: Error, errorInfo: {componentStack: string, ...}) { - /* $FlowFixMe[class-object-subtyping] added when improving typing for - * this parameters */ // $FlowFixMe[incompatible-type] reportLogBoxError(err, errorInfo.componentStack); } diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js index 48bae2a748fa..01e8638d22cc 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js @@ -674,8 +674,6 @@ describe('LogBoxData', () => { it('reportLogBoxError creates a native redbox with a componentStack', () => { LogBoxData.reportLogBoxError( - /* $FlowFixMe[class-object-subtyping] added when improving typing for - * this parameters */ // $FlowFixMe[incompatible-type] new Error('Simulated Error'), ' in Component (file.js:1)', @@ -689,8 +687,6 @@ describe('LogBoxData', () => { }); it('reportLogBoxError creates a native redbox without a componentStack', () => { - /* $FlowFixMe[class-object-subtyping] added when improving typing for this - * parameters */ // $FlowFixMe[incompatible-type] LogBoxData.reportLogBoxError(new Error('Simulated Error')); @@ -702,8 +698,6 @@ describe('LogBoxData', () => { }); it('reportLogBoxError creates an error message that is also ignored', () => { - /* $FlowFixMe[class-object-subtyping] added when improving typing for this - * parameters */ // $FlowFixMe[incompatible-type] LogBoxData.reportLogBoxError(new Error('Simulated Error')); diff --git a/packages/react-native/Libraries/LogBox/LogBox.js b/packages/react-native/Libraries/LogBox/LogBox.js index 91977507fcc5..fe1b75f3b1ff 100644 --- a/packages/react-native/Libraries/LogBox/LogBox.js +++ b/packages/react-native/Libraries/LogBox/LogBox.js @@ -200,7 +200,6 @@ if (__DEV__) { let componentStack = result.componentStack; if ( (!componentStack || componentStack.length === 0) && - // $FlowExpectedError[prop-missing] React.captureOwnerStack ) { const ownerStack = React.captureOwnerStack(); diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js index 07f7ae1f89ea..7df751f7c3d1 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js @@ -25,18 +25,15 @@ import * as React from 'react'; component CodeFrameDisplay(codeFrame: CodeFrame) { function getFileName() { - // $FlowFixMe[incompatible-use] const matches = /[^/]*$/.exec(codeFrame.fileName); if (matches && matches.length > 0) { return matches[0]; } - // $FlowFixMe[incompatible-use] return codeFrame.fileName; } function getLocation() { - // $FlowFixMe[incompatible-use] const location = codeFrame.location; if (location != null) { return ` (${location.row}:${ diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-itest.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-itest.js index 0f26f952ebb5..61434245c10f 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-itest.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-itest.js @@ -99,7 +99,6 @@ describe('LogBoxInspectorStackFrames', () => { expect( getCollapseMessage( createCollapsedFrames( - // $FlowFixMe[incompatible-type] [stackOne, stackTwo, stackThree].filter(i => i != null), ), collapsed, diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index d525d98ddd49..dc855add3d06 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -340,7 +340,6 @@ class Modal extends React.Component { navigationBarTranslucent={this.props.navigationBarTranslucent} identifier={this._identifier} style={styles.modal} - // $FlowFixMe[method-unbinding] added when improving typing for this parameters /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing * unsoundness in flow */ onStartShouldSetResponder={this._shouldSetResponder} @@ -376,9 +375,6 @@ const styles = StyleSheet.create({ /* $FlowFixMe[incompatible-type] Natural Inference rollout. See * https://fburl.com/workplace/6291gfvu */ container: { - /* $FlowFixMe[invalid-computed-prop] (>=0.111.0 site=react_native_fb) This - * comment suppresses an error found when Flow v0.111 was deployed. To see - * the error, delete this comment and run Flow. */ // $FlowFixMe[incompatible-type] [side]: 0, top: 0, @@ -405,7 +401,6 @@ function Wrapper({ } Wrapper.displayName = 'Modal'; -// $FlowExpectedError[prop-missing] Wrapper.Context = VirtualizedListContextResetter; export default Wrapper; diff --git a/packages/react-native/Libraries/NativeComponent/ViewConfig.js b/packages/react-native/Libraries/NativeComponent/ViewConfig.js index 2d4eacb75b1a..64bf3f803979 100644 --- a/packages/react-native/Libraries/NativeComponent/ViewConfig.js +++ b/packages/react-native/Libraries/NativeComponent/ViewConfig.js @@ -34,9 +34,7 @@ export function createViewConfig( ), // $FlowFixMe[incompatible-type] validAttributes: composeIndexers( - // $FlowFixMe[incompatible-call] `style` property confuses Flow. PlatformBaseViewConfig.validAttributes, - // $FlowFixMe[incompatible-call] `style` property confuses Flow. partialViewConfig.validAttributes, ), }; diff --git a/packages/react-native/Libraries/Network/RCTNetworking.js.flow b/packages/react-native/Libraries/Network/RCTNetworking.js.flow index 529bc343d9c4..df9a08fb8f52 100644 --- a/packages/react-native/Libraries/Network/RCTNetworking.js.flow +++ b/packages/react-native/Libraries/Network/RCTNetworking.js.flow @@ -18,7 +18,6 @@ import type {NativeResponseType} from './XMLHttpRequest'; declare const RCTNetworking: interface { addListener( eventType: K, - // $FlowFixMe[invalid-computed-prop] listener: (...rest: RCTNetworkingEventDefinitions[K]) => unknown, context?: unknown, ): EventSubscription, diff --git a/packages/react-native/Libraries/Network/XMLHttpRequest.js b/packages/react-native/Libraries/Network/XMLHttpRequest.js index 9761aa02dd98..79f2f2a51d11 100644 --- a/packages/react-native/Libraries/Network/XMLHttpRequest.js +++ b/packages/react-native/Libraries/Network/XMLHttpRequest.js @@ -51,20 +51,11 @@ export type Response = | {[key: string]: unknown, ...}; type XHRInterceptor = interface { - requestSent( - id: number, - url: string, - method: string, - /* $FlowFixMe[unclear-type] Interceptors annotate the header map with - * differing value types, which an invariant indexer would reject. */ - headers: Object, - ): void, + requestSent(id: number, url: string, method: string, headers: Object): void, responseReceived( id: number, url: string, status: number, - /* $FlowFixMe[unclear-type] Interceptors annotate the header map with - * differing value types, which an invariant indexer would reject. */ headers: Object, ): void, dataReceived(id: number, data: string): void, diff --git a/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js b/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js index 70fa857e2a8e..9a20889e9a0a 100644 --- a/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js +++ b/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js @@ -98,7 +98,6 @@ describe('XMLHttpRequest', function () { expect(console.warn).toBeCalledWith( "The provided value 'arrayblobbuffertextfile' is not a valid 'responseType'.", ); - // $FlowFixMe[prop-missing] console.warn.mockRestore(); xhr.responseType = 'arraybuffer'; diff --git a/packages/react-native/Libraries/Pressability/HoverState.js b/packages/react-native/Libraries/Pressability/HoverState.js index 7f971a29e872..6251b7fe3938 100644 --- a/packages/react-native/Libraries/Pressability/HoverState.js +++ b/packages/react-native/Libraries/Pressability/HoverState.js @@ -12,15 +12,12 @@ import Platform from '../Utilities/Platform'; let isEnabled = false; -/* $FlowFixMe[incompatible-type] Error found due to incomplete typing of - * Platform.flow.js */ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition roll * out. See https://fburl.com/workplace/4oq3zi07. */ if (Platform.OS === 'web') { const canUseDOM = Boolean( typeof window !== 'undefined' && window.document && - // $FlowFixMe[method-unbinding] window.document.createElement, ); diff --git a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js index afb070a66da6..3b0f2334a22b 100644 --- a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js +++ b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js @@ -345,7 +345,6 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); expect(config.onHoverIn).toBeCalled(); }); @@ -358,7 +357,6 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); expect(config.onHoverIn).toBeCalled(); }); @@ -371,7 +369,6 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); expect(config.onHoverIn).toBeCalled(); }); @@ -384,7 +381,6 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); jest.advanceTimersByTime(499); expect(config.onHoverIn).not.toBeCalled(); @@ -400,7 +396,6 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); expect(config.onHoverIn).toBeCalled(); }); @@ -438,13 +433,11 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); invariant( typeof handlers.onMouseLeave === 'function', 'Expected to find "onMouseLeave" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseLeave(createMockMouseEvent('onMouseLeave')); expect(config.onHoverOut).toBeCalled(); }); @@ -457,13 +450,11 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); invariant( typeof handlers.onMouseLeave === 'function', 'Expected to find "onMouseLeave" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseLeave(createMockMouseEvent('onMouseLeave')); expect(config.onHoverOut).toBeCalled(); }); @@ -476,13 +467,11 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); invariant( typeof handlers.onMouseLeave === 'function', 'Expected to find "onMouseLeave" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseLeave(createMockMouseEvent('onMouseLeave')); jest.advanceTimersByTime( ONE_MILLISECOND_BEFORE_CONFIGURED_LONG_PRESS_DURATION, @@ -500,13 +489,11 @@ describe('Pressability', () => { typeof handlers.onMouseEnter === 'function', 'Expected to find "onMouseEnter" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseEnter(createMockMouseEvent('onMouseEnter')); invariant( typeof handlers.onMouseLeave === 'function', 'Expected to find "onMouseLeave" function', ); - // $FlowExpectedError[not-a-function] handlers.onMouseLeave(createMockMouseEvent('onMouseLeave')); expect(config.onHoverOut).toBeCalled(); }); @@ -896,9 +883,7 @@ describe('Pressability', () => { handlers.onResponderMove( createMockPressEvent({ registrationName: 'onResponderMove', - // $FlowFixMe[unsafe-addition] pageX: mockRegion.width + mockSlop.right / 2, - // $FlowFixMe[unsafe-addition] pageY: mockRegion.height + mockSlop.bottom / 2, }), ); @@ -932,9 +917,7 @@ describe('Pressability', () => { handlers.onResponderMove( createMockPressEvent({ registrationName: 'onResponderMove', - // $FlowFixMe[unsafe-addition] pageX: mockRegion.width + mockSlop.right / 2, - // $FlowFixMe[unsafe-addition] pageY: mockRegion.height + mockSlop.bottom / 2, }), ); diff --git a/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js b/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js index 3ff50971b355..fac8cd5782e8 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -28,7 +28,6 @@ type PresentLocalNotificationDetails = { alertTitle?: string, soundName?: string, category?: string, - // $FlowFixMe[unclear-type] userInfo?: Object, applicationIconBadgeNumber?: number, fireDate?: number, @@ -175,9 +174,7 @@ export interface PushNotification { * @deprecated Use [@react-native-community/push-notification-ios](https://www.npmjs.com/package/@react-native-community/push-notification-ios) instead */ class PushNotificationIOS { - // $FlowFixMe[unclear-type] _data: Object; - // $FlowFixMe[unclear-type] _alert: string | Object; _sound: string; _category: string; @@ -333,7 +330,6 @@ class PushNotificationIOS { * * See https://reactnative.dev/docs/pushnotificationios#cancellocalnotification */ - // $FlowFixMe[unclear-type] static cancelLocalNotifications(userInfo: Object): void { invariant( NativePushNotificationManagerIOS, diff --git a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js index 4a4d12984527..a39eecf5894e 100644 --- a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +++ b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js @@ -30,7 +30,6 @@ import * as RendererProxy from '../../ReactNative/RendererProxy'; export opaque type PublicRootInstance = unknown; export function createPublicRootInstance(rootTag: RootTag): PublicRootInstance { - // $FlowExpectedError[incompatible-return] return createReactNativeDocument(rootTag); } diff --git a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js index 3144295c2d5a..fa5583c74119 100644 --- a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +++ b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js @@ -334,8 +334,7 @@ function diffProperties( if (shouldUpdate) { const nextValue = typeof attributeConfig.process === 'function' - ? // $FlowFixMe[incompatible-use] found when upgrading Flow - attributeConfig.process(nextProp) + ? attributeConfig.process(nextProp) : nextProp; (updatePayload || (updatePayload = {} as {[key: string]: unknown}))[ propKey diff --git a/packages/react-native/Libraries/ReactNative/__tests__/UIManager-test.js b/packages/react-native/Libraries/ReactNative/__tests__/UIManager-test.js index 9e2633eb48be..4ca4fd7a4eef 100644 --- a/packages/react-native/Libraries/ReactNative/__tests__/UIManager-test.js +++ b/packages/react-native/Libraries/ReactNative/__tests__/UIManager-test.js @@ -35,12 +35,9 @@ describe('UIManager', () => { try { // $FlowExpectedError[cannot-write] global.RN$Bridgeless = true; - // $FlowExpectedError[cannot-write] global.RN$LegacyInterop_UIManager_getConstants = getConstants; - // $FlowExpectedError[cannot-write] global.RN$LegacyInterop_UIManager_getConstantsForViewManager = getConstantsForViewManager; - // $FlowExpectedError[cannot-write] global.RN$LegacyInterop_UIManager_getDefaultEventTypes = jest.fn( () => ({}), ); @@ -60,12 +57,9 @@ describe('UIManager', () => { } finally { // $FlowExpectedError[cannot-write] global.RN$Bridgeless = originalBridgelessValue; - // $FlowExpectedError[cannot-write] global.RN$LegacyInterop_UIManager_getConstants = originalGetConstants; - // $FlowExpectedError[cannot-write] global.RN$LegacyInterop_UIManager_getConstantsForViewManager = originalGetConstantsForViewManager; - // $FlowExpectedError[cannot-write] global.RN$LegacyInterop_UIManager_getDefaultEventTypes = originalGetDefaultEventTypes; jest.resetModules(); diff --git a/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js b/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js index d75fc695b26e..9a9a5cd64606 100644 --- a/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js @@ -138,7 +138,6 @@ function attachDefaultEventTypes( } } -// $FlowFixMe[method-unbinding] const hasOwnProperty = Object.prototype.hasOwnProperty; // TODO: Figure out how to avoid all this runtime initialization cost. diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index 0e926394122a..92f176f89928 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -1116,8 +1116,6 @@ export type ____ImageStyleProp_Internal = StyleProp< >; export type ____Styles_Internal = { - // $FlowFixMe[incompatible-exact] - // $FlowFixMe[incompatible-type] readonly [key: string]: Partial<____DangerouslyImpreciseStyle_Internal>, ... }; diff --git a/packages/react-native/Libraries/StyleSheet/__tests__/flattenStyle-benchmark-itest.js b/packages/react-native/Libraries/StyleSheet/__tests__/flattenStyle-benchmark-itest.js index 02838801b57b..3ccdb3908d85 100644 --- a/packages/react-native/Libraries/StyleSheet/__tests__/flattenStyle-benchmark-itest.js +++ b/packages/react-native/Libraries/StyleSheet/__tests__/flattenStyle-benchmark-itest.js @@ -64,7 +64,6 @@ Fantom.unstable_benchmark flattenStyle(nestedSingleArrayStyle); }) .test('flatten nested array with merged styles', () => { - // $FlowFixMe[incompatible-call] flattenStyle(nestedMergedArrayStyle); }) .test('flatten array with merged styles', () => { diff --git a/packages/react-native/Libraries/StyleSheet/__tests__/processFilter-itest.js b/packages/react-native/Libraries/StyleSheet/__tests__/processFilter-itest.js index 12255caefc47..2e2a61023868 100644 --- a/packages/react-native/Libraries/StyleSheet/__tests__/processFilter-itest.js +++ b/packages/react-native/Libraries/StyleSheet/__tests__/processFilter-itest.js @@ -144,15 +144,12 @@ describe('processFilter', () => { expect(processFilter('')).toEqual([]); }); it('string non filter', () => { - // $FlowExpectedError[incompatible-call] expect(processFilter('foo: 5')).toEqual([]); }); it('string invalid amount type', () => { - // $FlowExpectedError[incompatible-call] expect(processFilter('brightness: {}')).toEqual([]); }); it('string brightness(.5)', () => { - // $FlowExpectedError[incompatible-call] expect(processFilter('brightness(.5)')).toEqual([{brightness: 0.5}]); }); diff --git a/packages/react-native/Libraries/StyleSheet/flattenStyle.js b/packages/react-native/Libraries/StyleSheet/flattenStyle.js index 7ac158b26009..f7624582f331 100644 --- a/packages/react-native/Libraries/StyleSheet/flattenStyle.js +++ b/packages/react-native/Libraries/StyleSheet/flattenStyle.js @@ -30,14 +30,11 @@ function flattenStyleArrayInto< } if (Array.isArray(style)) { - // $FlowFixMe[underconstrained-implicit-instantiation] flattenStyleArrayInto(result, style); continue; } - // $FlowFixMe[invalid-in-rhs] for (const key in style) { - // $FlowFixMe[incompatible-use] // $FlowFixMe[invalid-computed-prop] // $FlowFixMe[prop-missing] result[key] = style[key]; @@ -49,7 +46,6 @@ function flattenStyle< TStyleProp extends ____DangerouslyImpreciseAnimatedStyleProp_Internal, >( style: ?TStyleProp, - // $FlowFixMe[underconstrained-implicit-instantiation] ): ?NonAnimatedNodeObject<____FlattenStyleProp_Internal> { if (style === null || typeof style !== 'object') { return undefined; @@ -61,7 +57,6 @@ function flattenStyle< } const result: {[key: string]: $FlowFixMe} = {}; - // $FlowFixMe[underconstrained-implicit-instantiation] flattenStyleArrayInto(result, style); // $FlowFixMe[incompatible-type] diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index 6c4b28d0caf0..a5ed1a1bb777 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -209,7 +209,6 @@ const TextImpl: component( } if (overrides != null) { - // $FlowFixMe[incompatible-type] _style = [_style, overrides]; } } diff --git a/packages/react-native/Libraries/Text/__tests__/Text-itest.js b/packages/react-native/Libraries/Text/__tests__/Text-itest.js index f2126b41af5d..0d0b98090978 100644 --- a/packages/react-native/Libraries/Text/__tests__/Text-itest.js +++ b/packages/react-native/Libraries/Text/__tests__/Text-itest.js @@ -806,7 +806,6 @@ describe('', () => { const root = Fantom.createRoot(); Fantom.runTask(() => { root.render( - // $FlowFixMe[prop-missing] {}} role="button"> {TEST_TEXT} , diff --git a/packages/react-native/Libraries/Utilities/HMRClient.js b/packages/react-native/Libraries/Utilities/HMRClient.js index bf3e7826ddb8..2fb04e361ac7 100644 --- a/packages/react-native/Libraries/Utilities/HMRClient.js +++ b/packages/react-native/Libraries/Utilities/HMRClient.js @@ -388,8 +388,6 @@ function showCompileError() { const message = currentCompileErrorMessage; currentCompileErrorMessage = null; - /* $FlowFixMe[class-object-subtyping] added when improving typing for this - * parameters */ // $FlowFixMe[incompatible-type] const error: ExtendedError = new Error(message); // Symbolicating compile errors is wasted effort diff --git a/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js b/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js index 47b6bc950040..66f7b011c701 100644 --- a/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js +++ b/packages/react-native/Libraries/Utilities/ReactNativeTestTools.js @@ -24,9 +24,6 @@ const {VirtualizedList} = require('@react-native/virtualized-lists').default; export type ReactTestInstance = ReactTestRendererType['root']; export type Predicate = (node: ReactTestInstance) => boolean; -/* $FlowFixMe[value-as-type] (>=0.125.1 site=react_native_fb) This comment - * suppresses an error found when Flow v0.125.1 was deployed. To see the error, - * delete this comment and run Flow. */ export type ReactTestRendererJSON = /* $FlowFixMe[prop-missing] (>=0.125.1 site=react_native_fb) This comment * suppresses an error found when Flow v0.125.1 was deployed. To see the error, diff --git a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js index 3df58c7e5a45..b55793e99c5c 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js @@ -71,7 +71,6 @@ function codegenNativeComponent( } return requireNativeComponent( - // $FlowFixMe[incompatible-type] componentNameInUse, ) as HostComponent; } diff --git a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js index bae498ac057e..c8fdccc79c65 100644 --- a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +++ b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js @@ -44,7 +44,6 @@ function deepFreezeAndThrowOnMutationInDev>( // $FlowFixMe[not-an-object] `object` can be an array, but Object.keys works with arrays too const keys = Object.keys(object as {...} | Array); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters const hasOwnProperty = Object.prototype.hasOwnProperty; for (let i = 0; i < keys.length; i++) { diff --git a/packages/react-native/Libraries/Utilities/stringifyViewConfig.js b/packages/react-native/Libraries/Utilities/stringifyViewConfig.js index daf7cbcf2b28..3e99ce67b57b 100644 --- a/packages/react-native/Libraries/Utilities/stringifyViewConfig.js +++ b/packages/react-native/Libraries/Utilities/stringifyViewConfig.js @@ -9,7 +9,6 @@ */ export default function stringifyViewConfig(viewConfig: unknown): string { - // $FlowFixMe[incompatible-type] JSON.stringify can return void; preserves prior behavior (returns the result directly, not coerced to '') return JSON.stringify( viewConfig, (key, val) => { diff --git a/packages/react-native/Libraries/Utilities/useMergeRefs.js b/packages/react-native/Libraries/Utilities/useMergeRefs.js index 31751e35637a..d8cec674ed94 100644 --- a/packages/react-native/Libraries/Utilities/useMergeRefs.js +++ b/packages/react-native/Libraries/Utilities/useMergeRefs.js @@ -28,7 +28,6 @@ export default function useMergeRefs( (current: Instance) => { const cleanups: ReadonlyArray void)> = refs.map(ref => { if (typeof ref === 'function') { - // $FlowFixMe[incompatible-type] - Flow does not understand ref cleanup. const cleanup: void | (() => void) = ref(current); return typeof cleanup === 'function' ? cleanup diff --git a/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js b/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js index b270891e8cac..f29662b705f5 100644 --- a/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js +++ b/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js @@ -174,7 +174,6 @@ const WebSocketInterceptor = { if (isInterceptorEnabled) { return; } - // $FlowFixMe[underconstrained-implicit-instantiation] eventEmitter = new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior diff --git a/packages/react-native/Libraries/promiseRejectionTrackingOptions.js b/packages/react-native/Libraries/promiseRejectionTrackingOptions.js index bfabef58c8fd..ffbc68ab8c78 100644 --- a/packages/react-native/Libraries/promiseRejectionTrackingOptions.js +++ b/packages/react-native/Libraries/promiseRejectionTrackingOptions.js @@ -27,12 +27,10 @@ const rejectionTrackingOptions: NonNullable[0]> = { if (rejection === undefined) { message = ''; } else if ( - // $FlowFixMe[method-unbinding] added when improving typing for this parameters /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ Object.prototype.toString.call(rejection) === '[object Error]' ) { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ message = Error.prototype.toString.call(rejection); diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 46f88d3b7024..3dd15e88e968 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -446,8 +446,6 @@ Object.defineProperty(module.exports, 'Touchable', { }); if (__DEV__) { - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access InteractionManager. */ /* $FlowFixMe[invalid-export] This is intentional: Flow will error when * attempting to access InteractionManager. */ Object.defineProperty(module.exports, 'InteractionManager', { @@ -462,8 +460,6 @@ if (__DEV__) { }, }); - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access Clipboard. */ /* $FlowFixMe[invalid-export] This is intentional: Flow will error when * attempting to access Clipboard. */ Object.defineProperty(module.exports, 'Clipboard', { diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js b/packages/react-native/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js index 1b512d7cd1cc..bd4fe6b46adf 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js @@ -20,7 +20,6 @@ function generateSchemaInfos( libraries /*: ReadonlyArray<$FlowFixMe> */, platform /*: string */, ) /*: Array<$FlowFixMe> */ { - // $FlowFixMe[incompatible-type] return libraries.map(library => generateSchemaInfo(library, platform)); } diff --git a/packages/react-native/scripts/ios-prebuild/framework-resources.js b/packages/react-native/scripts/ios-prebuild/framework-resources.js index 1e2d0c6ff444..66aa0ec75960 100644 --- a/packages/react-native/scripts/ios-prebuild/framework-resources.js +++ b/packages/react-native/scripts/ios-prebuild/framework-resources.js @@ -171,7 +171,6 @@ function mergePrivacyManifests( /** Parses a single `PrivacyInfo.xcprivacy` (plist) file into an object. */ function readPrivacyManifest(filePath /*: string */) /*: PrivacyManifest */ { - // $FlowFixMe[incompatible-return] plist.parse returns a loose PlistValue. return plist.parse(fs.readFileSync(filePath, 'utf8')); } diff --git a/packages/react-native/scripts/setup-apple-spm.js b/packages/react-native/scripts/setup-apple-spm.js index 38d1e40ea39f..736d8f5517c8 100644 --- a/packages/react-native/scripts/setup-apple-spm.js +++ b/packages/react-native/scripts/setup-apple-spm.js @@ -376,7 +376,6 @@ function promptYesNo( question /*: string */, defaultYes /*: boolean */, ) /*: Promise */ { - // $FlowFixMe[prop-missing] process.stdin.isTTY not in Flow stubs if (process.stdin.isTTY !== true) { return Promise.resolve(true); } @@ -488,7 +487,6 @@ function determineVersion( ); return pinned; } - // $FlowFixMe[incompatible-type] JSON.parse returns any const pkgJson /*: {version: string} */ = JSON.parse( fs.readFileSync(path.join(reactNativeRoot, 'package.json'), 'utf8'), ); @@ -841,7 +839,6 @@ function resolveInjectionTarget( } catch {} for (const entry of entries) { if (!entry.isDirectory()) continue; - // $FlowFixMe[incompatible-type] Dirent.name is string|Buffer in Flow stubs const name /*: string */ = entry.name; if (name.endsWith('.xcodeproj')) { names.push(name); diff --git a/packages/react-native/scripts/spm/autolinking-plugins.js b/packages/react-native/scripts/spm/autolinking-plugins.js index 4682fe13234c..018f01b1b9e0 100644 --- a/packages/react-native/scripts/spm/autolinking-plugins.js +++ b/packages/react-native/scripts/spm/autolinking-plugins.js @@ -116,7 +116,6 @@ function discoverPlugins( if (denied.has(dep.name)) { continue; } - // $FlowFixMe[incompatible-use] config has a dynamic shape const rel = readSwiftpmConfig( dep.root, readConfig(dep.root), @@ -145,11 +144,9 @@ function discoverPlugins( const resolved = typeof fn === 'function' ? fn - : // $FlowFixMe[incompatible-use] interop shapes - typeof fn?.default === 'function' + : typeof fn?.default === 'function' ? fn.default - : // $FlowFixMe[incompatible-use] - typeof fn?.plugin === 'function' + : typeof fn?.plugin === 'function' ? fn.plugin : null; if (resolved == null) { @@ -215,17 +212,11 @@ function invokePlugins( `${typeof result}; expected an object or undefined.`, ); } - // $FlowFixMe[incompatible-use] validated field-by-field below const pkgs = result.packageDependencies ?? []; - // $FlowFixMe[incompatible-use] const prods = result.productDependencies ?? []; - // $FlowFixMe[incompatible-use] const srcs = result.generatedSources ?? []; - // $FlowFixMe[incompatible-use] const rawFrameworks = result.flavoredFrameworks ?? []; - // $FlowFixMe[incompatible-use] const rawWatch = result.watchPaths ?? []; - // $FlowFixMe[incompatible-use] const rawScriptPhases = result.scriptPhases ?? []; if (!Array.isArray(rawFrameworks)) { throw new Error( diff --git a/packages/react-native/scripts/spm/download-spm-artifacts.js b/packages/react-native/scripts/spm/download-spm-artifacts.js index d7f7f2d1db0a..cd959813ca23 100644 --- a/packages/react-native/scripts/spm/download-spm-artifacts.js +++ b/packages/react-native/scripts/spm/download-spm-artifacts.js @@ -378,7 +378,6 @@ async function exists(url /*: string */) /*: Promise */ { } try { - // $FlowFixMe[incompatible-call] global fetch not in Flow stubs const res = await fetch(url, {method: 'HEAD'}); return res.status === 200; } catch { @@ -491,7 +490,6 @@ function resolveLocalHermesCompilerVersion( const pkgPath = require.resolve('hermes-compiler/package.json', { paths: [rnRoot], }); - // $FlowFixMe[incompatible-type] JSON.parse returns any const pkg /*: {version: string} */ = JSON.parse( fs.readFileSync(pkgPath, 'utf8'), ); @@ -666,7 +664,6 @@ async function downloadOnce( ) /*: Promise */ { const tmpPath = destPath + '.download'; try { - // $FlowFixMe[incompatible-call] global fetch not in Flow stubs const res = await fetch(url); if (!res.ok) { throw new Error(`HTTP ${res.status} ${res.statusText}: ${url}`); @@ -728,7 +725,6 @@ async function downloadOnce( if (res.body) { // fetch() returns a Web ReadableStream, not a Node.js Readable. // Convert it so we can pipe to a file stream and track progress. - // $FlowFixMe[prop-missing] stream.Readable.fromWeb not in Flow stubs const nodeReadable = stream.Readable.fromWeb(res.body); await new Promise((resolve, reject) => { @@ -1256,7 +1252,6 @@ async function main(argv /*:: ?: Array */) /*: Promise */ { let rawVersion = args.version; let rnVersion = args.version; if (rnVersion == null) { - // $FlowFixMe[incompatible-type] JSON.parse returns any const rnPkg /*: {version: string} */ = JSON.parse( fs.readFileSync(path.join(rnRoot, 'package.json'), 'utf8'), ); diff --git a/packages/react-native/scripts/spm/generate-spm-autolinking-config.js b/packages/react-native/scripts/spm/generate-spm-autolinking-config.js index 6861e432b3b0..d75ba8c4d571 100644 --- a/packages/react-native/scripts/spm/generate-spm-autolinking-config.js +++ b/packages/react-native/scripts/spm/generate-spm-autolinking-config.js @@ -96,7 +96,6 @@ function resolveDefaultConfigCommand( '@react-native-community/cli/package.json', {paths: [projectRoot]}, ); - // $FlowFixMe[unclear-type] package.json has dynamic shape const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')); const bin = pkgJson.bin; const binPath = diff --git a/packages/react-native/scripts/spm/generate-spm-xcodeproj.js b/packages/react-native/scripts/spm/generate-spm-xcodeproj.js index 85146910d0ce..f7f55d1c41a7 100644 --- a/packages/react-native/scripts/spm/generate-spm-xcodeproj.js +++ b/packages/react-native/scripts/spm/generate-spm-xcodeproj.js @@ -2472,7 +2472,6 @@ function readMarker( ) /*: ?{targetUuid?: ?string, generatedSources?: {[key: string]: Array}, scriptPhases?: {[key: string]: string}, linkedFrameworks?: Array<{id: string, frameworkName: string}>, artifactsVersionOverride?: ?string, configCommand?: ?Array, cxxApiDefines?: unknown, buildSettingChanges?: Array, xcconfig?: XcconfigRecord, createdArrayFields?: Array, scheme?: {file?: ?string, created?: ?boolean}, gitignore?: GitignoreRecord, ...} */ { const markerPath = path.join(xcodeprojPath, SPM_INJECTED_MARKER); try { - // $FlowFixMe[incompatible-return] JSON.parse returns any return JSON.parse(fs.readFileSync(markerPath, 'utf8')); } catch { return null; @@ -3213,7 +3212,6 @@ function removeSpmInjection( if (!fs.existsSync(markerPath)) { return {status: 'absent'}; } - // $FlowFixMe[incompatible-type] JSON.parse returns any const marker = JSON.parse(fs.readFileSync(markerPath, 'utf8')); const pbxprojPath = path.join(xcodeprojPath, 'project.pbxproj'); let text = fs.readFileSync(pbxprojPath, 'utf8'); diff --git a/packages/react-native/scripts/spm/read-podspec.js b/packages/react-native/scripts/spm/read-podspec.js index 64b524708a3d..50618a937d14 100644 --- a/packages/react-native/scripts/spm/read-podspec.js +++ b/packages/react-native/scripts/spm/read-podspec.js @@ -442,7 +442,6 @@ function shellTokenize(value /*: string */) /*: Array */ { */ function flattenSubspecs(rawSpec /*: RawSpec */) /*: PodspecModel */ { const warnings /*: Array */ = []; - // $FlowFixMe[prop-missing] dynamic shape const partial /*: boolean */ = rawSpec.__regex_partial__ === true; if (Array.isArray(rawSpec.__warnings__)) { // $FlowFixMe[incompatible-type] runtime-validated dynamic shape @@ -460,7 +459,6 @@ function flattenSubspecs(rawSpec /*: RawSpec */) /*: PodspecModel */ { if (Array.isArray(rawSpec.default_subspecs)) { const wanted = new Set(rawSpec.default_subspecs); selected = subspecs.filter(s => { - // $FlowFixMe[prop-missing] dynamic shape const name = s != null && typeof s.name === 'string' ? s.name : null; return name != null && wanted.has(name); }); @@ -486,7 +484,6 @@ function flattenSubspecs(rawSpec /*: RawSpec */) /*: PodspecModel */ { // Only the spec's own value: a subspec's `header_dir` names that subspec's // headers, and several subspecs can disagree. function specStringField(key /*: string */) /*: string | null */ { - // $FlowFixMe[incompatible-use] dynamic shape const value = rawSpec[key]; return typeof value === 'string' && value.length > 0 ? value : null; } @@ -517,7 +514,6 @@ function flattenSubspecs(rawSpec /*: RawSpec */) /*: PodspecModel */ { for (const layer of layers) { if (layer == null || typeof layer !== 'object') continue; for (const xcKey of XCCONFIG_KEYS) { - // $FlowFixMe[incompatible-use] layer narrowed from `mixed` const xc = layer[xcKey]; if (xc == null || typeof xc !== 'object') continue; const hsp = xc.HEADER_SEARCH_PATHS; @@ -575,7 +571,6 @@ function flattenSubspecs(rawSpec /*: RawSpec */) /*: PodspecModel */ { for (const layer of layers) { if (layer == null || typeof layer !== 'object') continue; for (const xcKey of XCCONFIG_KEYS) { - // $FlowFixMe[incompatible-use] layer narrowed from `mixed` const xc = layer[xcKey]; if (xc == null || typeof xc !== 'object') continue; for (const rawKey of Object.keys(xc)) { @@ -596,7 +591,6 @@ function flattenSubspecs(rawSpec /*: RawSpec */) /*: PodspecModel */ { : cfgRaw === 'release' ? 'release' : null; - // $FlowFixMe[incompatible-use] xc value access is intentional const val = xc[rawKey]; const strs = typeof val === 'string' @@ -671,7 +665,6 @@ function flattenSubspecs(rawSpec /*: RawSpec */) /*: PodspecModel */ { return out; } - // $FlowFixMe[prop-missing] dynamic shape const reqArc /*: unknown */ = rawSpec.requires_arc; const requiresArc = reqArc === false || (Array.isArray(reqArc) && reqArc.length === 0) @@ -783,7 +776,6 @@ function readPodspecNames( ) /*: ?{name: ?string, moduleName: ?string, headerDir: ?string} */ { const raw = regexPodspec(podspecPath); const field = (key /*: string */) /*: ?string */ => { - // $FlowFixMe[prop-missing] RawSpec is dynamically shaped const value = raw[key]; return typeof value === 'string' && value.length > 0 && diff --git a/packages/react-native/scripts/spm/scaffold-package-swift.js b/packages/react-native/scripts/spm/scaffold-package-swift.js index ee0e47a1e9e0..ef79ace126d6 100644 --- a/packages/react-native/scripts/spm/scaffold-package-swift.js +++ b/packages/react-native/scripts/spm/scaffold-package-swift.js @@ -985,7 +985,6 @@ function scaffoldPackageSwiftForDep( } // autolinking.json may have provided podspecPath; otherwise search dep.root. - // $FlowFixMe[prop-missing] dynamic shape from autolinking.json const podspecPath /*: ?string */ = dep.platforms.ios.podspecPath ?? findPodspecs(dep.root)[0]; if (podspecPath == null || !fs.existsSync(podspecPath)) { @@ -1142,7 +1141,6 @@ function collectAutolinkedDeps( ) /*: ?Array */ { const {autolinkingJsonPath, remote, onSkipped} = opts; /*:: type AutolinkingJson = {dependencies?: ?{[key: string]: {root?: string, platforms?: {ios?: ?{...}, ...}, ...}}, ...}; */ - // $FlowFixMe[incompatible-type] JSON.parse returns any const data /*: AutolinkingJson */ = JSON.parse( fs.readFileSync(autolinkingJsonPath, 'utf8'), ); diff --git a/packages/react-native/scripts/spm/spm-utils.js b/packages/react-native/scripts/spm/spm-utils.js index 57973f717d58..0273b194eac1 100644 --- a/packages/react-native/scripts/spm/spm-utils.js +++ b/packages/react-native/scripts/spm/spm-utils.js @@ -219,7 +219,6 @@ function readPackageJson(dir /*: string */) /*: any | null */ { if (!fs.existsSync(pkgPath)) { return null; } - // $FlowFixMe[incompatible-return] JSON.parse returns any return JSON.parse(fs.readFileSync(pkgPath, 'utf8')); } diff --git a/packages/react-native/src/private/animated/NativeAnimatedHelper.js b/packages/react-native/src/private/animated/NativeAnimatedHelper.js index e9a077994341..e6de1345f094 100644 --- a/packages/react-native/src/private/animated/NativeAnimatedHelper.js +++ b/packages/react-native/src/private/animated/NativeAnimatedHelper.js @@ -148,14 +148,11 @@ function createNativeOperations(): NonNullable { // been flushed, use the queue. This is to prevent operations // from being executed out of order. if (queueOperations || queue.length !== 0) { - // $FlowExpectedError[incompatible-call] - Dynamism. queue.push(() => method(...args)); } else if (shouldSignalBatch) { - // $FlowExpectedError[incompatible-call] - Dynamism. queue.push(() => method(...args)); scheduleQueueFlush(); } else { - // $FlowExpectedError[incompatible-call] - Dynamism. method(...args); } }; @@ -484,10 +481,8 @@ export default { generateNewNodeTag, isNativeDriverForced, // $FlowExpectedError[unsafe-getters-setters] - unsafe getter lint suppression - // $FlowExpectedError[missing-type-arg] - unsafe getter lint suppression get nativeEventEmitter(): NativeEventEmitter { if (!nativeEventEmitter) { - // $FlowFixMe[underconstrained-implicit-instantiation] nativeEventEmitter = new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior diff --git a/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js b/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js index a20c6ce16cbd..c20e1ae488b7 100644 --- a/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js +++ b/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js @@ -32,7 +32,6 @@ describe('Native Animated', () => { } function createViewInstance(): React.ElementRef { - // $FlowFixMe[incompatible-type] return {}; } @@ -111,7 +110,6 @@ describe('Native Animated', () => { expect.any(Number), 0.5, ); - // $FlowFixMe[method-unbinding] expect(ref.current?.setNativeProps).not.toHaveBeenCalled(); }); diff --git a/packages/react-native/src/private/animated/createAnimatedPropsHook.js b/packages/react-native/src/private/animated/createAnimatedPropsHook.js index b931584dea3b..499ade268ea0 100644 --- a/packages/react-native/src/private/animated/createAnimatedPropsHook.js +++ b/packages/react-native/src/private/animated/createAnimatedPropsHook.js @@ -121,7 +121,6 @@ export default function createAnimatedPropsHook( // NOTE: This may be called more often than necessary (e.g. when `props` // changes), but `setNativeView` already optimizes for that. - // $FlowFixMe[incompatible-type] node.setNativeView(instance); // NOTE: When using the JS animation driver, this callback is called on @@ -169,7 +168,6 @@ export default function createAnimatedPropsHook( if (!isFabricNode) { // Check 4: this is a paper instance, call setNativeProps. - // $FlowFixMe[not-a-function] - Assume it's still a function. // $FlowFixMe[incompatible-use] return instance.setNativeProps(node.__getAnimatedValue()); } @@ -184,7 +182,6 @@ export default function createAnimatedPropsHook( // This is a Fabric instance and setNativeProps is supported. // $FlowFixMe[not-a-function] - Assume it's still a function. - // $FlowFixMe[incompatible-use] instance.setNativeProps(node.__getAnimatedValue()); // Keeping state of Fiber tree and Shadow tree in sync. diff --git a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js index 22ebd3c41e46..93e81ff3bbab 100644 --- a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js +++ b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js @@ -120,7 +120,6 @@ export function createCompositeKeyForProps( if (allowlist == null || hasOwn(allowlist, key)) { let compositeKeyComponent; if (key === 'style') { - // $FlowFixMe[incompatible-call] - `style` is a valid argument. // $FlowFixMe[incompatible-type] - `flattenStyle` returns an object. const flatStyle: ?{[key: string]: unknown} = flattenStyle(value); if (flatStyle != null) { @@ -354,10 +353,8 @@ function areCompositeKeyComponentsEqual( // Supported versions of JSC do not implement the newer Object.hasOwn. Remove // this shim when they do. -// $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = - // $FlowFixMe[method-unbinding] /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js index 24754c94c70e..346c56c569bc 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js @@ -14,11 +14,9 @@ import typeof XMLHttpRequestT from '../../../../../Libraries/Network/XMLHttpRequ const XMLHttpRequest: XMLHttpRequestT = require('../../../../../Libraries/Network/XMLHttpRequest').default; -// $FlowFixMe[method-unbinding] + const originalXHROpen = XMLHttpRequest.prototype.open; -// $FlowFixMe[method-unbinding] const originalXHRSend = XMLHttpRequest.prototype.send; -// $FlowFixMe[method-unbinding] const originalXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; type XHRInterceptorOpenCallback = ( 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 79ac843936ba..83839b4f156d 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js @@ -43,7 +43,6 @@ function ensureExternalInspectionAPI( enable: onEnable, disable: onDisable, }; - // $FlowFixMe[prop-missing] Initializing global API for DevTools communication (global as $FlowFixMe).__EXTERNAL_INSPECTION__ = api; return api; } diff --git a/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js b/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js index b8010d4f15c2..fb9300cfc3fd 100644 --- a/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js +++ b/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js @@ -23,7 +23,6 @@ function asEventTarget(node: ?interface {}): EventTarget { if (node == null) { throw new Error('Expected non-null node'); } - // $FlowFixMe[incompatible-return] ReadOnlyNode extends EventTarget at runtime // $FlowFixMe[incompatible-type] return node; } @@ -1735,7 +1734,6 @@ describe('EventTarget-based Event Dispatching', () => { ); expect(handler).toHaveBeenCalled(); - // $FlowFixMe[prop-missing] Flow's global Event type omits static constants. expect(observedPhase).toBe(Event.AT_TARGET); // Event path is just the target node. expect(observedPathLength).toBe(1); diff --git a/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js b/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js index d8b54ed477cd..34cf8defe1ba 100644 --- a/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js +++ b/packages/react-native/src/private/renderer/errorhandling/ErrorHandlers.js @@ -30,18 +30,12 @@ function getExtendedError( // Typically, `errorValue` should be an error. However, other values such as // strings (or even null) are sometimes thrown. if (errorValue instanceof Error) { - /* $FlowFixMe[class-object-subtyping] added when improving typing for - * this parameters */ // $FlowFixMe[incompatible-type] 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) as ExtendedError; } else { - /* $FlowFixMe[class-object-subtyping] added when improving typing for - * this parameters */ // $FlowFixMe[incompatible-type] error = new SyntheticError('Unspecified error') as ExtendedError; } diff --git a/packages/react-native/src/private/renderer/events/ReactNativeResponder.js b/packages/react-native/src/private/renderer/events/ReactNativeResponder.js index 8c2b2d25b26d..752abd9c74f3 100644 --- a/packages/react-native/src/private/renderer/events/ReactNativeResponder.js +++ b/packages/react-native/src/private/renderer/events/ReactNativeResponder.js @@ -53,7 +53,6 @@ function getHandler( // Temporary cast until ReadOnlyNode extends EventTarget ungated. function asEventTarget(node: ReadOnlyElement): ReadOnlyNodeWithEventTarget { - // $FlowFixMe[incompatible-type] const eventTarget: ReadOnlyNodeWithEventTarget = node; return eventTarget; } @@ -87,7 +86,6 @@ function getResponderParentElement( ): ReadOnlyElement | null { // `ReadOnlyElement` extends `EventTarget` at runtime when the new // event-dispatching pipeline is enabled (the only case this module runs in). - // $FlowFixMe[incompatible-type] const eventTarget: EventTarget = node; const parent = getEventTargetParent(eventTarget); if (parent instanceof ReadOnlyElement) { diff --git a/packages/react-native/src/private/webapis/console/__tests__/consoleCreateTask-benchmark-itest.js b/packages/react-native/src/private/webapis/console/__tests__/consoleCreateTask-benchmark-itest.js index be7af5bfcb75..7ba03b1f42c7 100644 --- a/packages/react-native/src/private/webapis/console/__tests__/consoleCreateTask-benchmark-itest.js +++ b/packages/react-native/src/private/webapis/console/__tests__/consoleCreateTask-benchmark-itest.js @@ -26,7 +26,6 @@ Fantom.unstable_benchmark disableOptimizedBuildCheck: true, }) .test('JavaScript shim', () => { - // $FlowFixMe[incompatible-type] const task: ConsoleTask = {run: cb => cb()}; task.run(fn); }) diff --git a/packages/react-native/src/private/webapis/dom/abort-api/AbortController.js b/packages/react-native/src/private/webapis/dom/abort-api/AbortController.js index 0c5c3c882502..5bb71b271b85 100644 --- a/packages/react-native/src/private/webapis/dom/abort-api/AbortController.js +++ b/packages/react-native/src/private/webapis/dom/abort-api/AbortController.js @@ -82,7 +82,6 @@ Object.defineProperties(AbortController.prototype, { abort: {enumerable: true}, }); -//$FlowExpectedError[cannot-write] Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { configurable: true, value: 'AbortController', diff --git a/packages/react-native/src/private/webapis/dom/abort-api/AbortSignal.js b/packages/react-native/src/private/webapis/dom/abort-api/AbortSignal.js index 8a7ab8bb4285..d8b17c6ea1e7 100644 --- a/packages/react-native/src/private/webapis/dom/abort-api/AbortSignal.js +++ b/packages/react-native/src/private/webapis/dom/abort-api/AbortSignal.js @@ -223,8 +223,6 @@ export const AbortSignal_public: typeof AbortSignal = }; // Copy static properties ('length', 'name', 'prototype', 'abort', 'any', 'timeout') so that callers accessing them via the public constructor (e.g. `AbortSignal.timeout(0)`) still work. -// $FlowFixMe[unsafe-object-assign] -// $FlowFixMe[not-an-object] Object.getOwnPropertyNames(AbortSignal).forEach(methodName => { Object.defineProperty( AbortSignal_public, diff --git a/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js b/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js index 0001c9e5194b..4f2a6dd60a40 100644 --- a/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js +++ b/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js @@ -59,7 +59,6 @@ describe('AbortController', () => { it('should not be callable', () => { expect(() => { // $FlowExpectedError[prop-missing] - // $FlowExpectedError[constructor-as-function] AbortController(); }).toThrow('Cannot call a class as a function'); }); @@ -76,7 +75,6 @@ describe('AbortController', () => { }); it('should be stringified as [object AbortController]', () => { - // $FlowExpectedError[method-unbinding] /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ expect(Object.prototype.toString.call(controller)).toBe( @@ -147,7 +145,6 @@ describe('AbortController', () => { }); it("should have 'onabort' property which is null by default", () => { - // $FlowExpectedError[prop-missing] expect(signal.onabort).toBe(null); }); @@ -168,7 +165,6 @@ describe('AbortController', () => { }); it('should be stringified as [object AbortSignal]', () => { - // $FlowExpectedError[method-unbinding] /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ expect(Object.prototype.toString.call(signal)).toBe( @@ -188,7 +184,6 @@ describe('AbortController', () => { const reason = controller.signal.reason; expect(reason).toBeInstanceOf(DOMException); - //$FlowExpectedError[incompatible-type] const domException: DOMException = reason; expect(domException.name).toBe('AbortError'); expect(domException.message).toBe('signal is aborted without reason'); @@ -245,8 +240,6 @@ describe('AbortController', () => { it("should fire 'abort' event on 'signal' (onabort)", () => { const listener = createListener(); - // $FlowExpectedError[incompatible-type] - // $FlowExpectedError[prop-missing] controller.signal.onabort = listener; controller.abort(); @@ -266,7 +259,6 @@ describe('AbortController', () => { it("should throw a TypeError if 'this' is not an AbortController object", () => { expect(() => { - // $FlowExpectedError[method-unbinding] /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing * unsoundness in flow */ controller.abort.call({}); @@ -290,7 +282,6 @@ describe('AbortController', () => { it('should set a default AbortError reason when called without arguments', () => { const signal = AbortSignal.abort(); expect(signal.reason).toBeInstanceOf(DOMException); - //$FlowExpectedError[incompatible-type] const domException: DOMException = signal.reason; expect(domException.name).toBe('AbortError'); expect(domException.message).toBe('signal is aborted without reason'); @@ -433,7 +424,6 @@ describe('AbortController', () => { expect(signal.aborted).toBe(true); expect(signal.reason).toBeInstanceOf(DOMException); - // $FlowExpectedError[incompatible-type] const reason: DOMException = signal.reason; expect(reason.name).toBe('TimeoutError'); expect(reason.message).toBe('signal timed out'); @@ -453,14 +443,12 @@ describe('AbortSignal', () => { it('should not be callable', () => { expect(() => { // $FlowExpectedError[prop-missing] - // $FlowExpectedError[constructor-as-function] AbortSignal(); }).toThrow("Failed to construct 'AbortSignal': Illegal constructor"); }); it("should throw a TypeError when it's constructed directly", () => { expect(() => { - // $FlowExpectedError[cannot-new] // eslint-disable-next-line no-new new AbortSignal(); }).toThrow("Failed to construct 'AbortSignal': Illegal constructor"); diff --git a/packages/react-native/src/private/webapis/dom/events/EventTarget.js b/packages/react-native/src/private/webapis/dom/events/EventTarget.js index 00ec1a7b2eb8..31e5bfe17207 100644 --- a/packages/react-native/src/private/webapis/dom/events/EventTarget.js +++ b/packages/react-native/src/private/webapis/dom/events/EventTarget.js @@ -226,7 +226,6 @@ export default class EventTarget { * from the bubble pass — it cannot be derived from `event.eventPhase`, * which is `AT_TARGET` during both passes through the target node. */ - // $FlowExpectedError[unsupported-syntax] // $FlowFixMe[illegal-key] [EVENT_TARGET_GET_DECLARATIVE_LISTENER_KEY]( event: Event, @@ -475,7 +474,6 @@ function invokeListeners( try { if (typeof callback === 'function') { callback.call(eventTarget, event); - // $FlowExpectedError[method-unbinding] } else if (typeof callback.handleEvent === 'function') { callback.handleEvent(event); } diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js b/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js index 1bd1bee1025a..e054736bba45 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js @@ -30,25 +30,21 @@ describe('Event', () => { expect(Event.BUBBLING_PHASE).toBe(3); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] Event.NONE = 'NONE'; }).toThrow(); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] Event.CAPTURING_PHASE = 'CAPTURING_PHASE'; }).toThrow(); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] Event.AT_TARGET = 'AT_TARGET'; }).toThrow(); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] Event.BUBBLING_PHASE = 'BUBBLING_PHASE'; }).toThrow(); @@ -63,25 +59,21 @@ describe('Event', () => { expect(event.BUBBLING_PHASE).toBe(3); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] event.NONE = 'NONE'; }).toThrow(); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] event.CAPTURING_PHASE = 'CAPTURING_PHASE'; }).toThrow(); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] event.AT_TARGET = 'AT_TARGET'; }).toThrow(); expect(() => { - // $FlowExpectedError[incompatible-type] // $FlowExpectedError[cannot-write] event.BUBBLING_PHASE = 'BUBBLING_PHASE'; }).toThrow(); @@ -130,7 +122,6 @@ describe('Event', () => { }).not.toThrow(); expect(() => { - // $FlowExpectedError[incompatible-type] return new Event('custom', () => {}); }).not.toThrow(); }); diff --git a/packages/react-native/src/private/webapis/dom/events/internals/EventTargetInternals.js b/packages/react-native/src/private/webapis/dom/events/internals/EventTargetInternals.js index 8d2ace5f5c40..cf46c89e20b4 100644 --- a/packages/react-native/src/private/webapis/dom/events/internals/EventTargetInternals.js +++ b/packages/react-native/src/private/webapis/dom/events/internals/EventTargetInternals.js @@ -52,7 +52,6 @@ const EVENT_DISPATCH_PARENT_CACHE_KEY = Symbol( export function getEventTargetParent(target: EventTarget): EventTarget | null { // The slot is `undefined` until populated; a populated slot may hold // `null` (no parent), so check against `undefined` rather than nullishness. - // $FlowExpectedError[prop-missing] symbol-keyed slot const cached: EventTarget | null | void = // $FlowExpectedError[prop-missing] symbol-keyed slot target[EVENT_DISPATCH_PARENT_CACHE_KEY]; diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReactNativeDocument.js b/packages/react-native/src/private/webapis/dom/nodes/ReactNativeDocument.js index 7ecad0a58565..a9e3df6f7dc2 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReactNativeDocument.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReactNativeDocument.js @@ -148,5 +148,4 @@ export const ReactNativeDocument_public: typeof ReactNativeDocument = ); }; -// $FlowExpectedError[prop-missing] ReactNativeDocument_public.prototype = ReactNativeDocument.prototype; diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js b/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js index dfcfb73eafc4..58e2e302ace3 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReactNativeElement.js @@ -285,7 +285,6 @@ class ReactNativeElement extends ReadOnlyElement { // pre-resolved on the event during construction. Reading them directly // avoids the `getEventTypePropName(eventType, isCapture)` hash lookup per // ancestor per phase. - // $FlowExpectedError[unsupported-syntax] // $FlowFixMe[illegal-key] [EVENT_TARGET_GET_DECLARATIVE_LISTENER_KEY]( event: Event, @@ -353,7 +352,6 @@ export const ReactNativeElement_public: typeof ReactNativeElement = ); }; -// $FlowExpectedError[prop-missing] ReactNativeElement_public.prototype = ReactNativeElement.prototype; // The public imperative EventTarget API (`addEventListener`, diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js index 20fcfe94ce43..8edfefafc970 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js @@ -79,5 +79,4 @@ export const ReadOnlyCharacterData_public: typeof ReadOnlyCharacterData = ); }; -// $FlowExpectedError[prop-missing] ReadOnlyCharacterData_public.prototype = ReadOnlyCharacterData.prototype; diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js index 1502a6fa1874..cba362acb30a 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyElement.js @@ -252,5 +252,4 @@ export const ReadOnlyElement_public: typeof ReadOnlyElement = throw new TypeError("Failed to construct 'Element': Illegal constructor"); }; -// $FlowExpectedError[prop-missing] ReadOnlyElement_public.prototype = ReadOnlyElement.prototype; diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js index 4b439485a4cf..ae7d399c93c7 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyNode.js @@ -381,7 +381,6 @@ export const ReadOnlyNode_public: typeof ReadOnlyNode = throw new TypeError("Failed to construct 'Node': Illegal constructor"); }; -// $FlowExpectedError[prop-missing] ReadOnlyNode_public.prototype = ReadOnlyNode.prototype; // Copy static properties (ELEMENT_NODE, DOCUMENT_NODE, TEXT_NODE, // DOCUMENT_POSITION_*, etc.) so that callers accessing them via the public diff --git a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js index 53c50d443d8b..661eb5b0089f 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js +++ b/packages/react-native/src/private/webapis/dom/nodes/ReadOnlyText.js @@ -38,7 +38,6 @@ export const ReadOnlyText_public: typeof ReadOnlyText = ); }; -// $FlowExpectedError[prop-missing] ReadOnlyText_public.prototype = ReadOnlyText.prototype; // The public imperative EventTarget API (`addEventListener`, diff --git a/packages/react-native/src/private/webapis/dom/nodes/internals/NodeInternals.js b/packages/react-native/src/private/webapis/dom/nodes/internals/NodeInternals.js index c175e7529d87..a987949873cf 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/internals/NodeInternals.js +++ b/packages/react-native/src/private/webapis/dom/nodes/internals/NodeInternals.js @@ -98,7 +98,6 @@ export function getPublicInstanceFromInstanceHandle( getPublicInstanceFromInternalInstanceHandle(instanceHandle); if (mixedPublicInstance != null) { - // $FlowExpectedError[incompatible-type] React defines public instances as "mixed" because it can't access the definition from React Native. return mixedPublicInstance; } diff --git a/packages/react-native/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js b/packages/react-native/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js index b0c291658f22..8e1c8ac8292b 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +++ b/packages/react-native/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js @@ -37,7 +37,6 @@ export function getPublicInstanceFromReactNativeDocumentInstanceHandle( export function isReactNativeDocumentInstanceHandle( instanceHandle: unknown, - // $FlowExpectedError[incompatible-type-guard] ): instanceHandle is ReactNativeDocumentInstanceHandle { // $FlowFixMe[incompatible-type-guard] return typeof instanceHandle === 'number' && instanceHandle % 10 === 1; diff --git a/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js b/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js index 031d7374f5a6..bb3382c11fcc 100644 --- a/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +++ b/packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js @@ -94,5 +94,4 @@ export const HTMLCollection_public: typeof HTMLCollection = ); }; -// $FlowExpectedError[prop-missing] HTMLCollection_public.prototype = HTMLCollection.prototype; diff --git a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js index a97c0720e856..7c36b3a087f4 100644 --- a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js +++ b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js @@ -114,5 +114,4 @@ export const NodeList_public: typeof NodeList = throw new TypeError("Failed to construct 'NodeList': Illegal constructor"); }; -// $FlowExpectedError[prop-missing] NodeList_public.prototype = NodeList.prototype; diff --git a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow index 5cfd71026f79..e00b9945c47a 100644 --- a/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow +++ b/packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js.flow @@ -13,11 +13,9 @@ import type {ArrayLike} from '../../utils/ArrayLikeUtils'; declare export default class NodeList implements Iterable, ArrayLike { // This property should've been read-only as well, but Flow doesn't handle // read-only indexers correctly (thinks reads are writes and fails). - // $FlowFixMe[incompatible-variance] [index: number]: T; readonly length: number; item(index: number): T | null; - // $FlowFixMe[incompatible-variance] entries(): IteratorObject<[number, T]>; forEach( callbackFn: (value: T, index: number, array: NodeList) => unknown, diff --git a/packages/react-native/src/private/webapis/geometry/DOMRectList.js b/packages/react-native/src/private/webapis/geometry/DOMRectList.js index 88dd4eabbc64..cd0a6d4575f7 100644 --- a/packages/react-native/src/private/webapis/geometry/DOMRectList.js +++ b/packages/react-native/src/private/webapis/geometry/DOMRectList.js @@ -85,5 +85,4 @@ export const DOMRectList_public: typeof DOMRectList = ); }; -// $FlowExpectedError[prop-missing] DOMRectList_public.prototype = DOMRectList.prototype; diff --git a/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js b/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js index 2b7bfacfeb32..3f24a96fa35d 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js @@ -178,6 +178,5 @@ export const IntersectionObserverEntry_public: typeof IntersectionObserverEntry ); }; -// $FlowExpectedError[prop-missing] IntersectionObserverEntry_public.prototype = IntersectionObserverEntry.prototype; diff --git a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js index 31304cb2c340..69acd39ec09b 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js @@ -81,17 +81,14 @@ describe('IntersectionObserver', () => { it('should accept valid `rootMargin` values', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, {rootMargin: '10px'}); }).not.toThrow(); expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, {rootMargin: '10px 20px'}); }).not.toThrow(); expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, { rootMargin: '10px 20px 30px 40px', }); @@ -100,13 +97,11 @@ describe('IntersectionObserver', () => { describe('rootMargin', () => { it('should parse single value rootMargin', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, {rootMargin: '10px'}); expect(observer.rootMargin).toBe('10px 10px 10px 10px'); }); it('should parse two value rootMargin', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, { rootMargin: '10px 20px', }); @@ -114,7 +109,6 @@ describe('IntersectionObserver', () => { }); it('should parse three value rootMargin', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, { rootMargin: '10px 20px 30px', }); @@ -122,7 +116,6 @@ describe('IntersectionObserver', () => { }); it('should parse four value rootMargin', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, { rootMargin: '10px 20px 30px 40px', }); @@ -130,7 +123,6 @@ describe('IntersectionObserver', () => { }); it('should handle negative rootMargin values', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, { rootMargin: '-10px -20px', }); @@ -138,7 +130,6 @@ describe('IntersectionObserver', () => { }); it('should handle percentage rootMargin values', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, { rootMargin: '10% 20%', }); @@ -152,7 +143,6 @@ describe('IntersectionObserver', () => { }); it('should default to "0px 0px 0px 0px" when rootMargin is undefined', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, { rootMargin: undefined, }); @@ -160,7 +150,6 @@ describe('IntersectionObserver', () => { }); it('should default to "0px 0px 0px 0px" when rootMargin is empty string', () => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. observer = new IntersectionObserver(() => {}, {rootMargin: ''}); expect(observer.rootMargin).toBe('0px 0px 0px 0px'); }); @@ -169,7 +158,6 @@ describe('IntersectionObserver', () => { describe('parsing failures', () => { it('should throw when rootMargin is not a string', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. // $FlowExpectedError[incompatible-type] return new IntersectionObserver(() => {}, {rootMargin: 123}); }).toThrow( @@ -179,7 +167,6 @@ describe('IntersectionObserver', () => { it('should throw when rootMargin has too many values', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, { rootMargin: '10px 20px 30px 40px 50px', }); @@ -190,7 +177,6 @@ describe('IntersectionObserver', () => { it('should throw when rootMargin value is missing unit', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, {rootMargin: '10'}); }).toThrow( "Failed to construct 'IntersectionObserver': Failed to parse rootMargin: '10' is not a valid length. Only 'px' and '%' units are allowed.", @@ -199,7 +185,6 @@ describe('IntersectionObserver', () => { it('should throw when rootMargin value has invalid unit', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, {rootMargin: '10em'}); }).toThrow( "Failed to construct 'IntersectionObserver': Failed to parse rootMargin: '10em' is not a valid length. Only 'px' and '%' units are allowed.", @@ -208,7 +193,6 @@ describe('IntersectionObserver', () => { it('should throw when rootMargin value has invalid format', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, { rootMargin: 'invalid', }); @@ -219,7 +203,6 @@ describe('IntersectionObserver', () => { it('should throw when rootMargin has mixed valid and invalid values', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, { rootMargin: '10px invalid', }); @@ -230,7 +213,6 @@ describe('IntersectionObserver', () => { it('should throw when rootMargin value is only a unit', () => { expect(() => { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. return new IntersectionObserver(() => {}, {rootMargin: 'px'}); }).toThrow( "Failed to construct 'IntersectionObserver': Failed to parse rootMargin: 'px' is not a valid length. Only 'px' and '%' units are allowed.", @@ -355,7 +337,6 @@ describe('IntersectionObserver', () => { it('should throw if rnRootThreshold is set to an invalid value', () => { expect(() => { return new IntersectionObserver(() => {}, { - // $FlowExpectedError[incompatible-call] rnRootThreshold: 2, }); }).toThrow( @@ -477,7 +458,6 @@ describe('IntersectionObserver', () => { describe('unsupported options', () => { it('should throw if `delay` option is specified', () => { expect(() => { - // $FlowExpectedError[prop-missing] delay is not defined in Flow. return new IntersectionObserver(() => {}, {delay: 100}); }).toThrow( "Failed to construct 'IntersectionObserver': The 'delay' option is not supported.", @@ -486,7 +466,6 @@ describe('IntersectionObserver', () => { it('should throw if `scrollMargin` option is specified', () => { expect(() => { - // $FlowExpectedError[prop-missing] scrollMargin is not defined in Flow. return new IntersectionObserver(() => {}, {scrollMargin: '10px'}); }).toThrow( "Failed to construct 'IntersectionObserver': The 'scrollMargin' option is not supported.", @@ -495,7 +474,6 @@ describe('IntersectionObserver', () => { it('should throw if `trackVisibility` option is specified', () => { expect(() => { - // $FlowExpectedError[prop-missing] trackVisibility is not defined in Flow. return new IntersectionObserver(() => {}, {trackVisibility: true}); }).toThrow( "Failed to construct 'IntersectionObserver': The 'trackVisibility' option is not supported.", @@ -504,7 +482,6 @@ describe('IntersectionObserver', () => { it('should throw if `delay` option is set to undefined explicitly', () => { expect(() => { - // $FlowExpectedError[prop-missing] delay is not defined in Flow. return new IntersectionObserver(() => {}, {delay: undefined}); }).toThrow( "Failed to construct 'IntersectionObserver': The 'delay' option is not supported.", @@ -513,7 +490,6 @@ describe('IntersectionObserver', () => { it('should throw if `scrollMargin` option is set to null explicitly', () => { expect(() => { - // $FlowExpectedError[prop-missing] scrollMargin is not defined in Flow. return new IntersectionObserver(() => {}, {scrollMargin: null}); }).toThrow( "Failed to construct 'IntersectionObserver': The 'scrollMargin' option is not supported.", @@ -531,7 +507,6 @@ describe('IntersectionObserver', () => { it('should throw if multiple unsupported options are specified', () => { expect(() => { - // $FlowExpectedError[prop-missing] delay and trackVisibility are not defined in Flow. return new IntersectionObserver(() => {}, { delay: 100, trackVisibility: true, @@ -1771,7 +1746,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px', }); observer.observe(node); @@ -1833,7 +1807,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: rootNode, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px 0px 0px 0px', threshold: 1, }); @@ -1892,7 +1865,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px', threshold: 1, rnRootThreshold: 0.5, @@ -1960,7 +1932,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px', root: rootNode, threshold: 1, @@ -2024,7 +1995,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px', threshold: 1, }); @@ -2083,7 +2053,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px', threshold: 0.5, }); @@ -2142,7 +2111,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px', }); observer.observe(node); @@ -2204,7 +2172,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: scrollNode, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '0px 0px 100px 0px', }); observer.observe(node); @@ -2249,7 +2216,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: scrollNode, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-50px', }); observer.observe(node); @@ -2310,7 +2276,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: customRoot, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-40px', threshold: 0.3, }); @@ -2369,7 +2334,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-50px', }); observer.observe(node); @@ -2425,7 +2389,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-100px', }); observer.observe(node); @@ -2484,7 +2447,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-100px 0px 0px 0px', threshold: 1, }); @@ -2543,7 +2505,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-150px', }); observer.observe(node); @@ -2605,7 +2566,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: rootNode, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-50px', }); observer.observe(node); @@ -2667,7 +2627,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: scrollNode, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-50px', }); observer.observe(node); @@ -2728,7 +2687,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '5%', }); observer.observe(node); @@ -2782,7 +2740,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: scrollNode, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-25%', }); observer.observe(node); @@ -2840,7 +2797,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '10% 0px 0px 0px', }); observer.observe(node); @@ -2894,7 +2850,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '-10%', }); observer.observe(node); @@ -2943,7 +2898,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '50px', }); observer.observe(node); @@ -3914,7 +3868,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { root: scrollNode, - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '0px 0px 150px 0px', threshold: [0.01], }); @@ -3963,7 +3916,6 @@ describe('IntersectionObserver', () => { Fantom.runTask(() => { observer = new IntersectionObserver(intersectionObserverCallback, { - // $FlowExpectedError[prop-missing] rootMargin is not even defined in Flow. rootMargin: '0px 0px 150px 0px', threshold: [0.01], }); diff --git a/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js b/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js index a076b838251b..9cc2e0c6972f 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js +++ b/packages/react-native/src/private/webapis/mutationobserver/MutationObserver.js @@ -8,8 +8,6 @@ * @format */ -// flowlint unsafe-getters-setters:off - import type {MutationObserverId} from './internals/MutationObserverManager'; import type MutationRecord from './MutationRecord'; diff --git a/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js b/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js index d440c95c7177..f109f840c990 100644 --- a/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js +++ b/packages/react-native/src/private/webapis/mutationobserver/MutationRecord.js @@ -93,5 +93,4 @@ export const MutationRecord_public: typeof MutationRecord = ); }; -// $FlowExpectedError[prop-missing] MutationRecord_public.prototype = MutationRecord.prototype; diff --git a/packages/react-native/src/private/webapis/performance/EventTiming.js b/packages/react-native/src/private/webapis/performance/EventTiming.js index 9b43060f84b4..d41d5dbf80d7 100644 --- a/packages/react-native/src/private/webapis/performance/EventTiming.js +++ b/packages/react-native/src/private/webapis/performance/EventTiming.js @@ -76,7 +76,6 @@ export const PerformanceEventTiming_public: typeof PerformanceEventTiming = ); }; -// $FlowExpectedError[prop-missing] PerformanceEventTiming_public.prototype = PerformanceEventTiming.prototype; type EventCountsForEachCallbackType = @@ -97,7 +96,6 @@ function getCachedEventCounts(): Map { ); cachedEventCounts = eventCounts; - // $FlowFixMe[incompatible-type] global.queueMicrotask(() => { // To be consistent with the calls to the API from the same task, // but also not to refetch the data from native too often, @@ -153,5 +151,4 @@ export const EventCounts_public: typeof EventCounts = ); }; -// $FlowExpectedError[prop-missing] EventCounts_public.prototype = EventCounts.prototype; diff --git a/packages/react-native/src/private/webapis/performance/LongTasks.js b/packages/react-native/src/private/webapis/performance/LongTasks.js index 2238444db5fb..2cd4d678bb9c 100644 --- a/packages/react-native/src/private/webapis/performance/LongTasks.js +++ b/packages/react-native/src/private/webapis/performance/LongTasks.js @@ -33,7 +33,6 @@ export const TaskAttributionTiming_public: typeof TaskAttributionTiming = ); }; -// $FlowExpectedError[prop-missing] TaskAttributionTiming_public.prototype = TaskAttributionTiming.prototype; const EMPTY_ATTRIBUTION: ReadonlyArray = @@ -67,6 +66,5 @@ export const PerformanceLongTaskTiming_public: typeof PerformanceLongTaskTiming ); }; -// $FlowExpectedError[prop-missing] PerformanceLongTaskTiming_public.prototype = PerformanceLongTaskTiming.prototype; diff --git a/packages/react-native/src/private/webapis/performance/Performance.js b/packages/react-native/src/private/webapis/performance/Performance.js index e6f544475d3a..6f82642a24e5 100644 --- a/packages/react-native/src/private/webapis/performance/Performance.js +++ b/packages/react-native/src/private/webapis/performance/Performance.js @@ -459,7 +459,6 @@ export const Performance_public: typeof Performance = ); }; -// $FlowExpectedError[prop-missing] Performance_public.prototype = Performance.prototype; setPlatformObject(Performance); diff --git a/packages/react-native/src/private/webapis/performance/PerformanceEntry.js b/packages/react-native/src/private/webapis/performance/PerformanceEntry.js index aef916f4e7f1..c7bf34f87123 100644 --- a/packages/react-native/src/private/webapis/performance/PerformanceEntry.js +++ b/packages/react-native/src/private/webapis/performance/PerformanceEntry.js @@ -82,7 +82,6 @@ export const PerformanceEntry_public: typeof PerformanceEntry = ); }; -// $FlowExpectedError[prop-missing] PerformanceEntry_public.prototype = PerformanceEntry.prototype; setPlatformObject(PerformanceEntry); diff --git a/packages/react-native/src/private/webapis/performance/PerformanceObserver.js b/packages/react-native/src/private/webapis/performance/PerformanceObserver.js index f948ed6bdd1a..5414d2fbb936 100644 --- a/packages/react-native/src/private/webapis/performance/PerformanceObserver.js +++ b/packages/react-native/src/private/webapis/performance/PerformanceObserver.js @@ -64,7 +64,6 @@ export const PerformanceObserverEntryList_public: typeof PerformanceObserverEntr ); }; -// $FlowExpectedError[prop-missing] PerformanceObserverEntryList_public.prototype = PerformanceObserverEntryList.prototype; diff --git a/packages/react-native/src/private/webapis/performance/ResourceTiming.js b/packages/react-native/src/private/webapis/performance/ResourceTiming.js index 08a282666244..0421aa68a899 100644 --- a/packages/react-native/src/private/webapis/performance/ResourceTiming.js +++ b/packages/react-native/src/private/webapis/performance/ResourceTiming.js @@ -141,6 +141,5 @@ export const PerformanceResourceTiming_public: typeof PerformanceResourceTiming ); }; -// $FlowExpectedError[prop-missing] PerformanceResourceTiming_public.prototype = PerformanceResourceTiming.prototype; diff --git a/packages/react-native/src/private/webapis/performance/UserTiming.js b/packages/react-native/src/private/webapis/performance/UserTiming.js index f07b48c763bb..73a54e48c01d 100644 --- a/packages/react-native/src/private/webapis/performance/UserTiming.js +++ b/packages/react-native/src/private/webapis/performance/UserTiming.js @@ -81,7 +81,6 @@ export const PerformanceMark: typeof PerformanceMarkTemplate = this.__detail = markOptions?.detail ?? null; }; -// $FlowExpectedError[prop-missing] PerformanceMark.prototype = PerformanceMarkTemplate.prototype; class PerformanceMeasureTemplate extends PerformanceEntry { @@ -116,7 +115,6 @@ export const PerformanceMeasure: typeof PerformanceMeasureTemplate = this.__detail = init.detail ?? null; }; -// $FlowExpectedError[prop-missing] PerformanceMeasure.prototype = PerformanceMeasureTemplate.prototype; export const PerformanceMeasure_public: typeof PerformanceMeasure = @@ -128,5 +126,4 @@ export const PerformanceMeasure_public: typeof PerformanceMeasure = ); }; -// $FlowExpectedError[prop-missing] PerformanceMeasure_public.prototype = PerformanceMeasure.prototype; diff --git a/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js b/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js index 640abe48e8c9..21f737b61d4e 100644 --- a/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js +++ b/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js @@ -127,7 +127,6 @@ describe('PerformanceObserver', () => { const callback = jest.fn(); const observer = new PerformanceObserver(callback); - // $FlowExpectedError[incompatible-call] expect(() => observer.observe()).toThrow( "Failed to execute 'observe' on 'PerformanceObserver': 1 argument required, but only 0 present.", ); diff --git a/packages/react-native/src/private/webapis/resizeobserver/ResizeObserver.js b/packages/react-native/src/private/webapis/resizeobserver/ResizeObserver.js index d00f60594eb8..9394152830e7 100644 --- a/packages/react-native/src/private/webapis/resizeobserver/ResizeObserver.js +++ b/packages/react-native/src/private/webapis/resizeobserver/ResizeObserver.js @@ -8,8 +8,6 @@ * @format */ -// flowlint unsafe-getters-setters:off - import type {ResizeObserverId} from './internals/ResizeObserverManager'; import type ResizeObserverEntry from './ResizeObserverEntry'; diff --git a/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverEntry.js b/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverEntry.js index ee38952fa988..fcfee9aebbd0 100644 --- a/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverEntry.js +++ b/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverEntry.js @@ -142,5 +142,4 @@ export const ResizeObserverEntry_public: typeof ResizeObserverEntry = ); }; -// $FlowExpectedError[prop-missing] ResizeObserverEntry_public.prototype = ResizeObserverEntry.prototype; diff --git a/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverSize.js b/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverSize.js index b38a6c36a510..9ad70b9fbed2 100644 --- a/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverSize.js +++ b/packages/react-native/src/private/webapis/resizeobserver/ResizeObserverSize.js @@ -66,5 +66,4 @@ export const ResizeObserverSize_public: typeof ResizeObserverSize = ); }; -// $FlowExpectedError[prop-missing] ResizeObserverSize_public.prototype = ResizeObserverSize.prototype; diff --git a/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js b/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js index f83c44c69b55..bed4b966279f 100644 --- a/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js +++ b/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js @@ -429,7 +429,6 @@ describe('structuredClone', () => { expect(clone.obj.arr[0]).toBe(clone.obj); expect(clone.map.get('key')).toBe(clone.map); // $FlowExpectedError[incompatible-type] - // $FlowExpectedError[prop-missing] expect([...clone.map.get('set')][0]).toBe(clone.map); }); @@ -498,7 +497,6 @@ describe('structuredClone', () => { }); it('does NOT clone PerformanceEntry', () => { - // $FlowExpectedError[prop-missing] expectDataCloneError(() => structuredClone(performance.mark('foo'))); }); diff --git a/packages/react-native/src/private/webapis/structuredClone/structuredClone.js b/packages/react-native/src/private/webapis/structuredClone/structuredClone.js index 820534ef2a57..5f178f101562 100644 --- a/packages/react-native/src/private/webapis/structuredClone/structuredClone.js +++ b/packages/react-native/src/private/webapis/structuredClone/structuredClone.js @@ -81,7 +81,6 @@ function structuredCloneInternal(value: unknown): unknown { } // Simple object fast path - // $FlowFixMe[prop-missing] Why doesn't Flow know about Object.prototype? if (Object.getPrototypeOf(value) === ObjectPrototype) { const result = {}; memory.set(value, result); @@ -392,7 +391,6 @@ function createErrorClone(value: Error): Error { } function isNonSerializableObject(obj: T): boolean { - // $FlowExpectedError[invalid-in-lhs] return NON_SERIALIZABLE_OBJECT_KEY in obj; } diff --git a/packages/react-native/src/private/webapis/webidl/PlatformObjects.js b/packages/react-native/src/private/webapis/webidl/PlatformObjects.js index 961c910f7b5b..b331b12151ba 100644 --- a/packages/react-native/src/private/webapis/webidl/PlatformObjects.js +++ b/packages/react-native/src/private/webapis/webidl/PlatformObjects.js @@ -44,7 +44,6 @@ export const setPlatformObject: (( * Indicates if the given object is a platform object. */ export function isPlatformObject(obj: T): boolean { - // $FlowExpectedError[invalid-in-lhs] return IS_PLATFORM_OBJECT_KEY in obj; } diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeView.js b/packages/rn-tester/NativeComponentExample/js/MyNativeView.js index 198ade0266fb..781fb869a115 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyNativeView.js +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeView.js @@ -183,7 +183,6 @@ export default function MyNativeView(props: {}): React.Node { currentBGColor + 1 >= colors.length ? 0 : currentBGColor + 1; let newColor = colors[nextBGColor]; RNTMyNativeViewCommands.callNativeMethodToChangeBackgroundColor( - // $FlowFixMe[incompatible-type] ref.current, newColor, ); @@ -215,7 +214,6 @@ export default function MyNativeView(props: {}): React.Node { colors[(randomColorId + 1) % 5], ]; RNTMyNativeViewCommands.callNativeMethodToAddOverlays( - // $FlowFixMe[incompatible-type] ref.current, overlayColors, ); @@ -226,7 +224,6 @@ export default function MyNativeView(props: {}): React.Node { title="Remove Overlays" onPress={() => { RNTMyNativeViewCommands.callNativeMethodToRemoveOverlays( - // $FlowFixMe[incompatible-type] ref.current, ); callNativeMethodToRemoveOverlays(legacyRef.current); @@ -248,7 +245,6 @@ export default function MyNativeView(props: {}): React.Node { if (containerRef.current) { legacyRef.current?.measureLayout( - // $FlowFixMe[incompatible-call] containerRef.current, (x, y, width, height) => { setLegacyMeasureLayout({x, y, width, height}); @@ -286,10 +282,7 @@ export default function MyNativeView(props: {}): React.Node {