diff --git a/packages/dev-middleware/src/inspector-proxy/Device.js b/packages/dev-middleware/src/inspector-proxy/Device.js index 9239f04ed94a..9c23bb37bcc2 100644 --- a/packages/dev-middleware/src/inspector-proxy/Device.js +++ b/packages/dev-middleware/src/inspector-proxy/Device.js @@ -500,6 +500,8 @@ export default class Device { // $FlowFixMe[cannot-write] socket.send = function (message: string) { cdpDebugLogging.log('ProxyToDebugger', message); + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ return sendFunc.call(socket, message); }; } diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js index b0781d4f865e..ae6d0bedeeb7 100644 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js @@ -237,6 +237,8 @@ describe('AnimatedValue', () => { // $FlowFixMe[method-unbinding] const original = node.__onAnimatedValueUpdateReceived; const spy = jest.fn((...args: Array) => + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ original.apply(node, args), ); // $FlowFixMe[cannot-write] diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js index 6581c150f437..7f32383b9ea8 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js @@ -384,4 +384,6 @@ export default class AnimatedProps extends AnimatedNode { 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 3b04b8ba2835..90774a682df9 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js @@ -255,4 +255,6 @@ export default class AnimatedStyle extends AnimatedWithChildren { 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/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index 26b01e15f3eb..5c7974f2ac30 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -1069,6 +1069,8 @@ class ScrollView extends React.Component { 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, this._inputMeasureAndScrollToKeyboard, ); @@ -1077,6 +1079,8 @@ class ScrollView extends React.Component { 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, ); } diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index e011fc20763e..66a9343eaa87 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -339,6 +339,8 @@ class Modal extends React.Component { 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} supportedOrientations={this.props.supportedOrientations} onOrientationChange={this.props.onOrientationChange} diff --git a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js index 7e7b6b04a84d..1005f39f5630 100644 --- a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +++ b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js @@ -49,6 +49,8 @@ function deepFreezeAndThrowOnMutationInDev>( for (let i = 0; i < keys.length; i++) { const key = keys[i]; + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ if (hasOwnProperty.call(object, key)) { Object.defineProperty(object, key, { get: identity.bind(null, object[key]), @@ -64,6 +66,8 @@ function deepFreezeAndThrowOnMutationInDev>( for (let i = 0; i < keys.length; i++) { const key = keys[i]; + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ if (hasOwnProperty.call(object, key)) { deepFreezeAndThrowOnMutationInDev(object[key]); } diff --git a/packages/react-native/Libraries/promiseRejectionTrackingOptions.js b/packages/react-native/Libraries/promiseRejectionTrackingOptions.js index 95fcf1c093d0..bfabef58c8fd 100644 --- a/packages/react-native/Libraries/promiseRejectionTrackingOptions.js +++ b/packages/react-native/Libraries/promiseRejectionTrackingOptions.js @@ -28,9 +28,13 @@ const rejectionTrackingOptions: NonNullable[0]> = { 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); } else { try { diff --git a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js index f6657e021e37..dd02b3bef015 100644 --- a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js +++ b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js @@ -357,4 +357,6 @@ function areCompositeKeyComponentsEqual( 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 c2c85723c169..24754c94c70e 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js @@ -122,6 +122,8 @@ const XHRInterceptor = { if (openCallback) { openCallback(method, url, this); } + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ originalXHROpen.apply(this, arguments); }; @@ -136,6 +138,8 @@ const XHRInterceptor = { if (requestHeaderCallback) { requestHeaderCallback(header, value, this); } + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ originalXHRSetRequestHeader.apply(this, arguments); }; @@ -190,6 +194,8 @@ const XHRInterceptor = { false, ); } + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ originalXHRSend.apply(this, arguments); }; isInterceptorEnabled = true; 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 f18a34f45997..e13929b45ee0 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 @@ -81,6 +81,8 @@ 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( '[object AbortController]', ); @@ -171,6 +173,8 @@ 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( '[object AbortSignal]', ); @@ -267,6 +271,8 @@ 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({}); }).toThrow( "Expected 'this' to be an 'AbortController' object, but got object", diff --git a/packages/rn-tester/IntegrationTests/TimersTest.js b/packages/rn-tester/IntegrationTests/TimersTest.js index 1e8b608821e9..b18ce45505ce 100644 --- a/packages/rn-tester/IntegrationTests/TimersTest.js +++ b/packages/rn-tester/IntegrationTests/TimersTest.js @@ -99,45 +99,65 @@ class TimersTest extends React.Component { componentDidMount() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setTimeout(this.testSetTimeout0, 1000); } testSetTimeout0() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setTimeout(this.testSetTimeout1, 0); } testSetTimeout1() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setTimeout(this.testSetTimeout50, 1); } testSetTimeout50() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setTimeout(this.testRequestAnimationFrame, 50); } testRequestAnimationFrame() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.requestAnimationFrame(this.testSetInterval0); } testSetInterval0() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this._nextTest = this.testSetInterval20; // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this._interval = this.setInterval(this._incrementInterval, 0); } testSetInterval20() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this._nextTest = this.testSetImmediate; // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this._interval = this.setInterval(this._incrementInterval, 20); } testSetImmediate() { // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setImmediate(this.testClearTimeout0); } @@ -151,6 +171,8 @@ class TimersTest extends React.Component { const timeout = this.setTimeout(() => this._fail('testClearTimeout30'), 30); this.clearTimeout(timeout); // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setTimeout(this.testClearMulti, 50); } @@ -169,6 +191,8 @@ class TimersTest extends React.Component { this.setTimeout(() => this.clearTimeout(delayClear), 20); // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setTimeout(this.testOrdering, 50); } @@ -205,6 +229,8 @@ class TimersTest extends React.Component { 25, ); // $FlowFixMe[method-unbinding] added when improving typing for this parameters + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ this.setTimeout(this.done, 50); } diff --git a/private/react-native-fantom/runner/global-setup/globalTeardown.js b/private/react-native-fantom/runner/global-setup/globalTeardown.js index 566f137677c3..cea77bda3fb9 100644 --- a/private/react-native-fantom/runner/global-setup/globalTeardown.js +++ b/private/react-native-fantom/runner/global-setup/globalTeardown.js @@ -50,6 +50,8 @@ async function stopMetroServer(metroServer: MetroServer): Promise { // $FlowFixMe[method-unbinding] Node 18.2+ API if (typeof metroServer.closeIdleConnections === 'function') { + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ metroServer.closeIdleConnections(); } @@ -57,6 +59,8 @@ async function stopMetroServer(metroServer: MetroServer): Promise { setTimeout(() => { // $FlowFixMe[method-unbinding] Node 18.2+ API if (typeof metroServer.closeAllConnections === 'function') { + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ metroServer.closeAllConnections(); } resolve(); diff --git a/private/react-native-fantom/runtime/expect.js b/private/react-native-fantom/runtime/expect.js index 16c78002eb9e..dbbbdbcd8b05 100644 --- a/private/react-native-fantom/runtime/expect.js +++ b/private/react-native-fantom/runtime/expect.js @@ -580,14 +580,24 @@ class Expect { * will not be added to the prototype. */ // $FlowExpectedError[method-unbinding] +/* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ Expect.prototype.toBeCalled = Expect.prototype.toHaveBeenCalled; // $FlowExpectedError[method-unbinding] +/* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ Expect.prototype.toBeCalledTimes = Expect.prototype.toHaveBeenCalledTimes; // $FlowExpectedError[method-unbinding] +/* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ Expect.prototype.toBeCalledWith = Expect.prototype.toHaveBeenCalledWith; // $FlowExpectedError[method-unbinding] +/* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ Expect.prototype.lastCalledWith = Expect.prototype.toHaveBeenLastCalledWith; // $FlowExpectedError[method-unbinding] +/* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ Expect.prototype.nthCalledWith = Expect.prototype.toHaveBeenNthCalledWith; const expect: unknown => Expect = (received: unknown) => new Expect(received); diff --git a/private/react-native-fantom/runtime/patchWeakRef.js b/private/react-native-fantom/runtime/patchWeakRef.js index 63a6842e63ba..61191479f8be 100644 --- a/private/react-native-fantom/runtime/patchWeakRef.js +++ b/private/react-native-fantom/runtime/patchWeakRef.js @@ -38,6 +38,8 @@ export default function patchWeakRef(): void { ); } + /* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing + * unsoundness in flow */ return originalDeref.call(this); }; diff --git a/private/react-native-fantom/src/__tests__/expect-itest.js b/private/react-native-fantom/src/__tests__/expect-itest.js index 3bc828363a53..c802ef0cccd1 100644 --- a/private/react-native-fantom/src/__tests__/expect-itest.js +++ b/private/react-native-fantom/src/__tests__/expect-itest.js @@ -545,6 +545,8 @@ describe('expect', () => { }); it('tracks execution of methods with an implementation', () => { + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ const fn = jest.fn(function (this: {prop: number}): number { return this.prop; }); @@ -569,6 +571,8 @@ describe('expect', () => { }); it('tracks constructors with an implementation', () => { + /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing + * unsoundness in flow */ const fn = jest.fn(function (this: {prop: number}) { this.prop = 3; });