Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ describe('AnimatedValue', () => {
// $FlowFixMe[method-unbinding]
const original = node.__onAnimatedValueUpdateReceived;
const spy = jest.fn((...args: Array<unknown>) =>
/* $FlowFixMe[invalid-this-arg] Error exposed after fixing this typing
* unsoundness in flow */
original.apply(node, args),
);
// $FlowFixMe[cannot-write]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,8 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
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,
);
Expand All @@ -1077,6 +1079,8 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
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,
);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ class Modal extends React.Component<ModalProps, ModalState> {
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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function deepFreezeAndThrowOnMutationInDev<T extends {...} | Array<unknown>>(

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]),
Expand All @@ -64,6 +66,8 @@ function deepFreezeAndThrowOnMutationInDev<T extends {...} | Array<unknown>>(

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]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ const rejectionTrackingOptions: NonNullable<Parameters<enable>[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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -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);
};

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
);
Expand Down Expand Up @@ -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]',
);
Expand Down Expand Up @@ -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",
Expand Down
26 changes: 26 additions & 0 deletions packages/rn-tester/IntegrationTests/TimersTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,45 +99,65 @@ class TimersTest extends React.Component<Props, State> {

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);
}

Expand All @@ -151,6 +171,8 @@ class TimersTest extends React.Component<Props, State> {
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);
}

Expand All @@ -169,6 +191,8 @@ class TimersTest extends React.Component<Props, State> {
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);
}

Expand Down Expand Up @@ -205,6 +229,8 @@ class TimersTest extends React.Component<Props, State> {
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ async function stopMetroServer(metroServer: MetroServer): Promise<void> {

// $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();
}

const timeout = new Promise<void>(resolve => {
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();
Expand Down
10 changes: 10 additions & 0 deletions private/react-native-fantom/runtime/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions private/react-native-fantom/runtime/patchWeakRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
4 changes: 4 additions & 0 deletions private/react-native-fantom/src/__tests__/expect-itest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand All @@ -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;
});
Expand Down
Loading