Skip to content

Commit 9f8a98a

Browse files
committed
Flow upgrade to 0.153
- method unbinding is no longer supported in Flow for soundness, this added a bunch of suppressions - Flow now prevents objects to be supertypes of interfaces/classes ghstack-source-id: d7749cb Pull Request resolved: #25412
1 parent adb58f5 commit 9f8a98a

File tree

52 files changed

+110
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+110
-38
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
6464
"fbjs-scripts": "1.2.0",
6565
"filesize": "^6.0.1",
66-
"flow-bin": "^0.152.0",
66+
"flow-bin": "^0.153.0",
6767
"glob": "^7.1.6",
6868
"glob-stream": "^6.1.0",
6969
"google-closure-compiler": "^20200517.0.0",

packages/jest-react/src/internalAct.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
7272
if (
7373
typeof result === 'object' &&
7474
result !== null &&
75+
// $FlowFixMe[method-unbinding]
7576
typeof result.then === 'function'
7677
) {
7778
const thenableResult: Thenable<T> = (result: any);

packages/react-cache/src/ReactCacheOld.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import * as React from 'react';
1313

1414
import {createLRU} from './LRU';
1515

16-
type Suspender = {then(resolve: () => mixed, reject: () => mixed): mixed, ...};
16+
interface Suspender {
17+
then(resolve: () => mixed, reject: () => mixed): mixed;
18+
}
1719

1820
type PendingResult = {
1921
status: 0,
@@ -120,6 +122,7 @@ function accessResult<I, K, V>(
120122
);
121123
const newResult: PendingResult = {
122124
status: Pending,
125+
// $FlowFixMe[method-unbinding]
123126
value: thenable,
124127
};
125128
// $FlowFixMe[escaped-generic] discovered when updating Flow

packages/react-devtools-shared/src/PerformanceLoggingUtils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ import {__PERFORMANCE_PROFILE__} from './constants';
1111

1212
const supportsUserTiming =
1313
typeof performance !== 'undefined' &&
14+
// $FlowFixMe[method-unbinding]
1415
typeof performance.mark === 'function' &&
16+
// $FlowFixMe[method-unbinding]
1517
typeof performance.clearMarks === 'function';
1618

1719
const supportsPerformanceNow =
20+
// $FlowFixMe[method-unbinding]
1821
typeof performance !== 'undefined' && typeof performance.now === 'function';
1922

2023
function mark(markName: string): void {

packages/react-devtools-shared/src/backend/profilingHooks.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ let performanceTarget: Performance | null = null;
4444
// If performance exists and supports the subset of the User Timing API that we require.
4545
let supportsUserTiming =
4646
typeof performance !== 'undefined' &&
47+
// $FlowFixMe[method-unbinding]
4748
typeof performance.mark === 'function' &&
49+
// $FlowFixMe[method-unbinding]
4850
typeof performance.clearMarks === 'function';
4951

5052
let supportsUserTimingV3 = false;
@@ -76,6 +78,7 @@ if (supportsUserTimingV3) {
7678

7779
// Some environments (e.g. React Native / Hermes) don't support the performance API yet.
7880
const getCurrentTime =
81+
// $FlowFixMe[method-unbinding]
7982
typeof performance === 'object' && typeof performance.now === 'function'
8083
? () => performance.now()
8184
: () => Date.now();

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function getFiberFlags(fiber: Fiber): number {
151151

152152
// Some environments (e.g. React Native / Hermes) don't support the performance API yet.
153153
const getCurrentTime =
154+
// $FlowFixMe[method-unbinding]
154155
typeof performance === 'object' && typeof performance.now === 'function'
155156
? () => performance.now()
156157
: () => Date.now();

packages/react-devtools-shared/src/backend/views/Highlighter/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export default function setupHighlighter(
115115

116116
if (nodes != null && nodes[0] != null) {
117117
const node = nodes[0];
118+
// $FlowFixMe[method-unbinding]
118119
if (scrollIntoView && typeof node.scrollIntoView === 'function') {
119120
// If the node isn't visible show it before highlighting it.
120121
// We may want to reconsider this; it might be a little disruptive.

packages/react-devtools-shared/src/backend/views/TraceUpdates/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const REMEASUREMENT_AFTER_DURATION = 250;
2626

2727
// Some environments (e.g. React Native / Hermes) don't support the performance API yet.
2828
const getCurrentTime =
29+
// $FlowFixMe[method-unbinding]
2930
typeof performance === 'object' && typeof performance.now === 'function'
3031
? () => performance.now()
3132
: () => Date.now();

packages/react-devtools-shared/src/backend/views/utils.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
* @flow
88
*/
99

10-
export type Rect = {
11-
bottom: number,
12-
height: number,
13-
left: number,
14-
right: number,
15-
top: number,
16-
width: number,
17-
...
18-
};
10+
export interface Rect {
11+
bottom: number;
12+
height: number;
13+
left: number;
14+
right: number;
15+
top: number;
16+
width: number;
17+
}
1918

2019
// Get the window object for the document that a node belongs to,
2120
// or return null if it cannot be found (node not attached to DOM,

packages/react-devtools-shared/src/devtools/cache.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import {createContext} from 'react';
2626

2727
export type {Thenable};
2828

29-
type Suspender = {then(resolve: () => mixed, reject: () => mixed): mixed, ...};
29+
interface Suspender {
30+
then(resolve: () => mixed, reject: () => mixed): mixed;
31+
}
3032

3133
type PendingResult = {
3234
status: 0,
@@ -124,6 +126,7 @@ function accessResult<Input, Key, Value>(
124126
);
125127
const newResult: PendingResult = {
126128
status: Pending,
129+
// $FlowFixMe[method-unbinding]
127130
value: thenable,
128131
};
129132
entriesForResource.set(key, newResult);

0 commit comments

Comments
 (0)