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: d7749cbad8050874fa14d533442f110ad1d0209d Pull Request resolved: https://github.com/facebook/react/pull/25412
Jan Kassens committed
Oct 4, 2022 at 11:04 UTC
9f8a98a390bca3310cb80f536ba015446af19c3f
52 files changed
+110
-38
package.json
+1
-1
@@ -63,7 +63,7 @@
63
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
64
"fbjs-scripts": "1.2.0",
65
"filesize": "^6.0.1",
66
- "flow-bin": "^0.152.0",
66
+ "flow-bin": "^0.153.0",
67
"glob": "^7.1.6",
68
"glob-stream": "^6.1.0",
69
"google-closure-compiler": "^20200517.0.0",
packages/jest-react/src/internalAct.js
+1
@@ -72,6 +72,7 @@ export function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
72
if (
73
typeof result === 'object' &&
74
result !== null &&
75
+ // $FlowFixMe[method-unbinding]
76
typeof result.then === 'function'
77
) {
78
const thenableResult: Thenable<T> = (result: any);
packages/react-cache/src/ReactCacheOld.js
+4
-1
@@ -13,7 +13,9 @@ import * as React from 'react';
13
14
import {createLRU} from './LRU';
15
16
-type Suspender = {then(resolve: () => mixed, reject: () => mixed): mixed, ...};
16
+interface Suspender {
17
+ then(resolve: () => mixed, reject: () => mixed): mixed;
18
+}
19
20
type PendingResult = {
21
status: 0,
@@ -120,6 +122,7 @@ function accessResult<I, K, V>(
122
);
123
const newResult: PendingResult = {
124
status: Pending,
125
+ // $FlowFixMe[method-unbinding]
126
value: thenable,
127
};
128
// $FlowFixMe[escaped-generic] discovered when updating Flow
packages/react-devtools-shared/src/PerformanceLoggingUtils.js
+3
@@ -11,10 +11,13 @@ import {__PERFORMANCE_PROFILE__} from './constants';
11
12
const supportsUserTiming =
13
typeof performance !== 'undefined' &&
14
+ // $FlowFixMe[method-unbinding]
15
typeof performance.mark === 'function' &&
16
+ // $FlowFixMe[method-unbinding]
17
typeof performance.clearMarks === 'function';
18
19
const supportsPerformanceNow =
20
+ // $FlowFixMe[method-unbinding]
21
typeof performance !== 'undefined' && typeof performance.now === 'function';
22
23
function mark(markName: string): void {
packages/react-devtools-shared/src/backend/profilingHooks.js
+3
@@ -44,7 +44,9 @@ let performanceTarget: Performance | null = null;
44
// If performance exists and supports the subset of the User Timing API that we require.
45
let supportsUserTiming =
46
typeof performance !== 'undefined' &&
47
+ // $FlowFixMe[method-unbinding]
48
typeof performance.mark === 'function' &&
49
+ // $FlowFixMe[method-unbinding]
50
typeof performance.clearMarks === 'function';
51
52
let supportsUserTimingV3 = false;
@@ -76,6 +78,7 @@ if (supportsUserTimingV3) {
78
79
// Some environments (e.g. React Native / Hermes) don't support the performance API yet.
80
const getCurrentTime =
81
+ // $FlowFixMe[method-unbinding]
82
typeof performance === 'object' && typeof performance.now === 'function'
83
? () => performance.now()
84
: () => Date.now();
packages/react-devtools-shared/src/backend/renderer.js
+1
@@ -151,6 +151,7 @@ function getFiberFlags(fiber: Fiber): number {
151
152
// Some environments (e.g. React Native / Hermes) don't support the performance API yet.
153
const getCurrentTime =
154
+ // $FlowFixMe[method-unbinding]
155
typeof performance === 'object' && typeof performance.now === 'function'
156
? () => performance.now()
157
: () => Date.now();
packages/react-devtools-shared/src/backend/views/Highlighter/index.js
+1
@@ -115,6 +115,7 @@ export default function setupHighlighter(
115
116
if (nodes != null && nodes[0] != null) {
117
const node = nodes[0];
118
+ // $FlowFixMe[method-unbinding]
119
if (scrollIntoView && typeof node.scrollIntoView === 'function') {
120
// If the node isn't visible show it before highlighting it.
121
// We may want to reconsider this; it might be a little disruptive.
packages/react-devtools-shared/src/backend/views/TraceUpdates/index.js
+1
@@ -26,6 +26,7 @@ const REMEASUREMENT_AFTER_DURATION = 250;
26
27
// Some environments (e.g. React Native / Hermes) don't support the performance API yet.
28
const getCurrentTime =
29
+ // $FlowFixMe[method-unbinding]
30
typeof performance === 'object' && typeof performance.now === 'function'
31
? () => performance.now()
32
: () => Date.now();
packages/react-devtools-shared/src/backend/views/utils.js
+8
-9
@@ -7,15 +7,14 @@
7
* @flow
8
*/
9
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
+}
18
19
// Get the window object for the document that a node belongs to,
20
// or return null if it cannot be found (node not attached to DOM,
packages/react-devtools-shared/src/devtools/cache.js
+4
-1
@@ -26,7 +26,9 @@ import {createContext} from 'react';
26
27
export type {Thenable};
28
29
-type Suspender = {then(resolve: () => mixed, reject: () => mixed): mixed, ...};
29
+interface Suspender {
30
+ then(resolve: () => mixed, reject: () => mixed): mixed;
31
+}
32
33
type PendingResult = {
34
status: 0,
@@ -124,6 +126,7 @@ function accessResult<Input, Key, Value>(
126
);
127
const newResult: PendingResult = {
128
status: Pending,
129
+ // $FlowFixMe[method-unbinding]
130
value: thenable,
131
};
132
entriesForResource.set(key, newResult);
packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js
+1
@@ -33,6 +33,7 @@ import type {Element} from 'react-devtools-shared/src/devtools/views/Components/
33
import type {Element as ReactElement} from 'react';
34
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
35
36
+// $FlowFixMe[method-unbinding]
37
const hasOwnProperty = Object.prototype.hasOwnProperty;
38
39
type Type = 'props' | 'state' | 'context' | 'hooks';
packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js
+1
@@ -67,6 +67,7 @@ export default function SidebarSelectedFiberInfo(_: Props): React.Node {
67
const selectedElement = selectedListItemRef.current;
68
if (
69
selectedElement !== null &&
70
+ // $FlowFixMe[method-unbinding]
71
typeof selectedElement.scrollIntoView === 'function'
72
) {
73
selectedElement.scrollIntoView({block: 'nearest', inline: 'nearest'});
packages/react-devtools-shared/src/devtools/views/utils.js
+1
@@ -14,6 +14,7 @@ import isArray from 'react-devtools-shared/src/isArray';
14
15
import type {HooksTree} from 'react-debug-tools/src/ReactDebugHooks';
16
17
+// $FlowFixMe[method-unbinding]
18
const hasOwnProperty = Object.prototype.hasOwnProperty;
19
20
export function alphaSortEntries(
packages/react-devtools-shared/src/hook.js
+2
@@ -61,6 +61,7 @@ export function installHook(target: any): DevToolsHook | null {
61
// it happens *outside* of the renderer injection. See `checkDCE` below.
62
}
63
64
+ // $FlowFixMe[method-unbinding]
65
const toString = Function.prototype.toString;
66
if (renderer.Mount && renderer.Mount._renderNewRootComponent) {
67
// React DOM Stack
@@ -147,6 +148,7 @@ export function installHook(target: any): DevToolsHook | null {
148
// This runs for production versions of React.
149
// Needs to be super safe.
150
try {
151
+ // $FlowFixMe[method-unbinding]
152
const toString = Function.prototype.toString;
153
const code = toString.call(fn);
154
packages/react-devtools-shared/src/utils.js
+3
@@ -56,6 +56,7 @@ import isArray from './isArray';
56
import type {ComponentFilter, ElementType} from './types';
57
import type {LRUCache} from 'react-devtools-shared/src/types';
58
59
+// $FlowFixMe[method-unbinding]
60
const hasOwnProperty = Object.prototype.hasOwnProperty;
61
62
const cachedDisplayNames: WeakMap<Function, string> = new WeakMap();
@@ -598,6 +599,7 @@ export function getDataType(data: Object): DataType {
599
} else if (data.constructor && data.constructor.name === 'RegExp') {
600
return 'regexp';
601
} else {
602
+ // $FlowFixMe[method-unbinding]
603
const toStringValue = Object.prototype.toString.call(data);
604
if (toStringValue === '[object Date]') {
605
return 'date';
@@ -612,6 +614,7 @@ export function getDataType(data: Object): DataType {
614
return 'symbol';
615
case 'undefined':
616
if (
617
+ // $FlowFixMe[method-unbinding]
618
Object.prototype.toString.call(data) === '[object HTMLAllCollection]'
619
) {
620
return 'html_all_collection';
packages/react-devtools-timeline/src/import-worker/preprocessData.js
+3
@@ -968,8 +968,11 @@ function preprocessFlamechart(rawData: TimelineEvent[]): Flamechart {
968
const profile = parsedData.profiles[0]; // TODO: Choose the main CPU thread only
969
970
const speedscopeFlamechart = new SpeedscopeFlamechart({
971
+ // $FlowFixMe[method-unbinding]
972
getTotalWeight: profile.getTotalWeight.bind(profile),
973
+ // $FlowFixMe[method-unbinding]
974
forEachCall: profile.forEachCall.bind(profile),
975
+ // $FlowFixMe[method-unbinding]
976
formatValue: profile.formatValue.bind(profile),
977
getColorBucketForFrame: () => 0,
978
});
packages/react-dom-bindings/src/client/ReactDOMComponent.js
+1
@@ -455,6 +455,7 @@ export function createElement(
455
if (namespaceURI === HTML_NAMESPACE) {
456
if (
457
!isCustomComponentTag &&
458
+ // $FlowFixMe[method-unbinding]
459
Object.prototype.toString.call(domElement) ===
460
'[object HTMLUnknownElement]' &&
461
!hasOwnProperty.call(warnedUnknownTags, type)
packages/react-dom-bindings/src/client/ReactDOMComponentTree.js
+4
@@ -61,14 +61,17 @@ export function precacheFiberNode(
61
}
62
63
export function markContainerAsRoot(hostRoot: Fiber, node: Container): void {
64
+ // $FlowFixMe[prop-missing]
65
node[internalContainerInstanceKey] = hostRoot;
66
}
67
68
export function unmarkContainerAsRoot(node: Container): void {
69
+ // $FlowFixMe[prop-missing]
70
node[internalContainerInstanceKey] = null;
71
}
72
73
export function isContainerMarkedAsRoot(node: Container): boolean {
74
+ // $FlowFixMe[prop-missing]
75
return !!node[internalContainerInstanceKey];
76
}
77
@@ -132,6 +135,7 @@ export function getClosestInstanceFromNode(targetNode: Node): null | Fiber {
135
// have had an internalInstanceKey on it.
136
// Let's get the fiber associated with the SuspenseComponent
137
// as the deepest instance.
138
+ // $FlowFixMe[prop-missing]
139
const targetSuspenseInst = suspenseInstance[internalInstanceKey];
140
if (targetSuspenseInst) {
141
return targetSuspenseInst;
packages/react-dom-bindings/src/client/ReactDOMHostConfig.js
+11
-4
@@ -117,12 +117,14 @@ export type EventTargetChildElement = {
117
...
118
};
119
export type Container =
120
- | (Element & {_reactRootContainer?: FiberRoot, ...})
121
- | (Document & {_reactRootContainer?: FiberRoot, ...})
122
- | (DocumentFragment & {_reactRootContainer?: FiberRoot, ...});
120
+ | interface extends Element {_reactRootContainer?: FiberRoot}
121
+ | interface extends Document {_reactRootContainer?: FiberRoot}
122
+ | interface extends DocumentFragment {_reactRootContainer?: FiberRoot};
123
export type Instance = Element;
124
export type TextInstance = Text;
125
-export type SuspenseInstance = Comment & {_reactRetry?: () => void, ...};
125
+export interface SuspenseInstance extends Comment {
126
+ _reactRetry?: () => void;
127
+}
128
export type HydratableInstance = Instance | TextInstance | SuspenseInstance;
129
export type PublicInstance = Element | Text;
130
type HostContextDev = {
@@ -644,6 +646,7 @@ export function hideInstance(instance: Instance): void {
646
// pass host context to this method?
647
instance = ((instance: any): HTMLElement);
648
const style = instance.style;
649
+ // $FlowFixMe[method-unbinding]
650
if (typeof style.setProperty === 'function') {
651
style.setProperty('display', 'none', 'important');
652
} else {
@@ -679,6 +682,7 @@ export function clearContainer(container: Container): void {
682
((container: any): Element).textContent = '';
683
} else if (container.nodeType === DOCUMENT_NODE) {
684
if (container.documentElement) {
685
+ // $FlowFixMe[incompatible-call]
686
container.removeChild(container.documentElement);
687
}
688
}
@@ -1267,6 +1271,7 @@ export function setFocusIfFocusable(node: Instance): boolean {
1271
const element = ((node: any): HTMLElement);
1272
try {
1273
element.addEventListener('focus', handleFocus);
1274
+ // $FlowFixMe[method-unbinding]
1275
(element.focus || HTMLElement.prototype.focus).call(element);
1276
} finally {
1277
element.removeEventListener('focus', handleFocus);
@@ -1349,11 +1354,13 @@ export const supportsResources = true;
1354
export {isHostResourceType};
1355
function isHostResourceInstance(instance: Instance | Container): boolean {
1356
if (instance.nodeType === ELEMENT_NODE) {
1357
+ // $FlowFixMe[prop-missing] Flow doesn't understand `nodeType` test.
1358
switch (instance.tagName.toLowerCase()) {
1359
case 'link': {
1360
const rel = ((instance: any): HTMLLinkElement).rel;
1361
return (
1362
rel === 'preload' ||
1363
+ // $FlowFixMe[prop-missing] Flow doesn't understand `nodeType` test.
1364
(rel === 'stylesheet' && instance.hasAttribute('data-rprec'))
1365
);
1366
}
packages/react-dom-bindings/src/client/ReactDOMSelect.js
+1
-5
@@ -73,11 +73,7 @@ function updateOptions(
73
propValue: any,
74
setDefaultSelected: boolean,
75
) {
76
- type IndexableHTMLOptionsCollection = HTMLOptionsCollection & {
77
- [key: number]: HTMLOptionElement,
78
- ...,
79
- };
80
- const options: IndexableHTMLOptionsCollection = node.options;
76
+ const options: HTMLOptionsCollection = node.options;
77
78
if (multiple) {
79
const selectedValues = (propValue: Array<string>);
packages/react-dom-bindings/src/client/inputValueTracking.js
+3
-2
@@ -14,8 +14,9 @@ type ValueTracker = {
14
setValue(value: string): void,
15
stopTracking(): void,
16
};
17
-type WrapperState = {_valueTracker?: ?ValueTracker, ...};
18
-type ElementWithValueTracker = HTMLInputElement & WrapperState;
17
+interface ElementWithValueTracker extends HTMLInputElement {
18
+ _valueTracker?: ?ValueTracker;
19
+}
20
21
function isCheckable(elem: HTMLInputElement) {
22
const type = elem.type;
packages/react-dom-bindings/src/events/DOMPluginEventSystem.js
+1
-1
@@ -761,7 +761,7 @@ export function accumulateSinglePhaseListeners(
761
// current instance fiber. In which case, we should clear all existing
762
// listeners.
763
if (enableCreateEventHandleAPI && nativeEvent.type === 'beforeblur') {
764
- // $FlowFixMe: internal field
764
+ // $FlowFixMe[prop-missing] internal field
765
const detachedInterceptFiber = nativeEvent._detachedInterceptFiber;
766
if (
767
detachedInterceptFiber !== null &&
packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js
+4
-5
@@ -7,11 +7,10 @@
7
* @flow
8
*/
9
10
-export type Destination = {
11
- push(chunk: string | null): boolean,
12
- destroy(error: Error): mixed,
13
- ...
14
-};
10
+export interface Destination {
11
+ push(chunk: string | null): boolean;
12
+ destroy(error: Error): mixed;
13
+}
14
15
export type PrecomputedChunk = string;
16
export type Chunk = string;
packages/react-dom/src/client/ReactDOMLegacy.js
+4
@@ -145,6 +145,7 @@ function legacyCreateRootFromDOMContainer(
145
146
const rootContainerElement =
147
container.nodeType === COMMENT_NODE ? container.parentNode : container;
148
+ // $FlowFixMe[incompatible-call]
149
listenToAllSupportedEvents(rootContainerElement);
150
151
flushSync();
@@ -179,6 +180,7 @@ function legacyCreateRootFromDOMContainer(
180
181
const rootContainerElement =
182
container.nodeType === COMMENT_NODE ? container.parentNode : container;
183
+ // $FlowFixMe[incompatible-call]
184
listenToAllSupportedEvents(rootContainerElement);
185
186
// Initial mount should not be batched.
@@ -435,6 +437,8 @@ export function unmountComponentAtNode(container: Container): boolean {
437
const isContainerReactRoot =
438
container.nodeType === ELEMENT_NODE &&
439
isValidContainerLegacy(container.parentNode) &&
440
+ // $FlowFixMe[prop-missing]
441
+ // $FlowFixMe[incompatible-use]
442
!!container.parentNode._reactRootContainer;
443
444
if (hasNonRootReactChild) {
packages/react-native-renderer/src/ReactFabricEventEmitter.js
+1
@@ -115,6 +115,7 @@ export function dispatchEvent(
115
// Note that extracted events are *not* emitted,
116
// only events that have a 1:1 mapping with a native event, at least for now.
117
const event = {eventName: topLevelType, nativeEvent};
118
+ // $FlowFixMe[class-object-subtyping] found when upgrading Flow
119
RawEventEmitter.emit(topLevelType, event);
120
RawEventEmitter.emit('*', event);
121
packages/react-native-renderer/src/ReactFabricHostConfig.js
+1
@@ -316,6 +316,7 @@ class ReactFabricHostComponent {
316
}
317
318
// eslint-disable-next-line no-unused-expressions
319
+// $FlowFixMe[class-object-subtyping] found when upgrading Flow
320
(ReactFabricHostComponent.prototype: $ReadOnly<{...NativeMethods, ...}>);
321
322
export * from 'react-reconciler/src/ReactFiberHostConfigWithNoMutation';
packages/react-native-renderer/src/ReactNativeFiberHostComponent.js
+1
@@ -127,6 +127,7 @@ class ReactNativeFiberHostComponent {
127
}
128
129
// eslint-disable-next-line no-unused-expressions
130
+// $FlowFixMe[class-object-subtyping] found when upgrading Flow
131
(ReactNativeFiberHostComponent.prototype: $ReadOnly<{...NativeMethods, ...}>);
132
133
export default ReactNativeFiberHostComponent;
packages/react-native-renderer/src/legacy-events/EventPluginRegistry.js
+1
@@ -219,6 +219,7 @@ export function injectEventPluginOrder(
219
}
220
221
// Clone the ordering so it cannot be dynamically mutated.
222
+ // $FlowFixMe[method-unbinding] found when upgrading Flow
223
eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
224
recomputePluginOrdering();
225
}
packages/react-reconciler/src/ReactChildFiber.new.js
+1
@@ -228,6 +228,7 @@ function coerceRef(
228
}
229
230
function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
231
+ // $FlowFixMe[method-unbinding]
232
const childString = Object.prototype.toString.call(newChild);
233
234
throw new Error(
packages/react-reconciler/src/ReactChildFiber.old.js
+1
@@ -228,6 +228,7 @@ function coerceRef(
228
}
229
230
function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
231
+ // $FlowFixMe[method-unbinding]
232
const childString = Object.prototype.toString.call(newChild);
233
234
throw new Error(
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+1
@@ -2336,6 +2336,7 @@ function getRetryCache(finishedWork) {
2336
const instance: OffscreenInstance = finishedWork.stateNode;
2337
let retryCache = instance._retryCache;
2338
if (retryCache === null) {
2339
+ // $FlowFixMe[incompatible-type]
2340
retryCache = instance._retryCache = new PossiblyWeakSet();
2341
}
2342
return retryCache;
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+1
@@ -2336,6 +2336,7 @@ function getRetryCache(finishedWork) {
2336
const instance: OffscreenInstance = finishedWork.stateNode;
2337
let retryCache = instance._retryCache;
2338
if (retryCache === null) {
2339
+ // $FlowFixMe[incompatible-type]
2340
retryCache = instance._retryCache = new PossiblyWeakSet();
2341
}
2342
return retryCache;
packages/react-reconciler/src/ReactFiberHooks.new.js
+2
@@ -768,6 +768,8 @@ if (enableUseMemoCacheHook) {
768
769
function use<T>(usable: Usable<T>): T {
770
if (usable !== null && typeof usable === 'object') {
771
+ // $FlowFixMe[method-unbinding]
772
+ // $FlowFixMe[prop-missing]
773
if (typeof usable.then === 'function') {
774
// This is a thenable.
775
const thenable: Thenable<T> = (usable: any);
packages/react-reconciler/src/ReactFiberHooks.old.js
+2
@@ -768,6 +768,8 @@ if (enableUseMemoCacheHook) {
768
769
function use<T>(usable: Usable<T>): T {
770
if (usable !== null && typeof usable === 'object') {
771
+ // $FlowFixMe[method-unbinding]
772
+ // $FlowFixMe[prop-missing]
773
if (typeof usable.then === 'function') {
774
// This is a thenable.
775
const thenable: Thenable<T> = (usable: any);
packages/react-reconciler/src/ReactFiberOffscreenComponent.js
+1
@@ -51,5 +51,6 @@ export type OffscreenInstance = {
51
_visibility: OffscreenVisibility,
52
_pendingMarkers: Set<TracingMarkerInstance> | null,
53
_transitions: Set<Transition> | null,
54
+ // $FlowFixMe[incompatible-type-arg] found when upgrading Flow
55
_retryCache: WeakSet<Wakeable> | Set<Wakeable> | null,
56
};
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+2
@@ -1213,6 +1213,7 @@ export function queueRecoverableErrors(errors: Array<CapturedValue<mixed>>) {
1213
if (workInProgressRootRecoverableErrors === null) {
1214
workInProgressRootRecoverableErrors = errors;
1215
} else {
1216
+ // $FlowFixMe[method-unbinding]
1217
workInProgressRootRecoverableErrors.push.apply(
1218
workInProgressRootRecoverableErrors,
1219
errors,
@@ -3169,6 +3170,7 @@ export function resolveRetryWakeable(boundaryFiber: Fiber, wakeable: Wakeable) {
3170
break;
3171
case OffscreenComponent: {
3172
const instance: OffscreenInstance = boundaryFiber.stateNode;
3173
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
3174
retryCache = instance._retryCache;
3175
break;
3176
}
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+2
@@ -1213,6 +1213,7 @@ export function queueRecoverableErrors(errors: Array<CapturedValue<mixed>>) {
1213
if (workInProgressRootRecoverableErrors === null) {
1214
workInProgressRootRecoverableErrors = errors;
1215
} else {
1216
+ // $FlowFixMe[method-unbinding]
1217
workInProgressRootRecoverableErrors.push.apply(
1218
workInProgressRootRecoverableErrors,
1219
errors,
@@ -3169,6 +3170,7 @@ export function resolveRetryWakeable(boundaryFiber: Fiber, wakeable: Wakeable) {
3170
break;
3171
case OffscreenComponent: {
3172
const instance: OffscreenInstance = boundaryFiber.stateNode;
3173
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
3174
retryCache = instance._retryCache;
3175
break;
3176
}
packages/react-server-dom-webpack/src/ReactFlightClientWebpackBundlerConfig.js
+1
@@ -74,6 +74,7 @@ export function preloadModule<T>(
74
if (entry === undefined) {
75
const thenable = __webpack_chunk_load__(chunkId);
76
promises.push(thenable);
77
+ // $FlowFixMe[method-unbinding]
78
const resolve = chunkCache.set.bind(chunkCache, chunkId, null);
79
thenable.then(resolve, ignoreReject);
80
chunkCache.set(chunkId, thenable);
packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js
+1
@@ -59,6 +59,7 @@ module.exports = function register() {
59
async: true,
60
};
61
return Promise.resolve(
62
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
63
resolve(new Proxy(moduleReference, proxyHandlers)),
64
);
65
};
packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js
+1
@@ -351,6 +351,7 @@ export default class ReactFlightWebpackPlugin {
351
if (err) return callback(err);
352
const flat = [];
353
for (let i = 0; i < result.length; i++) {
354
+ // $FlowFixMe[method-unbinding]
355
flat.push.apply(flat, result[i]);
356
}
357
callback(null, flat);
packages/react-server/src/ReactFizzHooks.js
+2
@@ -589,6 +589,8 @@ function useId(): string {
589
590
function use<T>(usable: Usable<T>): T {
591
if (usable !== null && typeof usable === 'object') {
592
+ // $FlowFixMe[method-unbinding]
593
+ // $FlowFixMe[prop-missing]
594
if (typeof usable.then === 'function') {
595
// This is a thenable.
596
const thenable: Thenable<T> = (usable: any);
packages/react-server/src/ReactFizzServer.js
+1
@@ -1455,6 +1455,7 @@ function renderNodeDestructiveImpl(
1455
}
1456
}
1457
1458
+ // $FlowFixMe[method-unbinding]
1459
const childString = Object.prototype.toString.call(node);
1460
1461
throw new Error(
packages/react-server/src/ReactFlightHooks.js
+2
@@ -145,6 +145,8 @@ function useId(): string {
145
146
function use<T>(usable: Usable<T>): T {
147
if (usable !== null && typeof usable === 'object') {
148
+ // $FlowFixMe[method-unbinding]
149
+ // $FlowFixMe[prop-missing]
150
if (typeof usable.then === 'function') {
151
// This is a thenable.
152
const thenable: Thenable<T> = (usable: any);
packages/react-server/src/ReactFlightServer.js
+3
@@ -435,6 +435,7 @@ function isSimpleObject(object): boolean {
435
}
436
437
function objectName(object): string {
438
+ // $FlowFixMe[method-unbinding]
439
const name = Object.prototype.toString.call(object);
440
return name.replace(/^\[object (.*)\]$/, function(m, p0) {
441
return p0;
@@ -494,6 +495,7 @@ function describeObjectForErrorMessage(
495
typeof value === 'object' &&
496
value !== null
497
) {
498
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
499
str += describeObjectForErrorMessage(value);
500
} else {
501
str += describeValueForErrorMessage(value);
@@ -521,6 +523,7 @@ function describeObjectForErrorMessage(
523
typeof value === 'object' &&
524
value !== null
525
) {
526
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
527
str += describeObjectForErrorMessage(value);
528
} else {
529
str += describeValueForErrorMessage(value);
packages/react-server/src/ReactServerStreamConfigBrowser.js
+1
@@ -115,6 +115,7 @@ export function stringToPrecomputedChunk(content: string): PrecomputedChunk {
115
}
116
117
export function closeWithError(destination: Destination, error: mixed): void {
118
+ // $FlowFixMe[method-unbinding]
119
if (typeof destination.error === 'function') {
120
// $FlowFixMe: This is an Error object or the destination accepts other types.
121
destination.error(error);
packages/react-server/src/ReactServerStreamConfigNode.js
+3
-4
@@ -10,10 +10,9 @@
10
import type {Writable} from 'stream';
11
import {TextEncoder} from 'util';
12
13
-type MightBeFlushable = {
14
- flush?: () => void,
15
- ...
16
-};
13
+interface MightBeFlushable {
14
+ flush?: () => void;
15
+}
16
17
export type Destination = Writable & MightBeFlushable;
18
packages/react/src/ReactAct.js
+1
@@ -60,6 +60,7 @@ export function act<T>(callback: () => T | Thenable<T>): Thenable<T> {
60
if (
61
result !== null &&
62
typeof result === 'object' &&
63
+ // $FlowFixMe[method-unbinding]
64
typeof result.then === 'function'
65
) {
66
const thenableResult: Thenable<T> = (result: any);
packages/scheduler/src/forks/Scheduler.js
+1
@@ -58,6 +58,7 @@ type Task = {
58
59
let getCurrentTime: () => number | DOMHighResTimeStamp;
60
const hasPerformanceNow =
61
+ // $FlowFixMe[method-unbinding]
62
typeof performance === 'object' && typeof performance.now === 'function';
63
64
if (hasPerformanceNow) {
packages/shared/hasOwnProperty.js
+1
@@ -7,6 +7,7 @@
7
* @flow
8
*/
9
10
+// $FlowFixMe[method-unbinding]
11
const hasOwnProperty = Object.prototype.hasOwnProperty;
12
13
export default hasOwnProperty;
packages/shared/invokeGuardedCallbackImpl.js
+3
@@ -12,6 +12,7 @@ function invokeGuardedCallbackProd<Args: Array<mixed>, Context>(
12
func: (...Args) => mixed,
13
context: Context,
14
): void {
15
+ // $FlowFixMe[method-unbinding]
16
const funcArgs = Array.prototype.slice.call(arguments, 3);
17
try {
18
// $FlowFixMe[incompatible-call] Flow doesn't understand the arguments splicing.
@@ -53,6 +54,7 @@ if (__DEV__) {
54
typeof window !== 'undefined' &&
55
typeof window.dispatchEvent === 'function' &&
56
typeof document !== 'undefined' &&
57
+ // $FlowFixMe[method-unbinding]
58
typeof document.createEvent === 'function'
59
) {
60
const fakeNode = document.createElement('react');
@@ -122,6 +124,7 @@ if (__DEV__) {
124
// Create an event handler for our fake event. We will synchronously
125
// dispatch our fake event using `dispatchEvent`. Inside the handler, we
126
// call the user-provided callback.
127
+ // $FlowFixMe[method-unbinding]
128
const funcArgs = Array.prototype.slice.call(arguments, 3);
129
function callCallback() {
130
didCall = true;
scripts/flow/config/flowconfig
+1
-1
@@ -47,4 +47,4 @@ munge_underscores=false
47
%REACT_RENDERER_FLOW_OPTIONS%
48
49
[version]
50
-^0.152.0
50
+^0.153.0
yarn.lock
+4
-4
@@ -7912,10 +7912,10 @@ flatted@^2.0.0:
7912
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
7913
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==
7914
7915
-flow-bin@^0.152.0:
7916
- version "0.152.0"
7917
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.152.0.tgz#6980d0cd58f59e9aefd580b11109a1d56eba46b1"
7918
- integrity sha512-b4ijbZIQovcx5l/T7VnwyBPIikj60A2qk7hKqQKVWiuftQMrUmC5ct2/0SuVvheX6ZbPdZfeyw2EHO1/n3eAmw==
7915
+flow-bin@^0.153.0:
7916
+ version "0.153.0"
7917
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.153.0.tgz#44d941acaf5ef977fa26d1b4b5dc3cf56b68eefc"
7918
+ integrity sha512-sxP9nfXnoyCUT6hjAO+zDyHLO3dZcWg0h+4HttHs/5wg/2oAkTDwmsWbj095IQsEmwTicq2TfqWq5QRuLxynlQ==
7919
7920
fluent-syntax@0.13.0:
7921
version "0.13.0"