[flow] Bump flow to v0.307.1 (#36199)
## Summary Notable changes: - Only $FlowFixMe, $FlowExpectedError suppression comments are supported - All suppression comments need error code - A lot of new invalid-compare and constant-condition errors suppressed. These errors reveal potential logical bugs ## How did you test this change? `yarn flow-ci`
Sam Zhou committed
Jun 5, 2026 at 13:54 UTC
fbb137059e4aacfaab1d36516e9b55050b4a0454
197 files changed
+977
-321
flow-typed/environments/bom.js
+1
@@ -874,6 +874,7 @@ declare class SharedWorker extends EventTarget {
874
declare function importScripts(...urls: Array<string | TrustedScriptURL>): void;
875
876
declare class WorkerGlobalScope extends EventTarget {
877
+ // $FlowFixMe[incompatible-variance]
878
self: this;
879
location: WorkerLocation;
880
navigator: WorkerNavigator;
flow-typed/environments/dom.js
+1
@@ -1263,6 +1263,7 @@ declare class HTMLCollection<+Elem: Element> {
1263
length: number;
1264
item(nameOrIndex?: any, optionalIndex?: any): Elem | null;
1265
namedItem(name: string): Elem | null;
1266
+ // $FlowFixMe[incompatible-variance]
1267
[index: number | string]: Elem;
1268
}
1269
flow-typed/environments/node.js
+3
@@ -1908,6 +1908,7 @@ type http$agentOptions = {
1908
declare class http$Agent<+SocketT = net$Socket> {
1909
constructor(options: http$agentOptions): void;
1910
destroy(): void;
1911
+ // $FlowFixMe[incompatible-variance]
1912
freeSockets: {[name: string]: $ReadOnlyArray<SocketT>, ...};
1913
getName(options: {
1914
host: string,
@@ -1917,7 +1918,9 @@ declare class http$Agent<+SocketT = net$Socket> {
1918
}): string;
1919
maxFreeSockets: number;
1920
maxSockets: number;
1921
+ // $FlowFixMe[incompatible-variance]
1922
requests: {[name: string]: $ReadOnlyArray<http$ClientRequest<SocketT>>, ...};
1923
+ // $FlowFixMe[incompatible-variance]
1924
sockets: {[name: string]: $ReadOnlyArray<SocketT>, ...};
1925
}
1926
flow-typed/environments/streams.js
+1
-1
@@ -42,7 +42,7 @@ declare class ReadableStreamReader {
42
43
closed: boolean;
44
45
- cancel(reason: string): void;
45
+ cancel(reason: string): Promise<void>;
46
read(): Promise<{
47
value: ?any,
48
done: boolean,
package.json
+2
-2
@@ -75,8 +75,8 @@
75
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
76
"fbjs-scripts": "^3.0.1",
77
"filesize": "^6.0.1",
78
- "flow-bin": "^0.279.0",
79
- "flow-remove-types": "^2.279.0",
78
+ "flow-bin": "^0.307.1",
79
+ "flow-remove-types": "^2.307.1",
80
"flow-typed": "^4.1.1",
81
"glob": "^7.1.6",
82
"glob-stream": "^6.1.0",
packages/internal-test-utils/internalAct.js
+2
-2
@@ -163,7 +163,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
163
throw thrownError;
164
}
165
166
- // $FlowFixMe[incompatible-return]
166
+ // $FlowFixMe[incompatible-type]
167
return result;
168
} finally {
169
const depth = actingUpdatesScopeDepth;
@@ -285,7 +285,7 @@ export async function serverAct<T>(scope: () => Thenable<T>): Thenable<T> {
285
throw thrownError;
286
}
287
288
- // $FlowFixMe[incompatible-return]
288
+ // $FlowFixMe[incompatible-type]
289
return result;
290
} finally {
291
if (typeof process === 'object') {
packages/react-cache/src/LRU.js
+1
@@ -115,6 +115,7 @@ export function createLRU<T>(limit: number): LRU<T> {
115
116
function access(entry: Entry<T>): T {
117
const next = entry.next;
118
+ // $FlowFixMe[invalid-compare]
119
if (next !== null) {
120
// Entry already cached
121
const resolvedFirst: Entry<T> = (first: any);
packages/react-client/src/ReactClientConsoleConfigBrowser.js
+3
-2
@@ -35,7 +35,7 @@ export function bindToConsole(
35
case 'groupEnd':
36
case 'table': {
37
// These methods cannot be colorized because they don't take a formatting string.
38
- // $FlowFixMe
38
+ // $FlowFixMe[incompatible-type]
39
return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging
40
}
41
case 'assert': {
@@ -68,6 +68,7 @@ export function bindToConsole(
68
// The "this" binding in the "bind";
69
newArgs.unshift(console);
70
71
- // $FlowFixMe
71
+ // $FlowFixMe[incompatible-type]
72
+ // $FlowFixMe[invalid-computed-prop]
73
return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging
74
}
packages/react-client/src/ReactClientConsoleConfigPlain.js
+3
-2
@@ -25,7 +25,7 @@ export function bindToConsole(
25
case 'groupEnd':
26
case 'table': {
27
// These methods cannot be colorized because they don't take a formatting string.
28
- // $FlowFixMe
28
+ // $FlowFixMe[incompatible-type]
29
return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging
30
}
31
case 'assert': {
@@ -49,6 +49,7 @@ export function bindToConsole(
49
// The "this" binding in the "bind";
50
newArgs.unshift(console);
51
52
- // $FlowFixMe
52
+ // $FlowFixMe[incompatible-type]
53
+ // $FlowFixMe[invalid-computed-prop]
54
return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging
55
}
packages/react-client/src/ReactClientConsoleConfigServer.js
+3
-2
@@ -36,7 +36,7 @@ export function bindToConsole(
36
case 'groupEnd':
37
case 'table': {
38
// These methods cannot be colorized because they don't take a formatting string.
39
- // $FlowFixMe
39
+ // $FlowFixMe[incompatible-type]
40
return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging
41
}
42
case 'assert': {
@@ -69,6 +69,7 @@ export function bindToConsole(
69
// The "this" binding in the "bind";
70
newArgs.unshift(console);
71
72
- // $FlowFixMe
72
+ // $FlowFixMe[incompatible-type]
73
+ // $FlowFixMe[invalid-computed-prop]
74
return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging
75
}
packages/react-client/src/ReactFlightClient.js
+14
-11
@@ -281,12 +281,12 @@ ReactPromise.prototype.then = function <T>(
281
const rejectCallback = reject;
282
const wrapperPromise: Promise<T> = new Promise((res, rej) => {
283
resolve = value => {
284
- // $FlowFixMe
284
+ // $FlowFixMe[prop-missing]
285
wrapperPromise._debugInfo = this._debugInfo;
286
res(value);
287
};
288
reject = reason => {
289
- // $FlowFixMe
289
+ // $FlowFixMe[prop-missing]
290
wrapperPromise._debugInfo = this._debugInfo;
291
rej(reason);
292
};
@@ -499,6 +499,7 @@ function filterDebugInfo(
499
response: Response,
500
value: {_debugInfo: ReactDebugInfo, ...},
501
) {
502
+ // $FlowFixMe[invalid-compare]
503
if (response._debugEndTime === null) {
504
// No end time was defined, so we keep all debug info entries.
505
return;
@@ -722,7 +723,7 @@ function triggerErrorOnChunk<T>(
723
// a stream chunk since any other row shouldn't have more than one entry.
724
const streamChunk: InitializedStreamChunk<any> = (chunk: any);
725
const controller = streamChunk.reason;
725
- // $FlowFixMe[incompatible-call]: The error method should accept mixed.
726
+ // $FlowFixMe[incompatible-type]: The error method should accept mixed.
727
controller.error(error);
728
return;
729
}
@@ -3294,7 +3295,7 @@ function startReadableStream<T>(
3295
}
3296
closed = true;
3297
if (previousBlockedChunk === null) {
3297
- // $FlowFixMe[incompatible-call]
3298
+ // $FlowFixMe[incompatible-type]
3299
controller.error(error);
3300
} else {
3301
const blockedChunk = previousBlockedChunk;
@@ -3526,11 +3527,12 @@ function resolveErrorDev(
3527
let error;
3528
const errorOptions =
3529
// We don't serialize Error.cause in prod so we never need to deserialize
3530
+ // $FlowFixMe[constant-condition]
3531
__DEV__ && 'cause' in errorInfo
3532
? {
3533
cause: reviveModel(
3534
response,
3533
- // $FlowFixMe[incompatible-cast] -- Flow thinks `cause` in `cause?: JSONValue` can be undefined after `in` check.
3535
+ // $FlowFixMe[incompatible-type] -- Flow thinks `cause` in `cause?: JSONValue` can be undefined after `in` check.
3536
(errorInfo.cause: JSONValue),
3537
errorInfo,
3538
'cause',
@@ -3544,7 +3546,7 @@ function resolveErrorDev(
3546
__DEV__ && isAggregateError
3547
? reviveModel(
3548
response,
3547
- // $FlowFixMe[incompatible-cast]
3549
+ // $FlowFixMe[incompatible-type]
3550
(errorInfo.errors: JSONValue),
3551
errorInfo,
3552
'errors',
@@ -4059,7 +4061,7 @@ function initializeDebugInfo(
4061
}
4062
if (debugInfo.owner == null && response._debugRootOwner != null) {
4063
const componentInfoOrAsyncInfo: ReactComponentInfo | ReactAsyncInfo =
4062
- // $FlowFixMe: By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo`
4064
+ // $FlowFixMe[incompatible-type]: By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo`
4065
debugInfo;
4066
// $FlowFixMe[cannot-write]
4067
componentInfoOrAsyncInfo.owner = response._debugRootOwner;
@@ -4411,7 +4413,7 @@ function logComponentInfo(
4413
childrenEndTime: number,
4414
isLastComponent: boolean,
4415
): void {
4414
- // $FlowFixMe: Refined.
4416
+ // $FlowFixMe[incompatible-type]: Refined.
4417
if (
4418
isLastComponent &&
4419
root.status === ERRORED &&
@@ -4590,7 +4592,7 @@ function flushComponentPerformance(
4592
if (componentEndTime > childrenEndTime) {
4593
childrenEndTime = componentEndTime;
4594
}
4593
- // $FlowFixMe: Refined.
4595
+ // $FlowFixMe[incompatible-type]: Refined.
4596
const componentInfo: ReactComponentInfo = candidateInfo;
4597
logComponentInfo(
4598
response,
@@ -4614,7 +4616,7 @@ function flushComponentPerformance(
4616
if (endTime > childrenEndTime) {
4617
childrenEndTime = endTime;
4618
}
4617
- // $FlowFixMe: Refined.
4619
+ // $FlowFixMe[incompatible-type]: Refined.
4620
const asyncInfo: ReactAsyncInfo = candidateInfo;
4621
const env = response._rootEnvironmentName;
4622
const promise = asyncInfo.awaited.value;
@@ -4677,7 +4679,7 @@ function flushComponentPerformance(
4679
if (componentEndTime > childrenEndTime) {
4680
childrenEndTime = componentEndTime;
4681
}
4680
- // $FlowFixMe: Refined.
4682
+ // $FlowFixMe[incompatible-type]: Refined.
4683
const componentInfo: ReactComponentInfo = candidateInfo;
4684
const env = response._rootEnvironmentName;
4685
logComponentAborted(
@@ -5323,6 +5325,7 @@ function reviveModel(
5325
for (let i = 0; i < value.length; i++) {
5326
(value: any)[i] = reviveModel(response, value[i], value, '' + i);
5327
}
5328
+ // $FlowFixMe[invalid-compare]
5329
if (value[0] === REACT_ELEMENT_TYPE) {
5330
// React element tuple
5331
return parseModelTuple(response, value);
packages/react-client/src/ReactFlightClientStreamConfigNode.js
+1
@@ -21,6 +21,7 @@ export function readPartialStringChunk(
21
decoder: StringDecoder,
22
buffer: Uint8Array,
23
): string {
24
+ // $FlowFixMe[incompatible-type]
25
return decoder.decode(buffer, decoderOptions);
26
}
27
packages/react-client/src/ReactFlightReplyClient.js
+10
-6
@@ -584,7 +584,7 @@ export function processReply(
584
}
585
586
if (isArray(value)) {
587
- // $FlowFixMe[incompatible-return]
587
+ // $FlowFixMe[incompatible-type]
588
return value;
589
}
590
// TODO: Should we the Object.prototype.toString.call() to test for cross-realm objects?
@@ -603,7 +603,7 @@ export function processReply(
603
const prefix = formFieldPrefix + '_' + refId + '_';
604
// $FlowFixMe[prop-missing]: FormData has forEach.
605
value.forEach((originalValue: string | File, originalKey: string) => {
606
- // $FlowFixMe[incompatible-call]
606
+ // $FlowFixMe[incompatible-type]
607
data.append(prefix + originalKey, originalValue);
608
});
609
return serializeFormDataReference(refId);
@@ -697,6 +697,7 @@ export function processReply(
697
const iteratorFn = getIteratorFn(value);
698
if (iteratorFn) {
699
const iterator = iteratorFn.call(value);
700
+ // $FlowFixMe[invalid-compare]
701
if (iterator === value) {
702
// Iterator, not Iterable
703
const iteratorId = nextPartId++;
@@ -887,7 +888,7 @@ export function processReply(
888
}
889
}
890
modelRoot = model;
890
- // $FlowFixMe[incompatible-return] it's not going to be undefined because we'll encode it.
891
+ // $FlowFixMe[incompatible-type] it's not going to be undefined because we'll encode it.
892
return JSON.stringify(model, resolveToJSON);
893
}
894
@@ -913,7 +914,7 @@ export function processReply(
914
// Otherwise, we use FormData to let us stream in the result.
915
formData.set(formFieldPrefix + '0', json);
916
if (pendingParts === 0) {
916
- // $FlowFixMe[incompatible-call] this has already been refined.
917
+ // $FlowFixMe[incompatible-type] this has already been refined.
918
resolve(formData);
919
}
920
}
@@ -992,7 +993,7 @@ function defaultEncodeFormAction(
993
const prefixedData = new FormData();
994
// $FlowFixMe[prop-missing]
995
encodedFormData.forEach((value: string | File, key: string) => {
995
- // $FlowFixMe[incompatible-call]
996
+ // $FlowFixMe[incompatible-type]
997
prefixedData.append('$ACTION_' + identifierPrefix + ':' + key, value);
998
});
999
data = prefixedData;
@@ -1023,6 +1024,7 @@ function customEncodeFormAction(
1024
);
1025
}
1026
let boundPromise: Promise<Array<any>> = (referenceClosure.bound: any);
1027
+ // $FlowFixMe[invalid-compare]
1028
if (boundPromise === null) {
1029
boundPromise = Promise.resolve([]);
1030
}
@@ -1202,6 +1204,7 @@ export function registerBoundServerReference<T: Function>(
1204
1205
// Expose encoder for use by SSR, as well as a special bind that can be used to
1206
// keep server capabilities.
1207
+ // $FlowFixMe[constant-condition]
1208
if (usedWithSSR) {
1209
// Only expose this in builds that would actually use it. Not needed in the browser.
1210
const $$FORM_ACTION =
@@ -1242,7 +1245,7 @@ function bind(this: Function): Function {
1245
const referenceClosure = knownServerReferences.get(this);
1246
1247
if (!referenceClosure) {
1245
- // $FlowFixMe[incompatible-call]
1248
+ // $FlowFixMe[incompatible-type]
1249
return FunctionBind.apply(this, arguments);
1250
}
1251
@@ -1278,6 +1281,7 @@ function bind(this: Function): Function {
1281
1282
// Expose encoder for use by SSR, as well as a special bind that can be used to
1283
// keep server capabilities.
1284
+ // $FlowFixMe[constant-condition]
1285
if (usedWithSSR) {
1286
// Only expose this in builds that would actually use it. Not needed on the client.
1287
Object.defineProperties((newFn: any), {
packages/react-debug-tools/src/ReactDebugHooks.js
+5
-1
@@ -200,6 +200,7 @@ const SuspenseException: mixed = new Error(
200
);
201
202
function use<T>(usable: Usable<T>): T {
203
+ // $FlowFixMe[invalid-compare]
204
if (usable !== null && typeof usable === 'object') {
205
// $FlowFixMe[method-unbinding]
206
if (typeof usable.then === 'function') {
@@ -729,8 +730,9 @@ function useActionState<S, P>(
730
function useHostTransitionStatus(): TransitionStatus {
731
const status = readContext<TransitionStatus>(
732
// $FlowFixMe[prop-missing] `readContext` only needs _currentValue
733
+ // $FlowFixMe[incompatible-type]
734
({
733
- // $FlowFixMe[incompatible-cast] TODO: Incorrect bottom value without access to Fiber config.
735
+ // $FlowFixMe[incompatible-type] TODO: Incorrect bottom value without access to Fiber config.
736
_currentValue: null,
737
}: ReactContext<TransitionStatus>),
738
);
@@ -1341,10 +1343,12 @@ export function inspectHooksOfFiber(
1343
} else if (hasOwnProperty.call(currentFiber, 'dependencies_old')) {
1344
const dependencies: Dependencies = (currentFiber: any).dependencies_old;
1345
currentContextDependency =
1346
+ // $FlowFixMe[invalid-compare]
1347
dependencies !== null ? dependencies.firstContext : null;
1348
} else if (hasOwnProperty.call(currentFiber, 'dependencies_new')) {
1349
const dependencies: Dependencies = (currentFiber: any).dependencies_new;
1350
currentContextDependency =
1351
+ // $FlowFixMe[invalid-compare]
1352
dependencies !== null ? dependencies.firstContext : null;
1353
} else if (hasOwnProperty.call(currentFiber, 'contextDependencies')) {
1354
const contextDependencies = (currentFiber: any).contextDependencies;
packages/react-devtools-core/src/backend.js
+9
-2
@@ -51,6 +51,7 @@ let savedComponentFilters: Array<ComponentFilter> =
51
getDefaultComponentFilters();
52
53
function debug(methodName: string, ...args: Array<mixed>) {
54
+ // $FlowFixMe[constant-condition]
55
if (__DEBUG__) {
56
console.log(
57
`%c[core/backend] %c${methodName}`,
@@ -154,12 +155,14 @@ export function connectToDevTools(options: ?ConnectOptions) {
155
},
156
send(event: string, payload: any, transferable?: Array<any>) {
157
if (ws.readyState === ws.OPEN) {
158
+ // $FlowFixMe[constant-condition]
159
if (__DEBUG__) {
160
debug('wall.send()', event, payload);
161
}
162
163
ws.send(JSON.stringify({event, payload}));
164
} else {
165
+ // $FlowFixMe[constant-condition]
166
if (__DEBUG__) {
167
debug(
168
'wall.send()',
@@ -186,7 +189,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
189
);
190
191
// TODO (npm-packages) Warn if "isBackendStorageAPISupported"
189
- // $FlowFixMe[incompatible-call] found when upgrading Flow
192
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
193
const agent = new Agent(bridge, isProfiling, onReloadAndProfile);
194
if (typeof onReloadAndProfileFlagsReset === 'function') {
195
onReloadAndProfileFlagsReset();
@@ -210,9 +213,10 @@ export function connectToDevTools(options: ?ConnectOptions) {
213
// Setup React Native style editor if the environment supports it.
214
if (resolveRNStyle != null || hook.resolveRNStyle != null) {
215
setupNativeStyleEditor(
213
- // $FlowFixMe[incompatible-call] found when upgrading Flow
216
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
217
bridge,
218
agent,
219
+ // $FlowFixMe[constant-condition]
220
((resolveRNStyle || hook.resolveRNStyle: any): ResolveNativeStyle),
221
nativeStyleEditorValidAttributes ||
222
hook.nativeStyleEditorValidAttributes ||
@@ -272,6 +276,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
276
};
277
278
function handleClose() {
279
+ // $FlowFixMe[constant-condition]
280
if (__DEBUG__) {
281
debug('WebSocket.onclose');
282
}
@@ -284,6 +289,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
289
}
290
291
function handleFailed() {
292
+ // $FlowFixMe[constant-condition]
293
if (__DEBUG__) {
294
debug('WebSocket.onerror');
295
}
@@ -296,6 +302,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
302
try {
303
if (typeof event.data === 'string') {
304
data = JSON.parse(event.data);
305
+ // $FlowFixMe[constant-condition]
306
if (__DEBUG__) {
307
debug('WebSocket.onmessage', data);
308
}
packages/react-devtools-core/src/standalone.js
+3
-1
@@ -83,6 +83,7 @@ log.error = (...args: Array<mixed>) =>
83
console.error('[React DevTools]', ...args);
84
85
function debug(methodName: string, ...args: Array<mixed>) {
86
+ // $FlowFixMe[constant-condition]
87
if (__DEBUG__) {
88
console.log(
89
`%c[core/standalone] %c${methodName}`,
@@ -225,6 +226,7 @@ function initialize(socket: WebSocket) {
226
if (typeof event.data === 'string') {
227
data = JSON.parse(event.data);
228
229
+ // $FlowFixMe[constant-condition]
230
if (__DEBUG__) {
231
debug('WebSocket.onmessage', data);
232
}
@@ -265,7 +267,7 @@ function initialize(socket: WebSocket) {
267
socket.close();
268
});
269
268
- // $FlowFixMe[incompatible-call] found when upgrading Flow
270
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
271
store = new Store(bridge, {
272
checkBridgeProtocolCompatibility: true,
273
supportsTraceUpdates: true,
packages/react-devtools-extensions/src/background/index.js
+1
-1
@@ -94,7 +94,7 @@ chrome.runtime.onConnect.addListener(port => {
94
registerTab(tabId);
95
registerProxyPort(
96
port,
97
- // $FlowFixMe[incompatible-call]
97
+ // $FlowFixMe[incompatible-type]
98
tabId,
99
);
100
packages/react-devtools-extensions/src/main/evalInInspectedWindow.js
+2
@@ -50,6 +50,7 @@ function fallbackEvalInInspectedWindow(
50
});
51
const timeout = setTimeout(() => {
52
evalRequestCallbacks.delete(requestId);
53
+ // $FlowFixMe[constant-condition]
54
if (callback) {
55
callback(null, {
56
code,
@@ -64,6 +65,7 @@ function fallbackEvalInInspectedWindow(
65
evalRequestCallbacks.set(requestId, ({result, error}) => {
66
clearTimeout(timeout);
67
evalRequestCallbacks.delete(requestId);
68
+ // $FlowFixMe[constant-condition]
69
if (callback) {
70
if (error) {
71
callback(null, {
packages/react-devtools-extensions/src/main/index.js
+1
@@ -453,6 +453,7 @@ function performInTabNavigationCleanup() {
453
// Potentially, if react hasn't loaded yet and user performs in-tab navigation
454
clearReactPollingInstance();
455
456
+ // $FlowFixMe[invalid-compare]
457
if (store !== null) {
458
// Store profiling data, so it can be used later
459
profilingData = store.profilerStore.profilingData;
packages/react-devtools-shared/src/Logger.js
+1
@@ -84,6 +84,7 @@ export const logEvent: LogFunction =
84
export const registerEventLogger: (logFunction: LogFunction) => () => void =
85
enableLogger === true
86
? function registerEventLogger(logFunction: LogFunction): () => void {
87
+ // $FlowFixMe[constant-condition]
88
if (enableLogger) {
89
logFunctions.push(logFunction);
90
return function unregisterEventLogger() {
packages/react-devtools-shared/src/PerformanceLoggingUtils.js
+6
@@ -48,11 +48,13 @@ export async function withAsyncPerfMeasurements<TReturn>(
48
onComplete?: number => void,
49
): Promise<TReturn> {
50
const start = now();
51
+ // $FlowFixMe[constant-condition]
52
if (__PERFORMANCE_PROFILE__) {
53
mark(markName);
54
}
55
const result = await callback();
56
57
+ // $FlowFixMe[constant-condition]
58
if (__PERFORMANCE_PROFILE__) {
59
measure(markName);
60
}
@@ -71,11 +73,13 @@ export function withSyncPerfMeasurements<TReturn>(
73
onComplete?: number => void,
74
): TReturn {
75
const start = now();
76
+ // $FlowFixMe[constant-condition]
77
if (__PERFORMANCE_PROFILE__) {
78
mark(markName);
79
}
80
const result = callback();
81
82
+ // $FlowFixMe[constant-condition]
83
if (__PERFORMANCE_PROFILE__) {
84
measure(markName);
85
}
@@ -94,11 +98,13 @@ export function withCallbackPerfMeasurements<TReturn>(
98
onComplete?: number => void,
99
): TReturn {
100
const start = now();
101
+ // $FlowFixMe[constant-condition]
102
if (__PERFORMANCE_PROFILE__) {
103
mark(markName);
104
}
105
106
const done = () => {
107
+ // $FlowFixMe[constant-condition]
108
if (__PERFORMANCE_PROFILE__) {
109
measure(markName);
110
}
packages/react-devtools-shared/src/backend/agent.js
+3
@@ -46,6 +46,7 @@ import {
46
} from '../storage';
47
48
const debug = (methodName: string, ...args: Array<string>) => {
49
+ // $FlowFixMe[constant-condition]
50
if (__DEBUG__) {
51
console.log(
52
`%cAgent %c${methodName}`,
@@ -1110,6 +1111,7 @@ export default class Agent extends EventEmitter<{
1111
};
1112
1113
onFastRefreshScheduled: () => void = () => {
1114
+ // $FlowFixMe[constant-condition]
1115
if (__DEBUG__) {
1116
debug('onFastRefreshScheduled');
1117
}
@@ -1118,6 +1120,7 @@ export default class Agent extends EventEmitter<{
1120
};
1121
1122
onHookOperations: (operations: Array<number>) => void = operations => {
1123
+ // $FlowFixMe[constant-condition]
1124
if (__DEBUG__) {
1125
debug(
1126
'onHookOperations',
packages/react-devtools-shared/src/backend/fiber/renderer.js
+27
-6
@@ -765,6 +765,7 @@ export function attach(
765
parentInstance: null | DevToolsInstance,
766
extraString: string = '',
767
): void {
768
+ // $FlowFixMe[constant-condition]
769
if (__DEBUG__) {
770
const displayName =
771
instance.kind === VIRTUAL_INSTANCE
@@ -807,6 +808,7 @@ export function attach(
808
809
// eslint-disable-next-line no-unused-vars
810
function debugTree(instance: DevToolsInstance, indent: number = 0) {
811
+ // $FlowFixMe[constant-condition]
812
if (__DEBUG__) {
813
const name =
814
(instance.kind !== VIRTUAL_INSTANCE
@@ -1768,6 +1770,7 @@ export function attach(
1770
}
1771
idToDevToolsInstanceMap.set(fiberInstance.id, fiberInstance);
1772
1773
+ // $FlowFixMe[constant-condition]
1774
if (__DEBUG__) {
1775
debug('recordMount()', fiberInstance, parentInstance);
1776
}
@@ -2078,6 +2081,7 @@ export function attach(
2081
const isSuspended =
2082
fiber.tag === SuspenseComponent && fiber.memoizedState !== null;
2083
2084
+ // $FlowFixMe[constant-condition]
2085
if (__DEBUG__) {
2086
console.log('recordSuspenseMount()', suspenseInstance);
2087
}
@@ -2106,6 +2110,7 @@ export function attach(
2110
}
2111
2112
function recordUnmount(fiberInstance: FiberInstance): void {
2113
+ // $FlowFixMe[constant-condition]
2114
if (__DEBUG__) {
2115
debug('recordUnmount()', fiberInstance, reconcilingParent);
2116
}
@@ -2140,6 +2145,7 @@ export function attach(
2145
}
2146
2147
function recordSuspenseResize(suspenseNode: SuspenseNode): void {
2148
+ // $FlowFixMe[constant-condition]
2149
if (__DEBUG__) {
2150
console.log('recordSuspenseResize()', suspenseNode);
2151
}
@@ -2167,6 +2173,7 @@ export function attach(
2173
}
2174
2175
function recordSuspenseSuspenders(suspenseNode: SuspenseNode): void {
2176
+ // $FlowFixMe[constant-condition]
2177
if (__DEBUG__) {
2178
console.log('recordSuspenseSuspenders()', suspenseNode);
2179
}
@@ -2187,6 +2194,7 @@ export function attach(
2194
}
2195
2196
function recordSuspenseUnmount(suspenseInstance: SuspenseNode): void {
2197
+ // $FlowFixMe[constant-condition]
2198
if (__DEBUG__) {
2199
console.log(
2200
'recordSuspenseUnmount()',
@@ -2335,6 +2343,7 @@ export function attach(
2343
return;
2344
}
2345
let node: SuspenseNode = firstChild;
2346
+ // $FlowFixMe[invalid-compare]
2347
while (node !== null) {
2348
if (node.suspendedBy.has(ioInfo)) {
2349
// We have found a child boundary that depended on the unblocked I/O.
@@ -2993,7 +3002,7 @@ export function attach(
3002
start,
3003
end,
3004
value: promise,
2996
- // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3005
+ // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
3006
owner: fiber, // Allow linking to the <link> if it's not filtered.
3007
};
3008
if (byteSize > 0) {
@@ -3002,7 +3011,7 @@ export function attach(
3011
}
3012
const asyncInfo: ReactAsyncInfo = {
3013
awaited: ioInfo,
3005
- // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3014
+ // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
3015
owner: fiber._debugOwner == null ? null : fiber._debugOwner,
3016
debugStack: fiber._debugStack == null ? null : fiber._debugStack,
3017
debugTask: fiber._debugTask == null ? null : fiber._debugTask,
@@ -3109,7 +3118,7 @@ export function attach(
3118
start,
3119
end,
3120
value: promise,
3112
- // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3121
+ // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
3122
owner: fiber, // Allow linking to the <link> if it's not filtered.
3123
};
3124
if (byteSize > 0) {
@@ -3118,7 +3127,7 @@ export function attach(
3127
}
3128
const asyncInfo: ReactAsyncInfo = {
3129
awaited: ioInfo,
3121
- // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3130
+ // $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
3131
owner: fiber._debugOwner == null ? null : fiber._debugOwner,
3132
debugStack: fiber._debugStack == null ? null : fiber._debugStack,
3133
debugTask: fiber._debugTask == null ? null : fiber._debugTask,
@@ -3360,6 +3369,7 @@ export function attach(
3369
recordSuspenseMount(newSuspenseNode, reconcilingParentSuspenseNode);
3370
}
3371
insertChild(newInstance);
3372
+ // $FlowFixMe[constant-condition]
3373
if (__DEBUG__) {
3374
debug('mountFiberRecursively()', newInstance, reconcilingParent);
3375
}
@@ -3420,6 +3430,7 @@ export function attach(
3430
}
3431
}
3432
insertChild(newInstance);
3433
+ // $FlowFixMe[constant-condition]
3434
if (__DEBUG__) {
3435
debug('mountFiberRecursively()', newInstance, reconcilingParent);
3436
}
@@ -3620,6 +3631,7 @@ export function attach(
3631
// We use this to simulate unmounting for Suspense trees
3632
// when we switch from primary to fallback, or deleting a subtree.
3633
function unmountInstanceRecursively(instance: DevToolsInstance) {
3634
+ // $FlowFixMe[constant-condition]
3635
if (__DEBUG__) {
3636
debug('unmountInstanceRecursively()', instance, reconcilingParent);
3637
}
@@ -3655,6 +3667,7 @@ export function attach(
3667
isInFocusedActivity = true;
3668
} else if (
3669
instance.kind === FIBER_INSTANCE &&
3670
+ // $FlowFixMe[invalid-compare]
3671
instance.data !== null &&
3672
instance.data.tag === ActivityComponent
3673
) {
@@ -3871,6 +3884,7 @@ export function attach(
3884
function recordResetChildren(
3885
parentInstance: FiberInstance | VirtualInstance,
3886
) {
3887
+ // $FlowFixMe[constant-condition]
3888
if (__DEBUG__) {
3889
if (parentInstance.firstChild !== null) {
3890
debug(
@@ -3916,6 +3930,7 @@ export function attach(
3930
}
3931
3932
function recordResetSuspenseChildren(parentInstance: SuspenseNode) {
3933
+ // $FlowFixMe[constant-condition]
3934
if (__DEBUG__) {
3935
if (parentInstance.firstChild !== null) {
3936
console.log(
@@ -3939,6 +3954,7 @@ export function attach(
3954
}
3955
pushOperation(SUSPENSE_TREE_OPERATION_REORDER_CHILDREN);
3956
// $FlowFixMe[incompatible-call] TODO: Allow filtering SuspenseNode
3957
+ // $FlowFixMe[incompatible-type]
3958
pushOperation(parentInstance.instance.id);
3959
pushOperation(numChildren);
3960
for (let i = 0; i < nextChildren.length; i++) {
@@ -4365,6 +4381,7 @@ export function attach(
4381
prevFiber: Fiber,
4382
traceNearestHostComponentUpdate: boolean,
4383
): UpdateFlags {
4384
+ // $FlowFixMe[constant-condition]
4385
if (__DEBUG__) {
4386
if (fiberInstance !== null) {
4387
debug('updateFiberRecursively()', fiberInstance, reconcilingParent);
@@ -5341,7 +5358,7 @@ export function attach(
5358
function getNearestMountedDOMNode(publicInstance: Element): null | Element {
5359
let domNode: null | Element = publicInstance;
5360
while (domNode && !publicInstanceToDevToolsInstanceMap.has(domNode)) {
5344
- // $FlowFixMe: In practice this is either null or Element.
5361
+ // $FlowFixMe[incompatible-type]: In practice this is either null or Element.
5362
domNode = domNode.parentNode;
5363
}
5364
return domNode;
@@ -6045,6 +6062,7 @@ export function attach(
6062
}
6063
6064
const fiber = devtoolsInstance.data;
6065
+ // $FlowFixMe[invalid-compare]
6066
if (fiber !== null) {
6067
instance = fiber.stateNode;
6068
@@ -7025,6 +7043,7 @@ export function attach(
7043
return;
7044
}
7045
const fiber = devtoolsInstance.data;
7046
+ // $FlowFixMe[invalid-compare]
7047
if (fiber !== null) {
7048
const instance = fiber.stateNode;
7049
@@ -7095,6 +7114,7 @@ export function attach(
7114
return;
7115
}
7116
const fiber = devtoolsInstance.data;
7117
+ // $FlowFixMe[invalid-compare]
7118
if (fiber !== null) {
7119
const instance = fiber.stateNode;
7120
@@ -7178,6 +7198,7 @@ export function attach(
7198
return;
7199
}
7200
const fiber = devtoolsInstance.data;
7201
+ // $FlowFixMe[invalid-compare]
7202
if (fiber !== null) {
7203
const instance = fiber.stateNode;
7204
@@ -8102,7 +8123,7 @@ export function attach(
8123
return (instance.source = extractLocationFromComponentStack(lastLine));
8124
}
8125
8105
- // $FlowFixMe: refined.
8126
+ // $FlowFixMe[incompatible-type]: refined.
8127
return unresolvedSource;
8128
}
8129
packages/react-devtools-shared/src/backend/fiber/shared/DevToolsFiberInternalReactConstants.js
+16
@@ -385,12 +385,16 @@ export function getInternalReactConstants(version: string): {
385
}
386
387
switch (tag) {
388
+ // $FlowFixMe[invalid-compare]
389
case ActivityComponent:
390
return 'Activity';
391
+ // $FlowFixMe[invalid-compare]
392
case CacheComponent:
393
return 'Cache';
394
case ClassComponent:
395
+ // $FlowFixMe[invalid-compare] -- falls through
396
case IncompleteClassComponent:
397
+ // $FlowFixMe[invalid-compare] -- falls through
398
case IncompleteFunctionComponent:
399
case FunctionComponent:
400
case IndeterminateComponent:
@@ -409,7 +413,9 @@ export function getInternalReactConstants(version: string): {
413
}
414
return null;
415
case HostComponent:
416
+ // $FlowFixMe[invalid-compare] -- falls through
417
case HostSingleton:
418
+ // $FlowFixMe[invalid-compare] -- falls through
419
case HostHoistable:
420
return type;
421
case HostPortal:
@@ -417,12 +423,15 @@ export function getInternalReactConstants(version: string): {
423
return null;
424
case Fragment:
425
return 'Fragment';
426
+ // $FlowFixMe[invalid-compare]
427
case LazyComponent:
428
// This display name will not be user visible.
429
// Once a Lazy component loads its inner component, React replaces the tag and type.
430
// This display name will only show up in console logs when DevTools DEBUG mode is on.
431
return 'Lazy';
432
+ // $FlowFixMe[invalid-compare]
433
case MemoComponent:
434
+ // $FlowFixMe[invalid-compare] -- falls through
435
case SimpleMemoComponent:
436
// Display name in React does not use `Memo` as a wrapper but fallback name.
437
return getWrappedDisplayName(
@@ -433,20 +442,27 @@ export function getInternalReactConstants(version: string): {
442
);
443
case SuspenseComponent:
444
return 'Suspense';
445
+ // $FlowFixMe[invalid-compare]
446
case LegacyHiddenComponent:
447
return 'LegacyHidden';
448
+ // $FlowFixMe[invalid-compare]
449
case OffscreenComponent:
450
return 'Offscreen';
451
+ // $FlowFixMe[invalid-compare]
452
case ScopeComponent:
453
return 'Scope';
454
+ // $FlowFixMe[invalid-compare]
455
case SuspenseListComponent:
456
return 'SuspenseList';
457
case Profiler:
458
return 'Profiler';
459
+ // $FlowFixMe[invalid-compare]
460
case TracingMarkerComponent:
461
return 'TracingMarker';
462
+ // $FlowFixMe[invalid-compare]
463
case ViewTransitionComponent:
464
return 'ViewTransition';
465
+ // $FlowFixMe[invalid-compare]
466
case Throw:
467
// This should really never be visible.
468
return 'Error';
packages/react-devtools-shared/src/backend/legacy/renderer.js
+4
@@ -390,6 +390,7 @@ export function attach(
390
) {
391
const isRoot = parentID === 0;
392
393
+ // $FlowFixMe[constant-condition]
394
if (__DEBUG__) {
395
console.log(
396
'%crecordMount()',
@@ -472,6 +473,7 @@ export function attach(
473
parentID: number,
474
rootID: number,
475
) {
476
+ // $FlowFixMe[constant-condition]
477
if (__DEBUG__) {
478
console.group('crawlAndRecordInitialMounts() id:', id);
479
}
@@ -485,6 +487,7 @@ export function attach(
487
);
488
}
489
490
+ // $FlowFixMe[constant-condition]
491
if (__DEBUG__) {
492
console.groupEnd();
493
}
@@ -584,6 +587,7 @@ export function attach(
587
}
588
i += pendingOperations.length;
589
590
+ // $FlowFixMe[constant-condition]
591
if (__DEBUG__) {
592
printOperationsArray(operations);
593
}
packages/react-devtools-shared/src/backend/utils/formatWithStyles.js
+1
@@ -32,6 +32,7 @@ export default function formatWithStyles(
32
): $ReadOnlyArray<any> {
33
if (
34
inputArgs === undefined ||
35
+ // $FlowFixMe[invalid-compare]
36
inputArgs === null ||
37
inputArgs.length === 0 ||
38
// Matches any of %c but not %%c
packages/react-devtools-shared/src/backend/utils/index.js
+1
-1
@@ -195,7 +195,7 @@ export function formatConsoleArgumentsToSingleString(
195
if (args.length) {
196
const REGEXP = /(%?)(%([jds]))/g;
197
198
- // $FlowFixMe[incompatible-call]
198
+ // $FlowFixMe[incompatible-type]
199
formatted = formatted.replace(REGEXP, (match, escaped, ptn, flag) => {
200
let arg = args.shift();
201
switch (flag) {
packages/react-devtools-shared/src/backend/views/TraceUpdates/canvas.js
+1
-1
@@ -217,7 +217,7 @@ function destroyWeb() {
217
218
// $FlowFixMe[incompatible-use]: Flow doesn't recognize Popover API and loses canvas nullability tracking
219
if (canvas.parentNode != null) {
220
- // $FlowFixMe[incompatible-call]: Flow doesn't track that canvas is non-null here
220
+ // $FlowFixMe[incompatible-type]: Flow doesn't track that canvas is non-null here
221
canvas.parentNode.removeChild(canvas);
222
}
223
canvas = null;
packages/react-devtools-shared/src/backend/views/utils.js
+1
@@ -104,6 +104,7 @@ export function getNestedBoundingClientRect(
104
}
105
106
// $FlowFixMe[incompatible-variance]
107
+ // $FlowFixMe[incompatible-type]
108
return mergeRectOffsets(rects);
109
} else {
110
// $FlowFixMe[incompatible-variance]
packages/react-devtools-shared/src/bridge.js
+2
-2
@@ -361,13 +361,13 @@ class Bridge<
361
this._messageQueue.push(event, payload);
362
if (!this._scheduledFlush) {
363
this._scheduledFlush = true;
364
- // $FlowFixMe
364
+ // $FlowFixMe[cannot-resolve-name]
365
if (typeof devtoolsJestTestScheduler === 'function') {
366
// This exists just for our own jest tests.
367
// They're written in such a way that we can neither mock queueMicrotask
368
// because then we break React DOM and we can't not mock it because then
369
// we can't synchronously flush it. So they need to be rewritten.
370
- // $FlowFixMe
370
+ // $FlowFixMe[cannot-resolve-name]
371
devtoolsJestTestScheduler(this._flush); // eslint-disable-line no-undef
372
} else {
373
queueMicrotask(this._flush);
packages/react-devtools-shared/src/devtools/ContextMenu/types.js
+2
-1
@@ -26,6 +26,7 @@ export type ContextMenuHandle = {
26
};
27
28
export type ContextMenuComponent = component(
29
- ref: React$RefSetter<ContextMenuHandle>,
29
+ // eslint-disable-next-line no-undef
30
+ ref: React.RefSetter<ContextMenuHandle>,
31
);
32
export type ContextMenuRef = {current: ContextMenuHandle | null};
packages/react-devtools-shared/src/devtools/store.js
+18
@@ -96,6 +96,7 @@ class RectRBush extends RBush<Rect> {
96
}
97
98
const debug = (methodName: string, ...args: Array<string>) => {
99
+ // $FlowFixMe[constant-condition]
100
if (__DEBUG__) {
101
console.log(
102
`%cStore %c${methodName}`,
@@ -273,6 +274,7 @@ export default class Store extends EventEmitter<{
274
constructor(bridge: FrontendBridge, config?: Config) {
275
super();
276
277
+ // $FlowFixMe[constant-condition]
278
if (__DEBUG__) {
279
debug('constructor', 'subscribing to Bridge');
280
}
@@ -1055,6 +1057,7 @@ export default class Store extends EventEmitter<{
1057
): Array<SuspenseTimelineStep> {
1058
const target: Array<SuspenseTimelineStep> = [];
1059
const focusedTransitionID = this._focusedTransition;
1060
+ // $FlowFixMe[invalid-compare]
1061
if (focusedTransitionID === null) {
1062
return target;
1063
}
@@ -1373,6 +1376,7 @@ export default class Store extends EventEmitter<{
1376
};
1377
1378
onBridgeOperations: (operations: Array<number>) => void = operations => {
1379
+ // $FlowFixMe[constant-condition]
1380
if (__DEBUG__) {
1381
console.groupCollapsed('onBridgeOperations');
1382
debug('onBridgeOperations', operations.join(','));
@@ -1435,6 +1439,7 @@ export default class Store extends EventEmitter<{
1439
}
1440
1441
if (type === ElementTypeRoot) {
1442
+ // $FlowFixMe[constant-condition]
1443
if (__DEBUG__) {
1444
debug('Add', `new root node ${id}`);
1445
}
@@ -1526,6 +1531,7 @@ export default class Store extends EventEmitter<{
1531
const nameProp = stringTable[namePropStringID];
1532
i++;
1533
1534
+ // $FlowFixMe[constant-condition]
1535
if (__DEBUG__) {
1536
debug(
1537
'Add',
@@ -1633,6 +1639,7 @@ export default class Store extends EventEmitter<{
1639
1640
let parentElement: ?Element = null;
1641
if (parentID === 0) {
1642
+ // $FlowFixMe[constant-condition]
1643
if (__DEBUG__) {
1644
debug('Remove', `node ${id} root`);
1645
}
@@ -1643,6 +1650,7 @@ export default class Store extends EventEmitter<{
1650
1651
haveRootsChanged = true;
1652
} else {
1653
+ // $FlowFixMe[constant-condition]
1654
if (__DEBUG__) {
1655
debug('Remove', `node ${id} from parent ${parentID}`);
1656
}
@@ -1721,6 +1729,7 @@ export default class Store extends EventEmitter<{
1729
}
1730
i += numChildren;
1731
1732
+ // $FlowFixMe[constant-condition]
1733
if (__DEBUG__) {
1734
debug('Re-order', `Node ${id} children ${children.join(',')}`);
1735
}
@@ -1776,6 +1785,7 @@ export default class Store extends EventEmitter<{
1785
}
1786
}
1787
1788
+ // $FlowFixMe[constant-condition]
1789
if (__DEBUG__) {
1790
debug(
1791
'Subtree mode',
@@ -1858,6 +1868,7 @@ export default class Store extends EventEmitter<{
1868
}
1869
}
1870
1871
+ // $FlowFixMe[constant-condition]
1872
if (__DEBUG__) {
1873
debug('Suspense Add', `node ${id} as child of ${parentID}`);
1874
}
@@ -1931,10 +1942,12 @@ export default class Store extends EventEmitter<{
1942
1943
let parentSuspense: ?SuspenseNode = null;
1944
if (parentID === 0) {
1945
+ // $FlowFixMe[constant-condition]
1946
if (__DEBUG__) {
1947
debug('Suspense remove', `node ${id} root`);
1948
}
1949
} else {
1950
+ // $FlowFixMe[constant-condition]
1951
if (__DEBUG__) {
1952
debug('Suspense Remove', `node ${id} from parent ${parentID}`);
1953
}
@@ -2005,6 +2018,7 @@ export default class Store extends EventEmitter<{
2018
}
2019
i += numChildren;
2020
2021
+ // $FlowFixMe[constant-condition]
2022
if (__DEBUG__) {
2023
debug(
2024
'Re-order',
@@ -2063,6 +2077,7 @@ export default class Store extends EventEmitter<{
2077
2078
suspense.rects = nextRects;
2079
2080
+ // $FlowFixMe[constant-condition]
2081
if (__DEBUG__) {
2082
debug(
2083
'Resize',
@@ -2117,6 +2132,7 @@ export default class Store extends EventEmitter<{
2132
break;
2133
}
2134
2135
+ // $FlowFixMe[constant-condition]
2136
if (__DEBUG__) {
2137
const previousHasUniqueSuspenders = suspense.hasUniqueSuspenders;
2138
debug(
@@ -2235,6 +2251,7 @@ export default class Store extends EventEmitter<{
2251
this.emit('suspenseTreeMutated', [removedSuspenseIDs]);
2252
}
2253
2254
+ // $FlowFixMe[constant-condition]
2255
if (__DEBUG__) {
2256
console.log(printStore(this, true));
2257
console.groupEnd();
@@ -2319,6 +2336,7 @@ export default class Store extends EventEmitter<{
2336
}
2337
2338
onBridgeShutdown: () => void = () => {
2339
+ // $FlowFixMe[constant-condition]
2340
if (__DEBUG__) {
2341
debug('onBridgeShutdown', 'unsubscribing from Bridge');
2342
}
packages/react-devtools-shared/src/devtools/views/Components/Element.js
+2
@@ -89,6 +89,7 @@ export default function Element({data, index, style}: Props): React.Node {
89
90
// $FlowFixMe[missing-local-annot]
91
const handleClick = ({metaKey, button}) => {
92
+ // $FlowFixMe[invalid-compare]
93
if (id !== null && button === 0) {
94
logEvent({
95
event_name: 'select-element',
@@ -103,6 +104,7 @@ export default function Element({data, index, style}: Props): React.Node {
104
105
const handleMouseEnter = () => {
106
setIsHovered(true);
107
+ // $FlowFixMe[invalid-compare]
108
if (id !== null) {
109
onElementMouseEnter(id);
110
}
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContextTree.js
+3
@@ -70,13 +70,16 @@ export default function InspectedElementContextTree({
70
<div className={styles.Header}>
71
{hasLegacyContext ? 'legacy context' : 'context'}
72
</div>
73
+ {/* $FlowFixMe[constant-condition] */}
74
{!isEmpty && (
75
<Button onClick={handleCopy} title="Copy to clipboard">
76
<ButtonIcon type="copy" />
77
</Button>
78
)}
79
</div>
80
+ {/* $FlowFixMe[constant-condition] */}
81
{isEmpty && <div className={styles.Empty}>None</div>}
82
+ {/* $FlowFixMe[constant-condition] */}
83
{!isEmpty &&
84
(entries: any).map(([name, value]) => (
85
<KeyValue
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementStateTree.js
+3
@@ -58,13 +58,16 @@ export default function InspectedElementStateTree({
58
<div>
59
<div className={styles.HeaderRow}>
60
<div className={styles.Header}>state</div>
61
+ {/* $FlowFixMe[constant-condition] */}
62
{!isEmpty && (
63
<Button onClick={handleCopy} title="Copy to clipboard">
64
<ButtonIcon type="copy" />
65
</Button>
66
)}
67
</div>
68
+ {/* $FlowFixMe[constant-condition] */}
69
{isEmpty && <div className={styles.Empty}>None</div>}
70
+ {/* $FlowFixMe[constant-condition] */}
71
{!isEmpty &&
72
(entries: any).map(([name, value]) => (
73
<KeyValue
packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js
+1
@@ -558,6 +558,7 @@ export default function KeyValue({
558
}
559
}
560
561
+ // $FlowFixMe[incompatible-type]
562
return children;
563
}
564
packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js
+2
-2
@@ -57,7 +57,7 @@ const resource: Resource<
57
resolveFn = resolve;
58
});
59
60
- // $FlowFixMe[incompatible-call] found when upgrading Flow
60
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
61
inProgressRequests.set(element, {promise, resolveFn});
62
63
return (promise: $FlowFixMe);
@@ -93,7 +93,7 @@ function useChangeOwnerAction(): (nextOwnerID: number) => void {
93
resolveFn = resolve;
94
});
95
96
- // $FlowFixMe[incompatible-call] found when upgrading Flow
96
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
97
inProgressRequests.set(element, {promise, resolveFn});
98
}
99
packages/react-devtools-shared/src/devtools/views/Components/Tree.js
+3
-2
@@ -132,7 +132,7 @@ export default function Tree(): React.Node {
132
Math.min(0, elementLeft - viewportLeft) +
133
Math.max(0, elementRight - viewportRight);
134
135
- // $FlowExpectedError[incompatible-call] Flow doesn't support instant as an option for behavior.
135
+ // $FlowExpectedError[incompatible-type] Flow doesn't support instant as an option for behavior.
136
listDOMElement.scrollBy({
137
left: horizontalDelta,
138
behavior: 'instant',
@@ -181,7 +181,7 @@ export default function Tree(): React.Node {
181
Math.min(0, elementLeft - viewportLeft) +
182
Math.max(0, elementRight - viewportRight);
183
184
- // $FlowExpectedError[incompatible-call] Flow doesn't support instant as an option for behavior.
184
+ // $FlowExpectedError[incompatible-type] Flow doesn't support instant as an option for behavior.
185
listDOMElement.scrollBy({
186
top: verticalDelta,
187
left: horizontalDelta,
@@ -237,6 +237,7 @@ export default function Tree(): React.Node {
237
: null;
238
if (element !== null) {
239
if (event.altKey) {
240
+ // $FlowFixMe[invalid-compare]
241
if (element.ownerID !== null) {
242
dispatch({type: 'SELECT_OWNER_LIST_PREVIOUS_ELEMENT_IN_TREE'});
243
}
packages/react-devtools-shared/src/devtools/views/Components/TreeContext.js
+3
@@ -552,6 +552,7 @@ function reduceSearchState(store: Store, state: State, action: Action): State {
552
553
// It's possible that multiple tree operations will fire before this action has run.
554
// So it's important to check for elements that may have been added and then removed.
555
+ // $FlowFixMe[invalid-compare]
556
if (element !== null) {
557
const {displayName} = element;
558
@@ -624,6 +625,7 @@ function reduceSearchState(store: Store, state: State, action: Action): State {
625
}
626
627
if (searchText !== prevSearchText) {
628
+ // $FlowFixMe[incompatible-type]
629
const newSearchIndex = searchResults.indexOf(inspectedElementID);
630
if (newSearchIndex === -1) {
631
// Only move the selection if the new query
@@ -721,6 +723,7 @@ function reduceOwnersState(store: Store, state: State, action: Action): State {
723
// If the selected element is outside of the current owners list,
724
// exit the list and select the element in the main tree.
725
// This supports features like toggling Suspense.
726
+ // $FlowFixMe[invalid-compare]
727
if (inspectedElementIndex !== null && inspectedElementIndex < 0) {
728
ownerID = null;
729
ownerFlatTree = null;
packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js
+18
@@ -37,6 +37,7 @@ import type {
37
} from 'react-devtools-shared/src/devtools/views/Profiler/types';
38
39
const debug = (methodName: string, ...args: Array<string>) => {
40
+ // $FlowFixMe[constant-condition]
41
if (__DEBUG__) {
42
console.log(
43
`%cCommitTreeBuilder %c${methodName}`,
@@ -101,6 +102,7 @@ export function getCommitTree({
102
if (operations != null && index < operations.length) {
103
commitTree = updateTree({nodes, rootID}, operations[index]);
104
105
+ // $FlowFixMe[constant-condition]
106
if (__DEBUG__) {
107
__printTree(commitTree);
108
}
@@ -111,6 +113,7 @@ export function getCommitTree({
113
const previousCommitTree = commitTrees[index - 1];
114
commitTree = updateTree(previousCommitTree, operations[index]);
115
116
+ // $FlowFixMe[constant-condition]
117
if (__DEBUG__) {
118
__printTree(commitTree);
119
}
@@ -213,6 +216,7 @@ function updateTree(
216
i++; // supportsStrictMode flag
217
i++; // hasOwnerMetadata flag
218
219
+ // $FlowFixMe[constant-condition]
220
if (__DEBUG__) {
221
debug('Add', `new root fiber ${id}`);
222
}
@@ -247,6 +251,7 @@ function updateTree(
251
// skip name prop
252
i++;
253
254
+ // $FlowFixMe[constant-condition]
255
if (__DEBUG__) {
256
debug(
257
'Add',
@@ -301,6 +306,7 @@ function updateTree(
306
} else {
307
const parentNode = getClonedNode(parentID);
308
309
+ // $FlowFixMe[constant-condition]
310
if (__DEBUG__) {
311
debug('Remove', `fiber ${id} from parent ${parentID}`);
312
}
@@ -322,6 +328,7 @@ function updateTree(
328
329
i = i + 3 + numChildren;
330
331
+ // $FlowFixMe[constant-condition]
332
if (__DEBUG__) {
333
debug('Re-order', `fiber ${id} children ${children.join(',')}`);
334
}
@@ -337,6 +344,7 @@ function updateTree(
344
345
i += 3;
346
347
+ // $FlowFixMe[constant-condition]
348
if (__DEBUG__) {
349
debug('Subtree mode', `Subtree with root ${id} set to mode ${mode}`);
350
}
@@ -348,6 +356,7 @@ function updateTree(
356
const node = getClonedNode(id);
357
node.treeBaseDuration = operations[i + 2] / 1000; // Convert microseconds back to milliseconds;
358
359
+ // $FlowFixMe[constant-condition]
360
if (__DEBUG__) {
361
debug(
362
'Update',
@@ -365,6 +374,7 @@ function updateTree(
374
375
i += 4;
376
377
+ // $FlowFixMe[constant-condition]
378
if (__DEBUG__) {
379
debug(
380
'Warnings and Errors update',
@@ -382,6 +392,7 @@ function updateTree(
392
const numRects = operations[i + 5];
393
const name = stringTable[nameStringID];
394
395
+ // $FlowFixMe[constant-condition]
396
if (__DEBUG__) {
397
let rects: string;
398
if (numRects === -1) {
@@ -419,6 +430,7 @@ function updateTree(
430
431
i = i + 3 + numChildren;
432
433
+ // $FlowFixMe[constant-condition]
434
if (__DEBUG__) {
435
debug(
436
'Suspense re-order',
@@ -433,6 +445,7 @@ function updateTree(
445
const suspenseID = ((operations[i + 1]: any): number);
446
const numRects = ((operations[i + 2]: any): number);
447
448
+ // $FlowFixMe[constant-condition]
449
if (__DEBUG__) {
450
if (numRects === -1) {
451
debug('Suspense resize', `suspense ${suspenseID} rects null`);
@@ -464,6 +477,7 @@ function updateTree(
477
const isSuspended = operations[i++] === 1;
478
const environmentNamesLength = operations[i++];
479
i += environmentNamesLength;
480
+ // $FlowFixMe[constant-condition]
481
if (__DEBUG__) {
482
debug(
483
'Suspender changes',
@@ -478,6 +492,7 @@ function updateTree(
492
case TREE_OPERATION_APPLIED_ACTIVITY_SLICE_CHANGE: {
493
i++;
494
const activitySliceIDChange = operations[i++];
495
+ // $FlowFixMe[constant-condition]
496
if (__DEBUG__) {
497
debug(
498
'Applied activity slice change',
@@ -506,6 +521,7 @@ export function invalidateCommitTrees(): void {
521
522
// DEBUG
523
const __printTree = (commitTree: CommitTree) => {
524
+ // $FlowFixMe[constant-condition]
525
if (__DEBUG__) {
526
const {nodes, rootID} = commitTree;
527
console.group('__printTree()');
@@ -515,6 +531,7 @@ const __printTree = (commitTree: CommitTree) => {
531
const depth = queue.shift();
532
533
// $FlowFixMe[incompatible-call]
534
+ // $FlowFixMe[incompatible-type]
535
const node = nodes.get(id);
536
if (node == null) {
537
// $FlowFixMe[incompatible-type]
@@ -523,6 +540,7 @@ const __printTree = (commitTree: CommitTree) => {
540
541
console.log(
542
// $FlowFixMe[incompatible-call]
543
+ // $FlowFixMe[incompatible-type]
544
`${'•'.repeat(depth)}${node.id}:${node.displayName || ''} ${
545
node.key ? `key:"${node.key}"` : ''
546
} (${node.treeBaseDuration})`,
packages/react-devtools-shared/src/devtools/views/Profiler/HookChangeSummary.js
+2
-1
@@ -27,7 +27,7 @@ import Toggle from '../Toggle';
27
import type {HooksNode} from 'react-debug-tools/src/ReactDebugHooks';
28
import type {ChangeDescription} from './types';
29
30
-// $FlowFixMe: Flow doesn't know about Intl.ListFormat
30
+// $FlowFixMe[cannot-resolve-name]: Flow doesn't know about Intl.ListFormat
31
const hookListFormatter = new Intl.ListFormat('en', {
32
style: 'long',
33
type: 'conjunction',
@@ -133,6 +133,7 @@ const HookChangeSummary: component(...props: Props) = memo(
133
toggleParseHookNames();
134
}, [toggleParseHookNames, parseHookNames]);
135
136
+ // $FlowFixMe[invalid-compare]
137
const element = fiberID !== null ? store.getElementByID(fiberID) : null;
138
const hookNames =
139
element != null ? getAlreadyLoadedHookNames(element) : null;
packages/react-devtools-shared/src/devtools/views/Profiler/SidebarSelectedFiberInfo.js
+2
@@ -67,6 +67,7 @@ export default function SidebarSelectedFiberInfo(): React.Node {
67
const handleKeyDown = event => {
68
switch (event.key) {
69
case 'ArrowUp':
70
+ // $FlowFixMe[invalid-compare]
71
if (selectedCommitIndex !== null) {
72
const prevIndex = commitIndices.indexOf(selectedCommitIndex);
73
const nextIndex =
@@ -76,6 +77,7 @@ export default function SidebarSelectedFiberInfo(): React.Node {
77
event.preventDefault();
78
break;
79
case 'ArrowDown':
80
+ // $FlowFixMe[invalid-compare]
81
if (selectedCommitIndex !== null) {
82
const prevIndex = commitIndices.indexOf(selectedCommitIndex);
83
const nextIndex =
packages/react-devtools-shared/src/devtools/views/Profiler/Tooltip.js
+1
@@ -101,6 +101,7 @@ function getMousePosition(
101
// Position within the nearest position:relative container.
102
let targetContainer = relativeContainer;
103
while (targetContainer.parentElement != null) {
104
+ // $FlowFixMe[invalid-compare]
105
if (targetContainer.style.position === 'relative') {
106
break;
107
} else {
packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseBreadcrumbs.js
+1
@@ -189,6 +189,7 @@ function SuspenseBreadcrumbsMenu({
189
)}
190
onPointerLeave={onItemPointerLeave}
191
type="button">
192
+ {/* $FlowFixMe[invalid-compare] */}
193
{selectedSuspenseNode === null
194
? 'Unknown'
195
: selectedSuspenseNode.name || 'Unknown'}
packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseRects.js
+1
@@ -522,6 +522,7 @@ function SuspenseRectsContainer({
522
});
523
}
524
525
+ // $FlowFixMe[incompatible-type]
526
const isRootSelected = roots.includes(inspectedElementID);
527
// When we're focusing a Transition, the first timeline step will not be a root.
528
const isRootHovered = activityID === null && hoveredTimelineIndex === 0;
packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js
+5
-2
@@ -168,15 +168,16 @@ function SuspenseTreeContextController({children}: Props): React.Node {
168
}
169
170
const selectedTimelineStep =
171
+ // $FlowFixMe[invalid-compare]
172
state.timeline === null || state.timelineIndex === -1
173
? null
174
: state.timeline[state.timelineIndex];
175
let selectedTimelineID: null | number = null;
176
if (selectedTimelineStep !== null) {
177
selectedTimelineID = selectedTimelineStep.id;
177
- // $FlowFixMe
178
+ // $FlowFixMe[incompatible-type]
179
while (removedIDs.has(selectedTimelineID)) {
179
- // $FlowFixMe
180
+ // $FlowFixMe[incompatible-type]
181
selectedTimelineID = removedIDs.get(selectedTimelineID);
182
}
183
}
@@ -258,7 +259,9 @@ function SuspenseTreeContextController({children}: Props): React.Node {
259
// Try to reconcile the new timeline with the previous index.
260
if (
261
nextRootID === null &&
262
+ // $FlowFixMe[invalid-compare]
263
previousTimeline !== null &&
264
+ // $FlowFixMe[invalid-compare]
265
previousMilestoneIndex !== null
266
) {
267
const previousMilestoneID =
packages/react-devtools-shared/src/devtools/views/hooks.js
+1
-1
@@ -243,7 +243,7 @@ export function useModalDismissSignal(
243
const handleRootNodeClick: MouseEventHandler = event => {
244
if (
245
modalRef.current !== null &&
246
- /* $FlowExpectedError[incompatible-call] Instead of dealing with possibly multiple realms
246
+ /* $FlowExpectedError[incompatible-type] Instead of dealing with possibly multiple realms
247
and multiple Node references to comply with Flow (e.g. checking with `event.target instanceof Node`)
248
just delegate it to contains call */
249
!modalRef.current.contains(event.target)
packages/react-devtools-shared/src/dynamicImportCache.js
+4
@@ -52,6 +52,7 @@ function readRecord<T>(record: Thenable<T>): T | null {
52
export function loadModule(moduleLoaderFunction: ModuleLoaderFunction): Module {
53
let record = moduleLoaderFunctionToModuleMap.get(moduleLoaderFunction);
54
55
+ // $FlowFixMe[constant-condition]
56
if (__DEBUG__) {
57
console.log(
58
`[dynamicImportCache] loadModule("${moduleLoaderFunction.name}")`,
@@ -103,6 +104,7 @@ export function loadModule(moduleLoaderFunction: ModuleLoaderFunction): Module {
104
105
moduleLoaderFunction().then(
106
module => {
107
+ // $FlowFixMe[constant-condition]
108
if (__DEBUG__) {
109
console.log(
110
`[dynamicImportCache] loadModule("${moduleLoaderFunction.name}") then()`,
@@ -120,6 +122,7 @@ export function loadModule(moduleLoaderFunction: ModuleLoaderFunction): Module {
122
wake();
123
},
124
error => {
125
+ // $FlowFixMe[constant-condition]
126
if (__DEBUG__) {
127
console.log(
128
`[dynamicImportCache] loadModule("${moduleLoaderFunction.name}") catch()`,
@@ -142,6 +145,7 @@ export function loadModule(moduleLoaderFunction: ModuleLoaderFunction): Module {
145
146
// Eventually timeout and stop trying to load the module.
147
let timeoutID: null | TimeoutID = setTimeout(function onTimeout() {
148
+ // $FlowFixMe[constant-condition]
149
if (__DEBUG__) {
150
console.log(
151
`[dynamicImportCache] loadModule("${moduleLoaderFunction.name}") onTimeout()`,
packages/react-devtools-shared/src/hook.js
+1
-1
@@ -433,7 +433,7 @@ export function installHook(
433
const startStackFrame = openModuleRangesStack.pop();
434
const stopStackFrame = getTopStackFrameString(error);
435
if (stopStackFrame !== null) {
436
- // $FlowFixMe[incompatible-call]
436
+ // $FlowFixMe[incompatible-type]
437
moduleRanges.push([startStackFrame, stopStackFrame]);
438
}
439
}
packages/react-devtools-shared/src/hookNamesCache.js
+4
@@ -80,6 +80,7 @@ export function loadHookNames(
80
): HookNames | null {
81
let record = map.get(element);
82
83
+ // $FlowFixMe[constant-condition]
84
if (__DEBUG__) {
85
console.groupCollapsed('loadHookNames() record:');
86
console.log(record);
@@ -151,6 +152,7 @@ export function loadHookNames(
152
return;
153
}
154
155
+ // $FlowFixMe[constant-condition]
156
if (__DEBUG__) {
157
console.log('[hookNamesCache] onSuccess() hookNames:', hookNames);
158
}
@@ -180,6 +182,7 @@ export function loadHookNames(
182
return;
183
}
184
185
+ // $FlowFixMe[constant-condition]
186
if (__DEBUG__) {
187
console.log('[hookNamesCache] onError()');
188
}
@@ -199,6 +202,7 @@ export function loadHookNames(
202
203
// Eventually timeout and stop trying to load names.
204
timeoutID = setTimeout(function onTimeout() {
205
+ // $FlowFixMe[constant-condition]
206
if (__DEBUG__) {
207
console.log('[hookNamesCache] onTimeout()');
208
}
packages/react-devtools-shared/src/hooks/parseHookNames/loadSourceAndMetadata.js
+11
@@ -128,6 +128,7 @@ function extractAndLoadSourceMapJSON(
128
// Deduplicate fetches, since there can be multiple location keys per source map.
129
const dedupedFetchPromises = new Map<string, Promise<$FlowFixMe>>();
130
131
+ // $FlowFixMe[constant-condition]
132
if (__DEBUG__) {
133
console.log(
134
'extractAndLoadSourceMapJSON() load',
@@ -154,6 +155,7 @@ function extractAndLoadSourceMapJSON(
155
);
156
157
if (sourceMappingURLMatch == null) {
158
+ // $FlowFixMe[constant-condition]
159
if (__DEBUG__) {
160
console.log('extractAndLoadSourceMapJSON() No source map found');
161
}
@@ -186,6 +188,7 @@ function extractAndLoadSourceMapJSON(
188
() => JSON.parse(decoded),
189
);
190
191
+ // $FlowFixMe[constant-condition]
192
if (__DEBUG__) {
193
console.groupCollapsed(
194
'extractAndLoadSourceMapJSON() Inline source map',
@@ -271,6 +274,7 @@ function extractAndLoadSourceMapJSON(
274
error => null,
275
);
276
277
+ // $FlowFixMe[constant-condition]
278
if (__DEBUG__) {
279
if (!dedupedFetchPromises.has(url)) {
280
console.log(
@@ -309,6 +313,7 @@ function fetchFile(
313
): Promise<string> {
314
return withCallbackPerfMeasurements(`${markName}("${url}")`, done => {
315
return new Promise((resolve, reject) => {
316
+ // $FlowFixMe[incompatible-type]
317
fetch(url, FETCH_OPTIONS).then(
318
response => {
319
if (response.ok) {
@@ -319,6 +324,7 @@ function fetchFile(
324
resolve(text);
325
})
326
.catch(error => {
327
+ // $FlowFixMe[constant-condition]
328
if (__DEBUG__) {
329
console.log(
330
`${markName}() Could not read text for url "${url}"`,
@@ -328,6 +334,7 @@ function fetchFile(
334
reject(null);
335
});
336
} else {
337
+ // $FlowFixMe[constant-condition]
338
if (__DEBUG__) {
339
console.log(`${markName}() Got bad response for url "${url}"`);
340
}
@@ -336,6 +343,7 @@ function fetchFile(
343
}
344
},
345
error => {
346
+ // $FlowFixMe[constant-condition]
347
if (__DEBUG__) {
348
console.log(`${markName}() Could not fetch file: ${error.message}`);
349
}
@@ -371,6 +379,7 @@ export function flattenHooksList(hooksTree: HooksTree): HooksList {
379
flattenHooksListImpl(hooksTree, hooksList);
380
});
381
382
+ // $FlowFixMe[constant-condition]
383
if (__DEBUG__) {
384
console.log('flattenHooksList() hooksList:', hooksList);
385
}
@@ -387,6 +396,7 @@ function flattenHooksListImpl(
396
397
if (isUnnamedBuiltInHook(hook)) {
398
// No need to load source code or do any parsing for unnamed hooks.
399
+ // $FlowFixMe[constant-condition]
400
if (__DEBUG__) {
401
console.log('flattenHooksListImpl() Skipping unnamed hook', hook);
402
}
@@ -483,6 +493,7 @@ function loadSourceFiles(
493
throw Error('Source code too large to parse');
494
}
495
496
+ // $FlowFixMe[constant-condition]
497
if (__DEBUG__) {
498
console.groupCollapsed(
499
`loadSourceFiles() runtimeSourceURL "${runtimeSourceURL}"`,
packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js
+8
@@ -82,6 +82,7 @@ const originalURLToMetadataCache: LRUCache<string, CachedSourceCodeMetadata> =
82
originalSourceURL: string,
83
metadata: CachedSourceCodeMetadata,
84
) => {
85
+ // $FlowFixMe[constant-condition]
86
if (__DEBUG__) {
87
console.log(
88
`originalURLToMetadataCache.dispose() Evicting cached metadata for "${originalSourceURL}"`,
@@ -183,6 +184,7 @@ function findHookNames(
184
);
185
}
186
187
+ // $FlowFixMe[constant-condition]
188
if (__DEBUG__) {
189
console.log(`findHookNames() Found name "${name || '-'}"`);
190
}
@@ -301,6 +303,7 @@ function parseSourceAST(
303
hasHookMap = true;
304
}
305
306
+ // $FlowFixMe[constant-condition]
307
if (__DEBUG__) {
308
console.log(
309
`parseSourceAST() mapped line ${lineNumber}->${originalSourceLineNumber} and column ${columnNumber}->${originalSourceColumnNumber}`,
@@ -308,6 +311,7 @@ function parseSourceAST(
311
}
312
313
if (hasHookMap) {
314
+ // $FlowFixMe[constant-condition]
315
if (__DEBUG__) {
316
console.log(
317
`parseSourceAST() Found hookMap and skipping parsing for "${originalSourceURL}"`,
@@ -319,6 +323,7 @@ function parseSourceAST(
323
return;
324
}
325
326
+ // $FlowFixMe[constant-condition]
327
if (__DEBUG__) {
328
console.log(
329
`parseSourceAST() Did not find hook map for "${originalSourceURL}"`,
@@ -329,6 +334,7 @@ function parseSourceAST(
334
// This may need to change if we switch to async parsing.
335
const sourceMetadata = originalURLToMetadataCache.get(originalSourceURL);
336
if (sourceMetadata != null) {
337
+ // $FlowFixMe[constant-condition]
338
if (__DEBUG__) {
339
console.groupCollapsed(
340
`parseSourceAST() Found cached source metadata for "${originalSourceURL}"`,
@@ -359,6 +365,7 @@ function parseSourceAST(
365
);
366
hookParsedMetadata.originalSourceAST = originalSourceAST;
367
368
+ // $FlowFixMe[constant-condition]
369
if (__DEBUG__) {
370
console.log(
371
`parseSourceAST() Caching source metadata for "${originalSourceURL}"`,
@@ -398,6 +405,7 @@ function parseSourceMaps(
405
// we can skip reloading it (and more importantly, re-parsing it).
406
const runtimeMetadata = runtimeURLToMetadataCache.get(runtimeSourceURL);
407
if (runtimeMetadata != null) {
408
+ // $FlowFixMe[constant-condition]
409
if (__DEBUG__) {
410
console.groupCollapsed(
411
`parseHookNames() Found cached runtime metadata for file "${runtimeSourceURL}"`,
packages/react-devtools-shared/src/inspectedElementMutableSource.js
+1
@@ -143,6 +143,7 @@ export function inspectElement(
143
// A path has been hydrated.
144
// Merge it with the latest copy we have locally and resolve with the merged value.
145
inspectedElement = inspectedElementCache.get(id) || null;
146
+ // $FlowFixMe[invalid-compare]
147
if (inspectedElement !== null) {
148
// Clone element
149
inspectedElement = {...inspectedElement};
packages/react-devtools-shared/src/utils.js
+2
-1
@@ -597,7 +597,7 @@ export function parseElementDisplayNameFromBackend(
597
}
598
599
return {
600
- // $FlowFixMe[incompatible-return]
600
+ // $FlowFixMe[incompatible-type]
601
formattedDisplayName: displayName,
602
hocDisplayNames,
603
compiledWithForget: false,
@@ -976,6 +976,7 @@ export function formatDataForPreview(
976
case 'html_element':
977
return `<${truncateForDisplay(data.tagName.toLowerCase())} />`;
978
case 'function':
979
+ // $FlowFixMe[invalid-compare]
980
if (typeof data.name === 'function' || data.name === '') {
981
return '() => {}';
982
}
packages/react-devtools-shell/src/app/Iframe/index.js
+2
@@ -28,6 +28,7 @@ function Frame(props) {
28
React.useLayoutEffect(function () {
29
const iframe = ref.current;
30
31
+ // $FlowFixMe[constant-condition]
32
if (iframe) {
33
const html = `
34
<!DOCTYPE html>
@@ -57,6 +58,7 @@ function Frame(props) {
58
style={iframeStyle}
59
/>
60
61
+ {/* $FlowFixMe[constant-condition] */}
62
{element ? createPortal(props.children, element) : null}
63
</Fragment>
64
);
packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js
+2
-2
@@ -72,7 +72,7 @@ function useDeepHookF() {
72
const ContextA = createContext('A');
73
const ContextB = createContext('B');
74
75
-function FunctionWithHooks(props: any, ref: React$RefSetter<any>) {
75
+function FunctionWithHooks(props: any, ref: React.RefSetter<any>) {
76
const [count, updateCount] = useState(0);
77
// eslint-disable-next-line no-unused-vars
78
const contextValueA = useContext(ContextA);
@@ -109,7 +109,7 @@ const MemoWithHooks = memo(FunctionWithHooks);
109
const ForwardRefWithHooks = forwardRef(FunctionWithHooks);
110
111
function wrapWithHoc(
112
- Component: (props: any, ref: React$RefSetter<any>) => any,
112
+ Component: (props: any, ref: React.RefSetter<any>) => any,
113
) {
114
function Hoc() {
115
return <Component />;
packages/react-devtools-shell/src/app/index.js
+1
-1
@@ -95,7 +95,7 @@ function mountLegacyApp(App: () => React$Node) {
95
// $FlowFixMe[not-a-function]: These are removed in 19.
96
render(createElement(LegacyRender), container);
97
98
- // $FlowFixMe: These are removed in 19.
98
+ // $FlowFixMe[not-a-function]: These are removed in 19.
99
unmountFunctions.push(() => unmountComponentAtNode(container));
100
}
101
packages/react-devtools-timeline/src/CanvasPage.js
+1
@@ -438,6 +438,7 @@ function AutoSizedCanvas({
438
if (suspenseEventsViewWrapper !== null) {
439
rootView.addSubview(suspenseEventsViewWrapper);
440
}
441
+ // $FlowFixMe[invalid-compare]
442
if (reactMeasuresViewWrapper !== null) {
443
rootView.addSubview(reactMeasuresViewWrapper);
444
}
packages/react-devtools-timeline/src/content-views/SnapshotsView.js
+1
-1
@@ -166,7 +166,7 @@ export class SnapshotsView extends View {
166
imageRect.size.height,
167
);
168
169
- // $FlowFixMe[incompatible-call] Flow doesn't know about the 9 argument variant of drawImage()
169
+ // $FlowFixMe[incompatible-type] Flow doesn't know about the 9 argument variant of drawImage()
170
context.drawImage(
171
snapshot.image,
172
packages/react-devtools-timeline/src/content-views/UserTimingMarksView.js
+1
@@ -106,6 +106,7 @@ export class UserTimingMarksView extends View {
106
? COLORS.USER_TIMING_HOVER
107
: COLORS.USER_TIMING;
108
109
+ // $FlowFixMe[invalid-compare]
110
if (fillStyle !== null) {
111
const y = baseY + halfSize;
112
packages/react-devtools-timeline/src/import-worker/preprocessData.js
+2
@@ -283,10 +283,12 @@ function processEventDispatch(
283
warning: null,
284
};
285
286
+ // $FlowFixMe[incompatible-type]
287
profilerData.nativeEvents.push(nativeEvent);
288
289
// Keep track of curent event in case future ones overlap.
290
// We separate them into different vertical lanes in this case.
291
+ // $FlowFixMe[incompatible-type]
292
state.nativeEventStack.push(nativeEvent);
293
}
294
}
packages/react-devtools-timeline/src/view-base/useCanvasInteraction.js
+1
-1
@@ -125,7 +125,7 @@ export function useCanvasInteraction(
125
}
126
127
function localToCanvasCoordinates(localCoordinates: Point): Point {
128
- // $FlowFixMe[incompatible-call] found when upgrading Flow
128
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
129
const canvasRect = cacheFirstGetCanvasBoundingRect(canvas);
130
return {
131
x: localCoordinates.x - canvasRect.left,
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
+1
-1
@@ -212,7 +212,7 @@ export function setValueForPropertyOnCustomComponent(
212
node.removeAttribute(name);
213
}
214
}
215
- // $FlowFixMe[incompatible-cast] value can't be casted to EventListener.
215
+ // $FlowFixMe[incompatible-type] value can't be casted to EventListener.
216
node.addEventListener(eventName, (value: EventListener), useCapture);
217
return;
218
}
packages/react-dom-bindings/src/client/ReactDOMComponent.js
+6
@@ -2120,6 +2120,7 @@ function hydrateAttribute(
2120
if (__DEV__) {
2121
checkAttributeStringCoercion(value, propKey);
2122
}
2123
+ // $FlowFixMe[invalid-compare]
2124
if (serverValue === '' + value) {
2125
return;
2126
}
@@ -2184,6 +2185,7 @@ function hydrateOverloadedBooleanAttribute(
2185
case 'symbol':
2186
return;
2187
default:
2188
+ // $FlowFixMe[invalid-compare]
2189
if (value === false) {
2190
return;
2191
}
@@ -2198,6 +2200,7 @@ function hydrateOverloadedBooleanAttribute(
2200
case 'symbol':
2201
break;
2202
case 'boolean':
2203
+ // $FlowFixMe[invalid-compare]
2204
if (value === true && serverValue === '') {
2205
return;
2206
}
@@ -2206,6 +2209,7 @@ function hydrateOverloadedBooleanAttribute(
2209
if (__DEV__) {
2210
checkAttributeStringCoercion(value, propKey);
2211
}
2212
+ // $FlowFixMe[invalid-compare]
2213
if (serverValue === '' + value) {
2214
return;
2215
}
@@ -2297,6 +2301,7 @@ function hydrateNumericAttribute(
2301
if (__DEV__) {
2302
checkAttributeStringCoercion(value, propKey);
2303
}
2304
+ // $FlowFixMe[invalid-compare]
2305
if (serverValue === '' + value) {
2306
return;
2307
}
@@ -2348,6 +2353,7 @@ function hydratePositiveNumericAttribute(
2353
if (__DEV__) {
2354
checkAttributeStringCoercion(value, propKey);
2355
}
2356
+ // $FlowFixMe[invalid-compare]
2357
if (serverValue === '' + value) {
2358
return;
2359
}
packages/react-dom-bindings/src/client/ReactDOMInput.js
+1
@@ -122,6 +122,7 @@ export function updateInput(
122
if (type === 'number') {
123
if (
124
// $FlowFixMe[incompatible-type]
125
+ // $FlowFixMe[invalid-compare]
126
(value === 0 && node.value === '') ||
127
// We explicitly want to coerce to number here if possible.
128
// eslint-disable-next-line
packages/react-dom-bindings/src/client/ReactDOMTextarea.js
+2
@@ -138,7 +138,9 @@ export function initTextarea(
138
// initial value. In IE10/IE11 there is a bug where the placeholder attribute
139
// will populate textContent as well.
140
// https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
141
+ // $FlowFixMe[invalid-compare]
142
if (textContent === stringValue) {
143
+ // $FlowFixMe[invalid-compare]
144
if (textContent !== '' && textContent !== null) {
145
node.value = textContent;
146
}
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
+33
-22
@@ -1112,6 +1112,7 @@ export function appendChildToContainer(
1112
// https://github.com/facebook/react/issues/11918
1113
const reactRootContainer = container._reactRootContainer;
1114
if (
1115
+ // $FlowFixMe[invalid-compare]
1116
(reactRootContainer === null || reactRootContainer === undefined) &&
1117
parentNode.onclick === null
1118
) {
@@ -1419,6 +1420,7 @@ export function unhideInstance(instance: Instance, props: Props): void {
1420
const styleProp = props[STYLE];
1421
const display =
1422
styleProp !== undefined &&
1423
+ // $FlowFixMe[invalid-compare]
1424
styleProp !== null &&
1425
styleProp.hasOwnProperty('display')
1426
? styleProp.display
@@ -1525,7 +1527,7 @@ export function applyViewTransitionName(
1527
// https://bugs.webkit.org/show_bug.cgi?id=290923
1528
const rects = instance.getClientRects();
1529
if (
1528
- // $FlowFixMe[incompatible-call]
1530
+ // $FlowFixMe[incompatible-type]
1531
countClientRects(rects) === 1
1532
) {
1533
// If the instance has a single client rect, that means that it can be
@@ -1632,7 +1634,7 @@ export function cancelViewTransitionName(
1634
if (documentElement !== null) {
1635
documentElement.animate(
1636
{opacity: [0, 0], pointerEvents: ['none', 'none']},
1635
- // $FlowFixMe[incompatible-call]
1637
+ // $FlowFixMe[incompatible-type]
1638
{
1639
duration: 0,
1640
fill: 'forwards',
@@ -1669,7 +1671,7 @@ export function cancelRootViewTransitionName(rootContainer: Container): void {
1671
documentElement.style.viewTransitionName = 'none';
1672
documentElement.animate(
1673
{opacity: [0, 0], pointerEvents: ['none', 'none']},
1672
- // $FlowFixMe[incompatible-call]
1674
+ // $FlowFixMe[incompatible-type]
1675
{
1676
duration: 0,
1677
fill: 'forwards',
@@ -1686,6 +1688,7 @@ export function cancelRootViewTransitionName(rootContainer: Container): void {
1688
documentElement.animate(
1689
{width: [0, 0], height: [0, 0]},
1690
// $FlowFixMe[incompatible-call]
1691
+ // $FlowFixMe[incompatible-type]
1692
{
1693
duration: 0,
1694
fill: 'forwards',
@@ -1782,11 +1785,11 @@ function moveOutOfViewport(
1785
// while still letting it paint its "old" state to a snapshot.
1786
const transform = getComputedTransform(originalStyle);
1787
// Clear the long form properties.
1785
- // $FlowFixMe
1788
+ // $FlowFixMe[prop-missing]
1789
element.style.translate = 'none';
1787
- // $FlowFixMe
1790
+ // $FlowFixMe[prop-missing]
1791
element.style.scale = 'none';
1789
- // $FlowFixMe
1792
+ // $FlowFixMe[prop-missing]
1793
element.style.rotate = 'none';
1794
// Apply a translate to move it way out of the viewport. This is applied first
1795
// so that it is in the coordinate space of the parent and not after applying
@@ -1869,7 +1872,7 @@ export function cloneRootViewTransitionContainer(
1872
if (getComputedStyle(positionedAncestor).position !== 'static') {
1873
break;
1874
}
1872
- // $FlowFixMe: This is refined.
1875
+ // $FlowFixMe[incompatible-type]: This is refined.
1876
positionedAncestor = positionedAncestor.parentNode;
1877
}
1878
@@ -2267,11 +2270,12 @@ export function startViewTransition(
2270
const documentElement: Element = (ownerDocument.documentElement: any);
2271
// Loop through all View Transition Animations.
2272
// $FlowFixMe[prop-missing]
2273
+ // $FlowFixMe[incompatible-type]
2274
const animations = documentElement.getAnimations({subtree: true});
2275
for (let i = 0; i < animations.length; i++) {
2276
const animation = animations[i];
2277
const effect: KeyframeEffect = (animation.effect: any);
2274
- // $FlowFixMe
2278
+ // $FlowFixMe[prop-missing]
2279
const pseudoElement: ?string = effect.pseudoElement;
2280
if (
2281
pseudoElement != null &&
@@ -2313,13 +2317,13 @@ export function startViewTransition(
2317
height !== undefined
2318
) {
2319
// Replace the keyframes with ones that don't animate the width/height.
2316
- // $FlowFixMe
2320
+ // $FlowFixMe[incompatible-type]
2321
effect.setKeyframes(keyframes);
2322
// Read back the new animation to see what the underlying width/height of the pseudo-element was.
2323
const computedStyle = getComputedStyle(
2320
- // $FlowFixMe
2324
+ // $FlowFixMe[incompatible-type]
2325
effect.target,
2322
- // $FlowFixMe
2326
+ // $FlowFixMe[prop-missing]
2327
effect.pseudoElement,
2328
);
2329
if (
@@ -2334,7 +2338,7 @@ export function startViewTransition(
2338
const last = keyframes[keyframes.length - 1];
2339
last.width = width;
2340
last.height = height;
2337
- // $FlowFixMe
2341
+ // $FlowFixMe[incompatible-type]
2342
effect.setKeyframes(keyframes);
2343
}
2344
}
@@ -2536,7 +2540,7 @@ function animateGesture(
2540
const reverse = rangeStart > rangeEnd;
2541
if (timeline instanceof AnimationTimeline) {
2542
// Native Timeline
2539
- // $FlowFixMe[incompatible-call]
2543
+ // $FlowFixMe[incompatible-type]
2544
const animation = targetElement.animate(keyframes, {
2545
pseudoElement: pseudoElement,
2546
// Set the timeline to the current gesture timeline to drive the updates.
@@ -2558,7 +2562,7 @@ function animateGesture(
2562
viewTransitionAnimations.push(animation);
2563
} else {
2564
// Custom Timeline
2561
- // $FlowFixMe[incompatible-call]
2565
+ // $FlowFixMe[incompatible-type]
2566
const animation = targetElement.animate(keyframes, {
2567
pseudoElement: pseudoElement,
2568
// We reset all easing functions to linear so that it feels like you
@@ -2617,6 +2621,7 @@ export function startGestureTransition(
2621
const documentElement: Element = (ownerDocument.documentElement: any);
2622
// Loop through all View Transition Animations.
2623
// $FlowFixMe[prop-missing]
2624
+ // $FlowFixMe[incompatible-type]
2625
const animations = documentElement.getAnimations({subtree: true});
2626
// First do a pass to collect all known group and new items so we can look
2627
// up if they exist later.
@@ -2626,7 +2631,7 @@ export function startGestureTransition(
2631
let longestDuration = 0;
2632
for (let i = 0; i < animations.length; i++) {
2633
const effect: KeyframeEffect = (animations[i].effect: any);
2629
- // $FlowFixMe
2634
+ // $FlowFixMe[prop-missing]
2635
const pseudoElement: ?string = effect.pseudoElement;
2636
if (pseudoElement == null) {
2637
} else if (
@@ -2661,7 +2666,7 @@ export function startGestureTransition(
2666
continue;
2667
}
2668
const effect: KeyframeEffect = (anim.effect: any);
2664
- // $FlowFixMe
2669
+ // $FlowFixMe[prop-missing]
2670
const pseudoElement: ?string = effect.pseudoElement;
2671
if (
2672
pseudoElement != null &&
@@ -2721,7 +2726,7 @@ export function startGestureTransition(
2726
}
2727
animateGesture(
2728
effect.getKeyframes(),
2724
- // $FlowFixMe: Always documentElement atm.
2729
+ // $FlowFixMe[incompatible-type]: Always documentElement atm.
2730
effect.target,
2731
pseudoElement,
2732
timeline,
@@ -2749,7 +2754,7 @@ export function startGestureTransition(
2754
const pseudoElementName = '::view-transition-group' + groupName;
2755
animateGesture(
2756
[{}, {}],
2752
- // $FlowFixMe: Always documentElement atm.
2757
+ // $FlowFixMe[incompatible-type]: Always documentElement atm.
2758
effect.target,
2759
pseudoElementName,
2760
timeline,
@@ -2770,6 +2775,7 @@ export function startGestureTransition(
2775
// that never stops. This seems to keep all running Animations alive until
2776
// we explicitly abort (or something forces the View Transition to cancel).
2777
// $FlowFixMe[incompatible-call]
2778
+ // $FlowFixMe[incompatible-type]
2779
const blockingAnim = documentElement.animate([{}, {}], {
2780
pseudoElement: '::view-transition',
2781
duration: 1,
@@ -2892,6 +2898,7 @@ ViewTransitionPseudoElement.prototype.animate = function (
2898
}
2899
: Object.assign(
2900
(// $FlowFixMe[prop-missing]
2901
+ // $FlowFixMe[incompatible-type]
2902
{}: KeyframeAnimationOptions),
2903
options,
2904
);
@@ -2908,6 +2915,7 @@ ViewTransitionPseudoElement.prototype.getAnimations = function (
2915
const selector = this._selector;
2916
const animations = scope.getAnimations(
2917
// $FlowFixMe[prop-missing]
2918
+ // $FlowFixMe[incompatible-type]
2919
{subtree: true},
2920
);
2921
const result = [];
@@ -3352,7 +3360,7 @@ FragmentInstance.prototype.getRootNode = function (
3360
const parentHostInstance =
3361
getInstanceFromHostFiber<Instance>(parentHostFiber);
3362
const rootNode =
3355
- // $FlowFixMe[incompatible-cast] Flow expects Node
3363
+ // $FlowFixMe[incompatible-type] Flow expects Node
3364
(parentHostInstance.getRootNode(getRootNodeOptions): Document | ShadowRoot);
3365
return rootNode;
3366
};
@@ -3476,6 +3484,7 @@ function validateDocumentPositionWithFiberTree(
3484
if (otherFiber === null) {
3485
// otherFiber could be null if its the document or body element
3486
const ownerDocument = otherNode.ownerDocument;
3487
+ // $FlowFixMe[invalid-compare]
3488
return otherNode === ownerDocument || otherNode === ownerDocument.body;
3489
}
3490
return isFragmentContainedByFiber(fragmentFiber, otherFiber);
@@ -4829,11 +4838,11 @@ export type HoistableRoot = Document | ShadowRoot;
4838
export function getHoistableRoot(container: Container): HoistableRoot {
4839
// $FlowFixMe[method-unbinding]
4840
return typeof container.getRootNode === 'function'
4832
- ? /* $FlowFixMe[incompatible-cast] Flow types this as returning a `Node`,
4841
+ ? /* $FlowFixMe[incompatible-type] Flow types this as returning a `Node`,
4842
* but it's either a `Document` or `ShadowRoot`. */
4843
(container.getRootNode(): Document | ShadowRoot)
4844
: container.nodeType === DOCUMENT_NODE
4836
- ? // $FlowFixMe[incompatible-cast] We've constrained this to be a Document which satisfies the return type
4845
+ ? // $FlowFixMe[incompatible-type] We've constrained this to be a Document which satisfies the return type
4846
(container: Document)
4847
: container.ownerDocument;
4848
}
@@ -5151,12 +5160,14 @@ function preinitStyle(
5160
}
5161
5162
// Construct a Resource and cache it
5163
+ // $FlowFixMe[incompatible-type]
5164
resource = {
5165
type: 'stylesheet',
5166
instance,
5167
count: 1,
5168
state,
5169
};
5170
+ // $FlowFixMe[incompatible-type]
5171
styles.set(key, resource);
5172
return;
5173
}
@@ -5570,7 +5581,7 @@ function preloadStylesheet(
5581
markNodeAsHoistable(instance);
5582
(ownerDocument.head: any).appendChild(instance);
5583
}
5573
- // $FlowFixMe: [incompatible-type] -- if instance is an Element it will also be an HTMLLinkElement
5584
+ // $FlowFixMe[incompatible-type] -- if instance is an Element it will also be an HTMLLinkElement
5585
state.preload = instance;
5586
instance.addEventListener('load', () => (state.loading |= Loaded));
5587
instance.addEventListener('error', () => (state.loading |= Errored));
packages/react-dom-bindings/src/client/estimateBandwidth.js
+1
-1
@@ -98,7 +98,7 @@ export default function estimateBandwidth(): number {
98
// Fallback to the navigator.connection estimate if available
99
// $FlowFixMe[prop-missing]
100
if (navigator.connection) {
101
- // $FlowFixMe
101
+ // $FlowFixMe[incompatible-use]
102
const downlink: ?number = navigator.connection.downlink;
103
if (typeof downlink === 'number') {
104
return downlink;
packages/react-dom-bindings/src/client/validateDOMNesting.js
+1
@@ -418,6 +418,7 @@ function isTagValidWithParent(
418
419
case 'rp':
420
case 'rt':
421
+ // $FlowFixMe[incompatible-type]
422
return impliedEndTags.indexOf(parentTag) === -1;
423
424
case 'caption':
packages/react-dom-bindings/src/events/DOMPluginEventSystem.js
+2
@@ -446,6 +446,7 @@ export function listenToAllSupportedEvents(rootContainerElement: EventTarget) {
446
(rootContainerElement: any).nodeType === DOCUMENT_NODE
447
? rootContainerElement
448
: (rootContainerElement: any).ownerDocument;
449
+ // $FlowFixMe[invalid-compare]
450
if (ownerDocument !== null) {
451
// The selectionchange event also needs deduplication
452
// but it is attached to the document.
@@ -925,6 +926,7 @@ function accumulateEnterLeaveListenersForEvent(
926
createDispatchListener(instance, captureListener, currentTarget),
927
);
928
}
929
+ // $FlowFixMe[constant-condition]
930
} else if (!inCapturePhase) {
931
const bubbleListener = getListener(instance, registrationName);
932
if (bubbleListener != null) {
packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js
+1
@@ -216,6 +216,7 @@ function accumulateOrCreateContinuousQueuedReplayableEvent(
216
existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
217
const targetContainers = existingQueuedEvent.targetContainers;
218
if (
219
+ // $FlowFixMe[invalid-compare]
220
targetContainer !== null &&
221
targetContainers.indexOf(targetContainer) === -1
222
) {
packages/react-dom-bindings/src/events/SyntheticEvent.js
+3
-3
@@ -391,7 +391,7 @@ function getEventKey(nativeEvent: {[propName: string]: mixed}) {
391
// Browser does not implement `key`, polyfill as much of it as we can.
392
if (nativeEvent.type === 'keypress') {
393
const charCode = getEventCharCode(
394
- // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
394
+ // $FlowFixMe[incompatible-type] unable to narrow to `KeyboardEvent`
395
nativeEvent,
396
);
397
@@ -463,7 +463,7 @@ const KeyboardEventInterface: EventInterfaceType = {
463
// implemented in any major browser. Only KeyPress has charCode.
464
if (event.type === 'keypress') {
465
return getEventCharCode(
466
- // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
466
+ // $FlowFixMe[incompatible-type] unable to narrow to `KeyboardEvent`
467
event,
468
);
469
}
@@ -487,7 +487,7 @@ const KeyboardEventInterface: EventInterfaceType = {
487
// type of the event.
488
if (event.type === 'keypress') {
489
return getEventCharCode(
490
- // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
490
+ // $FlowFixMe[incompatible-type] unable to narrow to `KeyboardEvent`
491
event,
492
);
493
}
packages/react-dom-bindings/src/server/ReactDOMLegacyServerStreamConfig.js
+1
-1
@@ -75,7 +75,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number {
75
}
76
77
export function closeWithError(destination: Destination, error: mixed): void {
78
- // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
78
+ // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.
79
destination.destroy(error);
80
}
81
packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js
+4
-4
@@ -13,7 +13,7 @@ if (document.body != null) {
13
if (document.readyState === 'loading') {
14
installFizzInstrObserver(document.body);
15
}
16
- // $FlowFixMe[incompatible-cast]
16
+ // $FlowFixMe[incompatible-type]
17
handleExistingNodes((document.body: HTMLElement));
18
} else {
19
// Document must be loading -- body may not exist yet if the fizz external
@@ -25,7 +25,7 @@ if (document.body != null) {
25
if (document.readyState === 'loading') {
26
installFizzInstrObserver(document.body);
27
}
28
- // $FlowFixMe[incompatible-cast]
28
+ // $FlowFixMe[incompatible-type]
29
handleExistingNodes((document.body: HTMLElement));
30
31
// We can call disconnect without takeRecord here,
@@ -69,11 +69,11 @@ function installFizzInstrObserver(target: Node) {
69
}
70
71
function handleNode(node_: Node) {
72
- // $FlowFixMe[incompatible-cast]
72
+ // $FlowFixMe[incompatible-type]
73
if (node_.nodeType !== 1 || !(node_: HTMLElement).dataset) {
74
return;
75
}
76
- // $FlowFixMe[incompatible-cast]
76
+ // $FlowFixMe[incompatible-type]
77
const node = (node_: HTMLElement);
78
const dataset = node.dataset;
79
if (dataset['rxi'] != null) {
packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
+7
-1
@@ -1560,6 +1560,7 @@ function pushAttribute(
1560
return;
1561
}
1562
case 'src': {
1563
+ // $FlowFixMe[invalid-compare]
1564
if (enableSrcObject && typeof value === 'object' && value !== null) {
1565
if (typeof Blob === 'function' && value instanceof Blob) {
1566
pushSrcObjectAttribute(target, value);
@@ -3367,7 +3368,7 @@ function pushImg(
3368
// reenter this branch in a second pass for duplicate img hrefs.
3369
promotablePreloads.delete(key);
3370
3370
- // $FlowFixMe - Flow should understand that this is a Resource if the condition was true
3371
+ // $FlowFixMe[incompatible-type] - Flow should understand that this is a Resource if the condition was true
3372
renderState.highImagePreloads.add(resource);
3373
}
3374
} else if (!resumableState.imageResources.hasOwnProperty(key)) {
@@ -3563,6 +3564,8 @@ function pushTitle(
3564
' tags to a single string value.',
3565
childType,
3566
);
3567
+ // $FlowFixMe[invalid-compare]
3568
+ // $FlowFixMe[constant-condition]
3569
} else if (child && child.toString === {}.toString) {
3570
if (child.$$typeof != null) {
3571
console.error(
@@ -4019,8 +4022,10 @@ function pushStartCustomElement(
4022
typeof propValue !== 'function' &&
4023
typeof propValue !== 'symbol'
4024
) {
4025
+ // $FlowFixMe[invalid-compare]
4026
if (propValue === false) {
4027
continue;
4028
+ // $FlowFixMe[invalid-compare]
4029
} else if (propValue === true) {
4030
propValue = '';
4031
} else if (typeof propValue === 'object') {
@@ -4612,6 +4617,7 @@ export function writeStartPendingSuspenseBoundary(
4617
): boolean {
4618
writeChunk(destination, startPendingSuspenseBoundary1);
4619
4620
+ // $FlowFixMe[invalid-compare]
4621
if (id === null) {
4622
throw new Error(
4623
'An ID must have been assigned before we can complete the boundary.',
packages/react-dom/src/client/ReactDOMClientFB.js
+2
-2
@@ -82,7 +82,7 @@ function createPortal(
82
}
83
84
// TODO: pass ReactDOM portal implementation as third argument
85
- // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it.
85
+ // $FlowFixMe[incompatible-type] The Flow type is opaque but there's no way to actually create it.
86
return createPortalImpl(children, container, null, key);
87
}
88
@@ -100,7 +100,7 @@ function flushSyncFromReconciler<R>(fn: (() => R) | void): R | void {
100
);
101
}
102
}
103
- // $FlowFixMe[incompatible-call]
103
+ // $FlowFixMe[incompatible-type]
104
return flushSyncWithoutWarningIfAlreadyRendering(fn);
105
}
106
packages/react-dom/src/client/ReactDOMDefaultTransitionIndicator.js
+6
-6
@@ -43,11 +43,11 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) {
43
}
44
}
45
46
- // $FlowFixMe
46
+ // $FlowFixMe[incompatible-type]
47
navigation.addEventListener('navigate', handleNavigate);
48
- // $FlowFixMe
48
+ // $FlowFixMe[incompatible-type]
49
navigation.addEventListener('navigatesuccess', handleNavigateComplete);
50
- // $FlowFixMe
50
+ // $FlowFixMe[incompatible-type]
51
navigation.addEventListener('navigateerror', handleNavigateComplete);
52
53
function startFakeNavigation() {
@@ -76,11 +76,11 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) {
76
77
return function () {
78
isCancelled = true;
79
- // $FlowFixMe
79
+ // $FlowFixMe[incompatible-type]
80
navigation.removeEventListener('navigate', handleNavigate);
81
- // $FlowFixMe
81
+ // $FlowFixMe[incompatible-type]
82
navigation.removeEventListener('navigatesuccess', handleNavigateComplete);
83
- // $FlowFixMe
83
+ // $FlowFixMe[incompatible-type]
84
navigation.removeEventListener('navigateerror', handleNavigateComplete);
85
if (pendingResolve !== null) {
86
pendingResolve();
packages/react-dom/src/client/ReactDOMRoot.js
+3
@@ -187,6 +187,7 @@ export function createRoot(
187
let onDefaultTransitionIndicator = defaultOnDefaultTransitionIndicator;
188
let transitionCallbacks = null;
189
190
+ // $FlowFixMe[invalid-compare]
191
if (options !== null && options !== undefined) {
192
if (__DEV__) {
193
if ((options: any).hydrate) {
@@ -196,6 +197,7 @@ export function createRoot(
197
} else {
198
if (
199
typeof options === 'object' &&
200
+ // $FlowFixMe[invalid-compare]
201
options !== null &&
202
(options: any).$$typeof === REACT_ELEMENT_TYPE
203
) {
@@ -304,6 +306,7 @@ export function hydrateRoot(
306
let onDefaultTransitionIndicator = defaultOnDefaultTransitionIndicator;
307
let transitionCallbacks = null;
308
let formState = null;
309
+ // $FlowFixMe[invalid-compare]
310
if (options !== null && options !== undefined) {
311
if (options.unstable_strictMode === true) {
312
isStrictMode = true;
packages/react-dom/src/client/ReactDOMRootFB.js
+3
-2
@@ -255,7 +255,7 @@ function legacyCreateRootFromDOMContainer(
255
!disableCommentsAsDOMContainers && container.nodeType === COMMENT_NODE
256
? container.parentNode
257
: container;
258
- // $FlowFixMe[incompatible-call]
258
+ // $FlowFixMe[incompatible-type]
259
listenToAllSupportedEvents(rootContainerElement);
260
261
flushSyncWork();
@@ -292,7 +292,7 @@ function legacyCreateRootFromDOMContainer(
292
!disableCommentsAsDOMContainers && container.nodeType === COMMENT_NODE
293
? container.parentNode
294
: container;
295
- // $FlowFixMe[incompatible-call]
295
+ // $FlowFixMe[incompatible-type]
296
listenToAllSupportedEvents(rootContainerElement);
297
298
// Initial mount should not be batched.
@@ -425,6 +425,7 @@ export function render(
425
}
426
return legacyRenderSubtreeIntoContainer(
427
null,
428
+ // $FlowFixMe[incompatible-type]
429
element,
430
container,
431
false,
packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
+2
@@ -97,6 +97,7 @@ function renderToReadableStream(
97
},
98
},
99
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
100
+ // $FlowFixMe[incompatible-type]
101
{highWaterMark: 0},
102
): any);
103
// TODO: Move to sub-classing ReadableStream.
@@ -188,6 +189,7 @@ function resume(
189
},
190
},
191
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
192
+ // $FlowFixMe[incompatible-type]
193
{highWaterMark: 0},
194
): any);
195
// TODO: Move to sub-classing ReadableStream.
packages/react-dom/src/server/ReactDOMFizzServerBun.js
+2
-1
@@ -78,7 +78,7 @@ function renderToReadableStream(
78
{
79
type: 'direct',
80
pull: (controller): ?Promise<void> => {
81
- // $FlowIgnore
81
+ // $FlowFixMe[incompatible-type]
82
startFlowing(request, controller);
83
},
84
cancel: (reason): ?Promise<void> => {
@@ -87,6 +87,7 @@ function renderToReadableStream(
87
},
88
},
89
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
90
+ // $FlowFixMe[incompatible-type]
91
{highWaterMark: 2048},
92
): any);
93
// TODO: Move to sub-classing ReadableStream.
packages/react-dom/src/server/ReactDOMFizzServerEdge.js
+2
@@ -97,6 +97,7 @@ function renderToReadableStream(
97
},
98
},
99
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
100
+ // $FlowFixMe[incompatible-type]
101
{highWaterMark: 0},
102
): any);
103
// TODO: Move to sub-classing ReadableStream.
@@ -188,6 +189,7 @@ function resume(
189
},
190
},
191
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
192
+ // $FlowFixMe[incompatible-type]
193
{highWaterMark: 0},
194
): any);
195
// TODO: Move to sub-classing ReadableStream.
packages/react-dom/src/server/ReactDOMFizzServerNode.js
+2
@@ -234,6 +234,7 @@ function renderToReadableStream(
234
},
235
},
236
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
237
+ // $FlowFixMe[incompatible-type]
238
{highWaterMark: 0},
239
): any);
240
// TODO: Move to sub-classing ReadableStream.
@@ -392,6 +393,7 @@ function resume(
393
},
394
},
395
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
396
+ // $FlowFixMe[incompatible-type]
397
{highWaterMark: 0},
398
): any);
399
// TODO: Move to sub-classing ReadableStream.
packages/react-dom/src/server/ReactDOMFizzStaticBrowser.js
+2
@@ -84,6 +84,7 @@ function prerender(
84
},
85
},
86
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
87
+ // $FlowFixMe[incompatible-type]
88
{highWaterMark: 0},
89
);
90
@@ -172,6 +173,7 @@ function resumeAndPrerender(
173
},
174
},
175
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
176
+ // $FlowFixMe[incompatible-type]
177
{highWaterMark: 0},
178
);
179
packages/react-dom/src/server/ReactDOMFizzStaticEdge.js
+2
@@ -84,6 +84,7 @@ function prerender(
84
},
85
},
86
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
87
+ // $FlowFixMe[incompatible-type]
88
{highWaterMark: 0},
89
);
90
@@ -170,6 +171,7 @@ function resumeAndPrerender(
171
},
172
},
173
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
174
+ // $FlowFixMe[incompatible-type]
175
{highWaterMark: 0},
176
);
177
packages/react-dom/src/server/ReactDOMFizzStaticNode.js
+2
@@ -206,6 +206,7 @@ function prerender(
206
},
207
},
208
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
209
+ // $FlowFixMe[incompatible-type]
210
{highWaterMark: 0},
211
);
212
@@ -348,6 +349,7 @@ function resumeAndPrerender(
349
},
350
},
351
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
352
+ // $FlowFixMe[incompatible-type]
353
{highWaterMark: 0},
354
);
355
packages/react-dom/src/shared/ReactDOM.js
+1
-1
@@ -63,7 +63,7 @@ function createPortal(
63
}
64
65
// TODO: pass ReactDOM portal implementation as third argument
66
- // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it.
66
+ // $FlowFixMe[incompatible-type] The Flow type is opaque but there's no way to actually create it.
67
return createPortalImpl(children, container, null, key);
68
}
69
packages/react-dom/src/shared/ReactDOMFloat.js
+1
@@ -114,6 +114,7 @@ export function preload(href: string, options: PreloadOptions) {
114
typeof href === 'string' &&
115
// We check existence because we cannot enforce this function is actually called with the stated type
116
typeof options === 'object' &&
117
+ // $FlowFixMe[invalid-compare]
118
options !== null &&
119
typeof options.as === 'string'
120
) {
packages/react-dom/src/test-utils/FizzTestUtils.js
+1
-1
@@ -95,7 +95,7 @@ async function executeScript(script: Element) {
95
}
96
97
try {
98
- // $FlowFixMe
98
+ // $FlowFixMe[unsupported-syntax]
99
require(scriptSrc);
100
} catch (x) {
101
const event = new window.ErrorEvent('error', {error: x});
packages/react-flight-server-fb/src/ReactFlightFBReferences.js
+1
-1
@@ -51,7 +51,7 @@ const FunctionBind = Function.prototype.bind;
51
// $FlowFixMe[method-unbinding]
52
const ArraySlice = Array.prototype.slice;
53
function bind(this: ServerReference<any>): any {
54
- // $FlowFixMe[incompatible-call]
54
+ // $FlowFixMe[incompatible-type]
55
const newFn = FunctionBind.apply(this, arguments);
56
if (this.$$typeof === SERVER_REFERENCE_TAG) {
57
if (__DEV__) {
packages/react-flight-server-fb/src/ReactServerStreamConfigFB.js
+1
-1
@@ -223,7 +223,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number {
223
}
224
225
export function closeWithError(destination: Destination, error: mixed): void {
226
- // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
226
+ // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.
227
destination.destroy(error);
228
}
229
packages/react-flight-server-fb/src/client/ReactFlightClientConfigBundlerFB.js
+3
-3
@@ -164,7 +164,7 @@ export function getModuleDebugInfo<T>(
164
if (ioInfo === undefined) {
165
let href;
166
try {
167
- // $FlowFixMe
167
+ // $FlowFixMe[incompatible-type]
168
href = new URL(filename, document.baseURI).href;
169
} catch (_) {
170
href = filename;
@@ -187,10 +187,10 @@ export function getModuleDebugInfo<T>(
187
}
188
}
189
const value = Promise.resolve(href);
190
- // $FlowFixMe
190
+ // $FlowFixMe[prop-missing]
191
value.status = 'fulfilled';
192
// Is there some more useful representation for the chunk?
193
- // $FlowFixMe
193
+ // $FlowFixMe[prop-missing]
194
value.value = href;
195
// Create a fake stack frame that points to the beginning of the chunk. This is
196
// probably not source mapped so will link to the compiled source rather than
packages/react-flight-server-fb/src/server/ReactFlightDOMServerNode.js
+3
-3
@@ -144,11 +144,11 @@ function startReadingFromDebugChannelReadable(
144
const ws: WebSocket = (stream: any);
145
ws.binaryType = 'arraybuffer';
146
ws.addEventListener('message', event => {
147
- // $FlowFixMe
147
+ // $FlowFixMe[incompatible-type]
148
onData(event.data);
149
});
150
ws.addEventListener('error', event => {
151
- // $FlowFixMe
151
+ // $FlowFixMe[prop-missing]
152
onError(event.error);
153
});
154
ws.addEventListener('close', onClose);
@@ -339,7 +339,7 @@ function decodeReplyFromBusboy<T>(
339
busboyStream.on('error', err => {
340
reportGlobalError(
341
response,
342
- // $FlowFixMe[incompatible-call] types Error and mixed are incompatible
342
+ // $FlowFixMe[incompatible-type] types Error and mixed are incompatible
343
err,
344
);
345
});
packages/react-markup/src/ReactMarkupServer.js
+2
-2
@@ -179,7 +179,7 @@ export function experimental_renderToHTML(
179
}
180
}
181
const flightRequest = createFlightRequest(
182
- // $FlowFixMe: This should be a subtype but not everything is typed covariant.
182
+ // $FlowFixMe[incompatible-type]: This should be a subtype but not everything is typed covariant.
183
children,
184
null,
185
handleFlightError,
@@ -196,7 +196,7 @@ export function experimental_renderToHTML(
196
);
197
const root = getFlightRoot<ReactNodeList>(flightResponse);
198
const fizzRequest = createFizzRequest(
199
- // $FlowFixMe: Thenables as children are supported.
199
+ // $FlowFixMe[incompatible-type]: Thenables as children are supported.
200
root,
201
resumableState,
202
createRenderState(
packages/react-native-renderer/src/ReactFabric.js
+2
@@ -151,6 +151,7 @@ function render(
151
// TODO (bvaughn): If we decide to keep the wrapper component,
152
// We could create a wrapper for containerTag as well to reduce special casing.
153
root = createContainer(
154
+ // $FlowFixMe[incompatible-type]
155
rootInstance,
156
concurrentRoot ? ConcurrentRoot : LegacyRoot,
157
null,
@@ -166,6 +167,7 @@ function render(
167
168
roots.set(containerTag, root);
169
}
170
+ // $FlowFixMe[incompatible-type]
171
updateContainer(element, root, null, callback);
172
173
return getPublicRootInstance(root);
packages/react-native-renderer/src/ReactFabricComponentTree.js
+1
-1
@@ -29,7 +29,7 @@ function getInstanceFromNode(node: Instance | TextInstance): Fiber | null {
29
return instance.canonical.internalInstanceHandle;
30
}
31
32
- // $FlowFixMe[incompatible-return] DevTools incorrectly passes a fiber in React Native.
32
+ // $FlowFixMe[incompatible-type] DevTools incorrectly passes a fiber in React Native.
33
return node;
34
}
35
packages/react-native-renderer/src/ReactFabricEventEmitter.js
+1
-1
@@ -103,7 +103,7 @@ export function dispatchEvent(
103
const stateNode = targetFiber.stateNode;
104
// Guard against Fiber being unmounted
105
if (stateNode != null) {
106
- // $FlowExpectedError[incompatible-cast] public instances in Fabric do not implement `EventTarget` yet.
106
+ // $FlowExpectedError[incompatible-type] public instances in Fabric do not implement `EventTarget` yet.
107
eventTarget = (getPublicInstance(stateNode): EventTarget);
108
}
109
}
packages/react-native-renderer/src/ReactFiberConfigFabric.js
+8
-3
@@ -155,6 +155,7 @@ export type RendererInspectionConfig = $ReadOnly<{
155
}>;
156
157
// TODO: Remove this conditional once all changes have propagated.
158
+// $FlowFixMe[constant-condition]
159
if (registerEventHandler) {
160
/**
161
* Register the event emitter with the native bridge
@@ -392,6 +393,7 @@ export function resolveUpdatePriority(): EventPriority {
393
return currentUpdatePriority;
394
}
395
396
+ // $FlowFixMe[constant-condition]
397
const currentEventPriority = fabricGetCurrentEventPriority
398
? fabricGetCurrentEventPriority()
399
: null;
@@ -705,8 +707,9 @@ FragmentInstance.prototype.observeUsing = function (
707
traverseFragmentInstance(this._fragmentFiber, observeChild, observer);
708
};
709
function observeChild(child: Fiber, observer: IntersectionObserver) {
710
+ // $FlowFixMe[incompatible-type]
711
const publicInstance = getPublicInstanceFromHostFiber(child);
709
- // $FlowFixMe[incompatible-call] DOM types expect Element
712
+ // $FlowFixMe[incompatible-type] DOM types expect Element
713
observer.observe(publicInstance);
714
return false;
715
}
@@ -729,8 +732,9 @@ FragmentInstance.prototype.unobserveUsing = function (
732
}
733
};
734
function unobserveChild(child: Fiber, observer: IntersectionObserver) {
735
+ // $FlowFixMe[incompatible-type]
736
const publicInstance = getPublicInstanceFromHostFiber(child);
733
- // $FlowFixMe[incompatible-call] DOM types expect Element
737
+ // $FlowFixMe[incompatible-type] DOM types expect Element
738
observer.unobserve(publicInstance);
739
return false;
740
}
@@ -893,8 +897,9 @@ export function commitNewChildToFragmentInstance(
897
if (publicInstance == null) {
898
throw new Error('Expected to find a host node. This is a bug in React.');
899
}
900
+ // $FlowFixMe[incompatible-type]
901
fragmentInstance._observers.forEach(observer => {
897
- // $FlowFixMe[incompatible-call] Element types are behind a flag in RN
902
+ // $FlowFixMe[incompatible-type] Element types are behind a flag in RN
903
observer.observe(publicInstance);
904
});
905
}
packages/react-native-renderer/src/ReactFiberConfigFabricWithViewTransition.js
+1
-1
@@ -94,7 +94,7 @@ export function cloneRootViewTransitionContainer(
94
if (__DEV__) {
95
console.warn('cloneRootViewTransitionContainer is not implemented');
96
}
97
- // $FlowFixMe[incompatible-return] Return empty stub
97
+ // $FlowFixMe[incompatible-type] Return empty stub
98
return null;
99
}
100
packages/react-native-renderer/src/ReactNativePublicCompat.js
+6
-6
@@ -59,7 +59,7 @@ export function findHostInstance_DEPRECATED<TElementType: ElementType>(
59
componentOrHandle.canonical &&
60
componentOrHandle.canonical.publicInstance
61
) {
62
- // $FlowExpectedError[incompatible-return] Can't refine componentOrHandle as a Fabric instance
62
+ // $FlowExpectedError[incompatible-type] Can't refine componentOrHandle as a Fabric instance
63
return componentOrHandle.canonical.publicInstance;
64
}
65
@@ -75,7 +75,7 @@ export function findHostInstance_DEPRECATED<TElementType: ElementType>(
75
76
// findHostInstance handles legacy vs. Fabric differences correctly
77
// $FlowFixMe[incompatible-exact] we need to fix the definition of `HostComponent` to use NativeMethods as an interface, not as a type.
78
- // $FlowFixMe[incompatible-return]
78
+ // $FlowFixMe[incompatible-type]
79
return hostInstance;
80
}
81
@@ -132,11 +132,11 @@ export function findNodeHandle(componentOrHandle: any): ?number {
132
}
133
134
if (hostInstance == null) {
135
- // $FlowFixMe[incompatible-return] Flow limitation in refining an opaque type
135
+ // $FlowFixMe[incompatible-type] Flow limitation in refining an opaque type
136
return hostInstance;
137
}
138
139
- // $FlowFixMe[incompatible-call] Necessary when running Flow on the legacy renderer
139
+ // $FlowFixMe[incompatible-type] Necessary when running Flow on the legacy renderer
140
return getNativeTagFromPublicInstance(hostInstance);
141
}
142
@@ -178,9 +178,9 @@ export function getNodeFromInternalInstanceHandle(
178
internalInstanceHandle: mixed,
179
): ?Node {
180
return (
181
- // $FlowExpectedError[incompatible-return] internalInstanceHandle is opaque but we need to make an exception here.
181
+ // $FlowExpectedError[incompatible-type] internalInstanceHandle is opaque but we need to make an exception here.
182
internalInstanceHandle &&
183
- // $FlowExpectedError[incompatible-return]
183
+ // $FlowExpectedError[incompatible-type]
184
internalInstanceHandle.stateNode &&
185
// $FlowExpectedError[incompatible-use]
186
internalInstanceHandle.stateNode.node
packages/react-native-renderer/src/legacy-events/forEachAccumulated.js
+1
-1
@@ -22,7 +22,7 @@ function forEachAccumulated<T>(
22
scope: ?any,
23
) {
24
if (Array.isArray(arr)) {
25
- // $FlowFixMe[incompatible-call] if `T` is an array, `cb` cannot be called
25
+ // $FlowFixMe[incompatible-type] if `T` is an array, `cb` cannot be called
26
arr.forEach(cb, scope);
27
} else if (arr) {
28
cb.call(scope, arr);
packages/react-noop-renderer/src/ReactNoopFlightClient.js
+5
-4
@@ -27,6 +27,7 @@ const decoderOptions = {stream: true};
27
28
const {createResponse, createStreamState, processBinaryChunk, getRoot, close} =
29
// $FlowFixMe[prop-missing]
30
+ // $FlowFixMe[incompatible-type]
31
ReactFlightClient({
32
createStringDecoder() {
33
return new TextDecoder();
@@ -46,7 +47,7 @@ const {createResponse, createStreamState, processBinaryChunk, getRoot, close} =
47
return readModule(idx);
48
},
49
bindToConsole(methodName, args, badgeName) {
49
- // $FlowFixMe[incompatible-call]
50
+ // $FlowFixMe[incompatible-type]
51
return Function.prototype.bind.apply(
52
// eslint-disable-next-line react-internal/no-production-logging
53
console[methodName],
@@ -64,10 +65,10 @@ type ReadOptions = {|
65
66
function read<T>(source: Source, options: ReadOptions): Thenable<T> {
67
const response = createResponse(
67
- // $FlowFixMe[incompatible-call]
68
+ // $FlowFixMe[incompatible-type]
69
source,
70
null,
70
- // $FlowFixMe[incompatible-call]
71
+ // $FlowFixMe[incompatible-type]
72
null,
73
undefined,
74
undefined,
@@ -78,7 +79,7 @@ function read<T>(source: Source, options: ReadOptions): Thenable<T> {
79
true,
80
undefined,
81
__DEV__ && options !== undefined && options.debugChannel !== undefined
81
- ? // $FlowFixMe[incompatible-call]
82
+ ? // $FlowFixMe[incompatible-type]
83
options.debugChannel.onMessage
84
: undefined,
85
);
packages/react-noop-renderer/src/ReactNoopFlightServer.js
+4
-3
@@ -25,6 +25,7 @@ type Destination = Array<Uint8Array | string>;
25
const textEncoder = new TextEncoder();
26
27
// $FlowFixMe[prop-missing]
28
+// $FlowFixMe[incompatible-type]
29
const ReactNoopFlightServer = ReactFlightServer({
30
scheduleMicrotask(callback: () => void) {
31
callback();
@@ -82,7 +83,7 @@ function render(model: ReactClientValue, options?: Options): Destination {
83
const bundlerConfig = undefined;
84
const request = ReactNoopFlightServer.createRequest(
85
model,
85
- // $FlowFixMe[incompatible-call]
86
+ // $FlowFixMe[incompatible-type]
87
bundlerConfig,
88
options ? options.onError : undefined,
89
options ? options.identifierPrefix : undefined,
@@ -90,7 +91,7 @@ function render(model: ReactClientValue, options?: Options): Destination {
91
options ? options.startTime : undefined,
92
__DEV__ && options ? options.environmentName : undefined,
93
__DEV__ && options ? options.filterStackFrame : undefined,
93
- // $FlowFixMe[incompatible-call]
94
+ // $FlowFixMe[incompatible-type]
95
__DEV__ && options && options.debugChannel !== undefined,
96
);
97
const signal = options ? options.signal : undefined;
@@ -113,7 +114,7 @@ function render(model: ReactClientValue, options?: Options): Destination {
114
ReactNoopFlightServer.startWork(request);
115
ReactNoopFlightServer.startFlowing(
116
request,
116
- // $FlowFixMe[incompatible-call]
117
+ // $FlowFixMe[incompatible-type]
118
destination,
119
);
120
return destination;
packages/react-noop-renderer/src/ReactNoopServer.js
+8
-5
@@ -80,6 +80,7 @@ function write(destination: Destination, buffer: Uint8Array): void {
80
}
81
82
// $FlowFixMe[prop-missing]
83
+// $FlowFixMe[incompatible-type]
84
const ReactNoopServer = ReactFizzServer({
85
scheduleMicrotask(callback: () => void) {
86
callback();
@@ -176,7 +177,7 @@ const ReactNoopServer = ReactFizzServer({
177
destination: Destination,
178
renderState: RenderState,
179
id: number,
179
- // $FlowFixMe[incompatible-return]
180
+ // $FlowFixMe[incompatible-type]
181
): boolean {
182
const parent = destination.stack[destination.stack.length - 1];
183
destination.placeholders.set(id, {
@@ -361,6 +362,7 @@ type Options = {
362
363
function render(children: React$Element<any>, options?: Options): Destination {
364
// $FlowFixMe[prop-missing]
365
+ // $FlowFixMe[incompatible-type]
366
const destination: Destination = {
367
root: null,
368
placeholders: new Map(),
@@ -371,12 +373,13 @@ function render(children: React$Element<any>, options?: Options): Destination {
373
},
374
};
375
const request = ReactNoopServer.createRequest(
376
+ // $FlowFixMe[incompatible-type]
377
children,
375
- // $FlowFixMe[incompatible-call]
378
+ // $FlowFixMe[incompatible-type]
379
null,
377
- // $FlowFixMe[incompatible-call]
380
+ // $FlowFixMe[incompatible-type]
381
null,
379
- // $FlowFixMe[incompatible-call]
382
+ // $FlowFixMe[incompatible-type]
383
null,
384
options ? options.progressiveChunkSize : undefined,
385
options ? options.onError : undefined,
@@ -384,7 +387,7 @@ function render(children: React$Element<any>, options?: Options): Destination {
387
options ? options.onShellReady : undefined,
388
);
389
ReactNoopServer.startWork(request);
387
- // $FlowFixMe[incompatible-call]
390
+ // $FlowFixMe[incompatible-type]
391
ReactNoopServer.startFlowing(request, destination);
392
return destination;
393
}
packages/react-noop-renderer/src/createReactNoop.js
+36
-8
@@ -126,6 +126,7 @@ function createReactNoop(
126
prevParent !== -1 &&
127
prevParent !==
128
// $FlowFixMe[prop-missing]
129
+ // $FlowFixMe[incompatible-type]
130
(parentInstance: Instance).id
131
) {
132
throw new Error('Reparenting is not allowed');
@@ -133,6 +134,7 @@ function createReactNoop(
134
135
child.parent =
136
// $FlowFixMe[prop-missing]
137
+ // $FlowFixMe[incompatible-type]
138
(parentInstance: Instance).id;
139
const index = parentInstance.children.indexOf(child);
140
if (index !== -1) {
@@ -699,7 +701,7 @@ function createReactNoop(
701
resetFormInstance(form: Instance) {},
702
703
bindToConsole(methodName: $FlowFixMe, args: Array<any>, badgeName: string) {
702
- // $FlowFixMe[incompatible-call]
704
+ // $FlowFixMe[incompatible-type]
705
return Function.prototype.bind.apply(
706
// eslint-disable-next-line react-internal/no-production-logging
707
console[methodName],
@@ -735,6 +737,7 @@ function createReactNoop(
737
oldProps: Props,
738
newProps: Props,
739
): void {
740
+ // $FlowFixMe[invalid-compare]
741
if (oldProps === null) {
742
throw new Error('Should have old props');
743
}
@@ -1011,7 +1014,9 @@ function createReactNoop(
1014
$$typeof: REACT_ELEMENT_TYPE,
1015
key: null,
1016
props: props,
1017
+ // $FlowFixMe[constant-condition]
1018
_owner: null,
1019
+ // $FlowFixMe[constant-condition]
1020
_store: __DEV__ ? {} : undefined,
1021
};
1022
// $FlowFixMe[prop-missing]
@@ -1141,8 +1146,10 @@ function createReactNoop(
1146
const previousTransition = ReactSharedInternals.T;
1147
const preivousEventPriority = currentEventPriority;
1148
try {
1149
+ // $FlowFixMe[constant-condition]
1150
ReactSharedInternals.T = null;
1151
currentEventPriority = DiscreteEventPriority;
1152
+ // $FlowFixMe[constant-condition]
1153
if (fn) {
1154
return fn();
1155
} else {
@@ -1164,9 +1171,12 @@ function createReactNoop(
1171
}
1172
function onDefaultTransitionIndicator(): void | (() => void) {}
1173
1174
+ // $FlowFixMe[recursive-definition]
1175
+ // $FlowFixMe[definition-cycle]
1176
let idCounter = 0;
1177
1169
- // $FlowFixMe
1178
+ // $FlowFixMe[definition-cycle]
1179
+ // $FlowFixMe[recursive-definition]
1180
const ReactNoop = {
1181
_Scheduler: Scheduler,
1182
@@ -1220,9 +1230,10 @@ function createReactNoop(
1230
root = NoopRenderer.createContainer(
1231
// $FlowFixMe[incompatible-call] -- Discovered when typechecking noop-renderer
1232
container,
1233
+ // $FlowFixMe[incompatible-type]
1234
tag,
1235
null,
1225
- // $FlowFixMe[incompatible-call] -- Discovered when typechecking noop-renderer
1236
+ // $FlowFixMe[incompatible-type] -- Discovered when typechecking noop-renderer
1237
null,
1238
false,
1239
'',
@@ -1247,9 +1258,10 @@ function createReactNoop(
1258
const fiberRoot = NoopRenderer.createContainer(
1259
// $FlowFixMe[incompatible-call]
1260
container,
1261
+ // $FlowFixMe[incompatible-type]
1262
ConcurrentRoot,
1263
null,
1252
- // $FlowFixMe[incompatible-call]
1264
+ // $FlowFixMe[incompatible-type]
1265
null,
1266
false,
1267
'',
@@ -1398,9 +1410,11 @@ function createReactNoop(
1410
if (disableLegacyMode) {
1411
throw new Error('createLegacyRoot: Unsupported Legacy Mode API.');
1412
}
1413
+ // $FlowFixMe[incompatible-type]
1414
const rootID = DEFAULT_ROOT_ID;
1415
const container = ReactNoop.getOrCreateRootContainer(rootID, LegacyRoot);
1416
const root = roots.get(container.rootID);
1417
+ // $FlowFixMe[incompatible-type]
1418
NoopRenderer.updateContainer(element, root, null, callback);
1419
},
1420
@@ -1411,9 +1425,11 @@ function createReactNoop(
1425
) {
1426
const container = ReactNoop.getOrCreateRootContainer(
1427
rootID,
1428
+ // $FlowFixMe[incompatible-type]
1429
ConcurrentRoot,
1430
);
1431
const root = roots.get(container.rootID);
1432
+ // $FlowFixMe[incompatible-type]
1433
NoopRenderer.updateContainer(element, root, null, callback);
1434
},
1435
@@ -1543,8 +1559,9 @@ function createReactNoop(
1559
// $FlowFixMe[unsafe-addition]
1560
log(indent + '- ' + child.type + '#' + child.id);
1561
1562
+ // $FlowFixMe[incompatible-type]
1563
logHostInstances(
1547
- // $FlowFixMe[incompatible-call]
1564
+ // $FlowFixMe[incompatible-type]
1565
child.children,
1566
depth + 1,
1567
);
@@ -1562,11 +1579,16 @@ function createReactNoop(
1579
const update = first;
1580
if (update !== null) {
1581
do {
1582
+ // $FlowFixMe[unsafe-addition]
1583
+ // $FlowFixMe[prop-missing]
1584
log(
1585
' '.repeat(depth + 1) + '~',
1567
- // $FlowFixMe
1586
+ // $FlowFixMe[invalid-compare]
1587
+ // $FlowFixMe[prop-missing]
1588
+ // $FlowFixMe[unsafe-addition]
1589
'[' + update.expirationTime + ']',
1590
);
1591
+ // $FlowFixMe[invalid-compare]
1592
} while (update !== null);
1593
}
1594
@@ -1575,12 +1597,17 @@ function createReactNoop(
1597
const firstPending = lastPending.next;
1598
const pendingUpdate = firstPending;
1599
if (pendingUpdate !== null) {
1600
+ // $FlowFixMe[unsafe-addition]
1601
+ // $FlowFixMe[prop-missing]
1602
do {
1603
log(
1604
+ // $FlowFixMe[invalid-compare]
1605
' '.repeat(depth + 1) + '~',
1581
- // $FlowFixMe
1606
+ // $FlowFixMe[prop-missing]
1607
+ // $FlowFixMe[unsafe-addition]
1608
'[' + pendingUpdate.expirationTime + ']',
1609
);
1610
+ // $FlowFixMe[invalid-compare]
1611
} while (pendingUpdate !== null && pendingUpdate !== firstPending);
1612
}
1613
}
@@ -1597,11 +1624,12 @@ function createReactNoop(
1624
// $FlowFixMe[prop-missing]
1625
fiber.childExpirationTime +
1626
(fiber.pendingProps ? '*' : '') +
1627
+ // $FlowFixMe[incompatible-type]
1628
']',
1629
);
1630
if (fiber.updateQueue) {
1631
logUpdateQueue(
1604
- // $FlowFixMe[incompatible-call]
1632
+ // $FlowFixMe[incompatible-type]
1633
fiber.updateQueue,
1634
depth,
1635
);
packages/react-reconciler/src/ReactCapturedValue.js
+2
-1
@@ -25,6 +25,7 @@ export function createCapturedValueAtFiber<T>(
25
): CapturedValue<T> {
26
// If the value is an error, call this function immediately after it is thrown
27
// so the stack is accurate.
28
+ // $FlowFixMe[invalid-compare]
29
if (typeof value === 'object' && value !== null) {
30
const existing = CapturedStacks.get(value);
31
if (existing !== undefined) {
@@ -50,7 +51,7 @@ export function createCapturedValueFromError(
51
value: Error,
52
stack: null | string,
53
): CapturedValue<Error> {
53
- const captured = {
54
+ const captured: CapturedValue<Error> = {
55
value,
56
source: null,
57
stack: stack,
packages/react-reconciler/src/ReactChildFiber.js
+7
-2
@@ -812,6 +812,7 @@ function createChildReconciler(
812
return created;
813
}
814
815
+ // $FlowFixMe[invalid-compare]
816
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
817
const context: ReactContext<mixed> = (newChild: any);
818
return createChild(
@@ -953,6 +954,7 @@ function createChildReconciler(
954
return updated;
955
}
956
957
+ // $FlowFixMe[invalid-compare]
958
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
959
const context: ReactContext<mixed> = (newChild: any);
960
return updateSlot(
@@ -1085,6 +1087,7 @@ function createChildReconciler(
1087
return updated;
1088
}
1089
1090
+ // $FlowFixMe[invalid-compare]
1091
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
1092
const context: ReactContext<mixed> = (newChild: any);
1093
return updateFromMap(
@@ -1983,6 +1986,7 @@ function createChildReconciler(
1986
return firstChild;
1987
}
1988
1989
+ // $FlowFixMe[invalid-compare]
1990
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
1991
const context: ReactContext<mixed> = (newChild: any);
1992
return reconcileChildFibersImpl(
@@ -2225,10 +2229,11 @@ export function validateSuspenseListChildren(
2229
enableAsyncIterableChildren &&
2230
children.$$typeof === REACT_ELEMENT_TYPE &&
2231
typeof children.type === 'function' &&
2228
- // $FlowFixMe
2232
+ // $FlowFixMe[method-unbinding]
2233
(Object.prototype.toString.call(children.type) ===
2234
'[object GeneratorFunction]' ||
2231
- // $FlowFixMe
2235
+ // $FlowFixMe[incompatible-use]
2236
+ // $FlowFixMe[method-unbinding]
2237
Object.prototype.toString.call(children.type) ===
2238
'[object AsyncGeneratorFunction]')
2239
) {
packages/react-reconciler/src/ReactFiber.js
+23
-3
@@ -581,6 +581,7 @@ export function createFiberFromTypeAndProps(
581
}
582
}
583
} else if (typeof type === 'string') {
584
+ // $FlowFixMe[constant-condition]
585
if (supportsResources && supportsSingletons) {
586
const hostContext = getHostContext();
587
fiberTag = isHostHoistableType(type, pendingProps, hostContext)
@@ -588,11 +589,13 @@ export function createFiberFromTypeAndProps(
589
: isHostSingletonType(type)
590
? HostSingleton
591
: HostComponent;
592
+ // $FlowFixMe[constant-condition]
593
} else if (supportsResources) {
594
const hostContext = getHostContext();
595
fiberTag = isHostHoistableType(type, pendingProps, hostContext)
596
? HostHoistable
597
: HostComponent;
598
+ // $FlowFixMe[constant-condition]
599
} else if (supportsSingletons) {
600
fiberTag = isHostSingletonType(type) ? HostSingleton : HostComponent;
601
} else {
@@ -600,10 +603,13 @@ export function createFiberFromTypeAndProps(
603
}
604
} else {
605
getTag: switch (type) {
606
+ // $FlowFixMe[invalid-compare]
607
case REACT_ACTIVITY_TYPE:
608
return createFiberFromActivity(pendingProps, mode, lanes, key);
609
+ // $FlowFixMe[invalid-compare]
610
case REACT_FRAGMENT_TYPE:
611
return createFiberFromFragment(pendingProps.children, mode, lanes, key);
612
+ // $FlowFixMe[invalid-compare]
613
case REACT_STRICT_MODE_TYPE:
614
fiberTag = Mode;
615
mode |= StrictLegacyMode;
@@ -612,51 +618,61 @@ export function createFiberFromTypeAndProps(
618
mode |= StrictEffectsMode;
619
}
620
break;
621
+ // $FlowFixMe[invalid-compare]
622
case REACT_PROFILER_TYPE:
623
return createFiberFromProfiler(pendingProps, mode, lanes, key);
624
+ // $FlowFixMe[invalid-compare]
625
case REACT_SUSPENSE_TYPE:
626
return createFiberFromSuspense(pendingProps, mode, lanes, key);
627
+ // $FlowFixMe[invalid-compare]
628
case REACT_SUSPENSE_LIST_TYPE:
629
return createFiberFromSuspenseList(pendingProps, mode, lanes, key);
630
+ // $FlowFixMe[invalid-compare]
631
case REACT_LEGACY_HIDDEN_TYPE:
632
if (enableLegacyHidden) {
633
return createFiberFromLegacyHidden(pendingProps, mode, lanes, key);
634
}
625
- // Fall through
635
+ // $FlowFixMe[invalid-compare] -- falls through
636
case REACT_VIEW_TRANSITION_TYPE:
637
if (enableViewTransition) {
638
return createFiberFromViewTransition(pendingProps, mode, lanes, key);
639
}
630
- // Fall through
640
+ // $FlowFixMe[invalid-compare] -- falls through
641
case REACT_SCOPE_TYPE:
642
if (enableScopeAPI) {
643
return createFiberFromScope(type, pendingProps, mode, lanes, key);
644
}
635
- // Fall through
645
+ // $FlowFixMe[invalid-compare] -- falls through
646
case REACT_TRACING_MARKER_TYPE:
647
if (enableTransitionTracing) {
648
return createFiberFromTracingMarker(pendingProps, mode, lanes, key);
649
}
650
// Fall through
651
default: {
652
+ // $FlowFixMe[invalid-compare]
653
if (typeof type === 'object' && type !== null) {
654
switch (type.$$typeof) {
655
+ // $FlowFixMe[invalid-compare]
656
case REACT_CONTEXT_TYPE:
657
fiberTag = ContextProvider;
658
break getTag;
659
+ // $FlowFixMe[invalid-compare]
660
case REACT_CONSUMER_TYPE:
661
fiberTag = ContextConsumer;
662
break getTag;
663
// Fall through
664
+ // $FlowFixMe[invalid-compare]
665
case REACT_FORWARD_REF_TYPE:
666
fiberTag = ForwardRef;
667
if (__DEV__) {
668
resolvedType = resolveForwardRefForHotReloading(resolvedType);
669
}
670
break getTag;
671
+ // $FlowFixMe[invalid-compare]
672
case REACT_MEMO_TYPE:
673
fiberTag = MemoComponent;
674
break getTag;
675
+ // $FlowFixMe[invalid-compare]
676
case REACT_LAZY_TYPE:
677
fiberTag = LazyComponent;
678
resolvedType = null;
@@ -669,6 +685,7 @@ export function createFiberFromTypeAndProps(
685
if (
686
type === undefined ||
687
(typeof type === 'object' &&
688
+ // $FlowFixMe[invalid-compare]
689
type !== null &&
690
Object.keys(type).length === 0)
691
) {
@@ -677,12 +694,14 @@ export function createFiberFromTypeAndProps(
694
"it's defined in, or you might have mixed up default and named imports.";
695
}
696
697
+ // $FlowFixMe[invalid-compare]
698
if (type === null) {
699
typeString = 'null';
700
} else if (isArray(type)) {
701
typeString = 'array';
702
} else if (
703
type !== undefined &&
704
+ // $FlowFixMe[invalid-compare]
705
type.$$typeof === REACT_ELEMENT_TYPE
706
) {
707
typeString = `<${
@@ -699,6 +718,7 @@ export function createFiberFromTypeAndProps(
718
info += '\n\nCheck the render method of `' + ownerName + '`.';
719
}
720
} else {
721
+ // $FlowFixMe[invalid-compare]
722
typeString = type === null ? 'null' : typeof type;
723
}
724
packages/react-reconciler/src/ReactFiberAct.js
+1
@@ -30,6 +30,7 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean {
30
// $FlowFixMe[cannot-resolve-name] - Flow doesn't know about jest
31
const jestIsDefined = typeof jest !== 'undefined';
32
return (
33
+ // $FlowFixMe[constant-condition]
34
warnsIfNotActing && jestIsDefined && isReactActEnvironmentGlobal !== false
35
);
36
}
packages/react-reconciler/src/ReactFiberApplyGesture.js
+9
@@ -437,6 +437,7 @@ function recursivelyInsertNewFiber(
437
break;
438
}
439
case HostHoistable: {
440
+ // $FlowFixMe[constant-condition]
441
if (supportsResources) {
442
// TODO: Hoistables should get optimistically inserted and then removed.
443
recursivelyInsertNew(
@@ -450,6 +451,7 @@ function recursivelyInsertNewFiber(
451
// Fall through
452
}
453
case HostSingleton: {
454
+ // $FlowFixMe[constant-condition]
455
if (supportsSingletons) {
456
recursivelyInsertNew(
457
finishedWork,
@@ -502,6 +504,7 @@ function recursivelyInsertNewFiber(
504
}
505
case HostText: {
506
const textInstance: TextInstance = finishedWork.stateNode;
507
+ // $FlowFixMe[invalid-compare]
508
if (textInstance === null) {
509
throw new Error(
510
'This should have a text node initialized. This error is likely ' +
@@ -643,6 +646,7 @@ function recursivelyInsertClonesFromExistingTree(
646
}
647
case HostText: {
648
const textInstance: TextInstance = child.stateNode;
649
+ // $FlowFixMe[invalid-compare]
650
if (textInstance === null) {
651
throw new Error(
652
'This should have a text node initialized. This error is likely ' +
@@ -808,6 +812,7 @@ function insertDestinationClonesOfFiber(
812
// to reconciliation, because those can be set on all fiber types.
813
switch (finishedWork.tag) {
814
case HostHoistable: {
815
+ // $FlowFixMe[constant-condition]
816
if (supportsResources) {
817
// TODO: Hoistables should get optimistically inserted and then removed.
818
recursivelyInsertClones(
@@ -821,6 +826,7 @@ function insertDestinationClonesOfFiber(
826
// Fall through
827
}
828
case HostSingleton: {
829
+ // $FlowFixMe[constant-condition]
830
if (supportsSingletons) {
831
recursivelyInsertClones(
832
finishedWork,
@@ -916,6 +922,7 @@ function insertDestinationClonesOfFiber(
922
}
923
case HostText: {
924
const textInstance: TextInstance = finishedWork.stateNode;
925
+ // $FlowFixMe[invalid-compare]
926
if (textInstance === null) {
927
throw new Error(
928
'This should have a text node initialized. This error is likely ' +
@@ -960,6 +967,7 @@ function insertDestinationClonesOfFiber(
967
parentViewTransition,
968
nextPhase,
969
);
970
+ // $FlowFixMe[invalid-compare]
971
} else if (current !== null && current.memoizedState === null) {
972
// Was previously mounted as visible but is now hidden.
973
trackEnterViewTransitions(current);
@@ -1307,6 +1315,7 @@ function restoreViewTransitionsOnFiber(finishedWork: Fiber) {
1315
const isHidden = newState !== null;
1316
if (!isHidden) {
1317
restoreEnterOrExitViewTransitions(finishedWork);
1318
+ // $FlowFixMe[invalid-compare]
1319
} else if (current !== null && current.memoizedState === null) {
1320
// Was previously mounted as visible but is now hidden.
1321
restoreEnterOrExitViewTransitions(current);
packages/react-reconciler/src/ReactFiberBeginWork.js
+19
@@ -1839,6 +1839,7 @@ function updateHostRoot(
1839
// Caution: React DevTools currently depends on this property
1840
// being called "element".
1841
const nextChildren = nextState.element;
1842
+ // $FlowFixMe[constant-condition]
1843
if (supportsHydration && prevState.isDehydrated) {
1844
// This is a hydration root whose shell has not yet hydrated. We should
1845
// attempt to hydrate.
@@ -1989,6 +1990,7 @@ function updateHostComponent(
1990
// and forms cannot be nested. If we did support nested providers, then
1991
// we would need to push a context value even for host fibers that
1992
// haven't been upgraded yet.
1993
+ // $FlowFixMe[constant-condition]
1994
if (isPrimaryRenderer) {
1995
HostTransitionContext._currentValue = newState;
1996
} else {
@@ -2123,8 +2125,10 @@ function mountLazyComponent(
2125
renderLanes,
2126
);
2127
}
2128
+ // $FlowFixMe[invalid-compare]
2129
} else if (Component !== undefined && Component !== null) {
2130
const $$typeof = Component.$$typeof;
2131
+ // $FlowFixMe[invalid-compare]
2132
if ($$typeof === REACT_FORWARD_REF_TYPE) {
2133
workInProgress.tag = ForwardRef;
2134
if (__DEV__) {
@@ -2138,6 +2142,7 @@ function mountLazyComponent(
2142
props,
2143
renderLanes,
2144
);
2145
+ // $FlowFixMe[invalid-compare]
2146
} else if ($$typeof === REACT_MEMO_TYPE) {
2147
workInProgress.tag = MemoComponent;
2148
return updateMemoComponent(
@@ -2147,6 +2152,7 @@ function mountLazyComponent(
2152
props,
2153
renderLanes,
2154
);
2155
+ // $FlowFixMe[invalid-compare]
2156
} else if ($$typeof === REACT_CONTEXT_TYPE) {
2157
workInProgress.tag = ContextProvider;
2158
workInProgress.type = Component;
@@ -2157,8 +2163,10 @@ function mountLazyComponent(
2163
let hint = '';
2164
if (__DEV__) {
2165
if (
2166
+ // $FlowFixMe[invalid-compare]
2167
Component !== null &&
2168
typeof Component === 'object' &&
2169
+ // $FlowFixMe[invalid-compare]
2170
Component.$$typeof === REACT_LAZY_TYPE
2171
) {
2172
hint = ' Did you wrap a component in React.lazy() more than once?';
@@ -2275,6 +2283,7 @@ function updateSuspenseOffscreenState(
2283
let cachePool: SpawnedCachePool | null = null;
2284
const prevCachePool: SpawnedCachePool | null = prevOffscreenState.cachePool;
2285
if (prevCachePool !== null) {
2286
+ // $FlowFixMe[constant-condition]
2287
const parentCache = isPrimaryRenderer
2288
? CacheContext._currentValue
2289
: CacheContext._currentValue2;
@@ -2313,6 +2322,7 @@ function shouldRemainOnFallback(
2322
// whether the current fiber (if it exists) was visible in the previous tree.
2323
if (current !== null) {
2324
const suspenseState: SuspenseState = current.memoizedState;
2325
+ // $FlowFixMe[invalid-compare]
2326
if (suspenseState === null) {
2327
// Currently showing content. Don't hide it, even if ForceSuspenseFallback
2328
// is true. More precise name might be "ForceRemainSuspenseFallback".
@@ -3258,9 +3268,13 @@ function validateRevealOrder(revealOrder: SuspenseListRevealOrder) {
3268
didWarnAboutRevealOrder[cacheKey] = true;
3269
if (typeof revealOrder === 'string') {
3270
switch (revealOrder.toLowerCase()) {
3271
+ // $FlowFixMe[invalid-compare]
3272
case 'together':
3273
+ // $FlowFixMe[invalid-compare] -- falls through
3274
case 'forwards':
3275
+ // $FlowFixMe[invalid-compare] -- falls through
3276
case 'backwards':
3277
+ // $FlowFixMe[invalid-compare] -- falls through
3278
case 'independent': {
3279
console.error(
3280
'"%s" is not a valid value for revealOrder on <SuspenseList />. ' +
@@ -3270,7 +3284,9 @@ function validateRevealOrder(revealOrder: SuspenseListRevealOrder) {
3284
);
3285
break;
3286
}
3287
+ // $FlowFixMe[invalid-compare]
3288
case 'forward':
3289
+ // $FlowFixMe[invalid-compare] -- falls through
3290
case 'backward': {
3291
console.error(
3292
'"%s" is not a valid value for revealOrder on <SuspenseList />. ' +
@@ -3830,6 +3846,7 @@ function remountFiber(
3846
newWorkInProgress.return = oldWorkInProgress.return;
3847
newWorkInProgress.ref = oldWorkInProgress.ref;
3848
3849
+ // $FlowFixMe[constant-condition]
3850
if (__DEV__) {
3851
newWorkInProgress._debugInfo = oldWorkInProgress._debugInfo;
3852
}
@@ -4297,11 +4314,13 @@ function beginWork(
4314
case HostRoot:
4315
return updateHostRoot(current, workInProgress, renderLanes);
4316
case HostHoistable:
4317
+ // $FlowFixMe[constant-condition]
4318
if (supportsResources) {
4319
return updateHostHoistable(current, workInProgress, renderLanes);
4320
}
4321
// Fall through
4322
case HostSingleton:
4323
+ // $FlowFixMe[constant-condition]
4324
if (supportsSingletons) {
4325
return updateHostSingleton(current, workInProgress, renderLanes);
4326
}
packages/react-reconciler/src/ReactFiberClassComponent.js
+6
-3
@@ -1070,9 +1070,11 @@ function updateClassInstance(
1070
!hasContextChanged() &&
1071
!checkHasForceUpdateAfterProcessing() &&
1072
!(
1073
- current !== null &&
1074
- current.dependencies !== null &&
1075
- checkIfContextChanged(current.dependencies)
1073
+ // prettier-ignore
1074
+ // $FlowFixMe[invalid-compare]
1075
+ (current !== null &&
1076
+ current.dependencies !== null &&
1077
+ checkIfContextChanged(current.dependencies))
1078
)
1079
) {
1080
// If an update was already in progress, we should schedule an Update
@@ -1121,6 +1123,7 @@ function updateClassInstance(
1123
// both before and after `shouldComponentUpdate` has been called. Not ideal,
1124
// but I'm loath to refactor this function. This only happens for memoized
1125
// components so it's not that common.
1126
+ // $FlowFixMe[invalid-compare]
1127
(current !== null &&
1128
current.dependencies !== null &&
1129
checkIfContextChanged(current.dependencies));
packages/react-reconciler/src/ReactFiberClassUpdateQueue.js
+2
@@ -350,6 +350,7 @@ export function enqueueCapturedUpdate<State>(
350
} while (update !== null);
351
352
// Append the captured update the end of the cloned list.
353
+ // $FlowFixMe[invalid-compare]
354
if (newLast === null) {
355
newFirst = newLast = capturedUpdate;
356
} else {
@@ -672,6 +673,7 @@ export function processUpdateQueue<State>(
673
queue.firstBaseUpdate = newFirstBaseUpdate;
674
queue.lastBaseUpdate = newLastBaseUpdate;
675
676
+ // $FlowFixMe[invalid-compare]
677
if (firstBaseUpdate === null) {
678
// `queue.lanes` is used for entangling transitions. We can set it back to
679
// zero once the queue is empty.
packages/react-reconciler/src/ReactFiberCommitEffects.js
+6
-5
@@ -195,11 +195,12 @@ export function commitHookEffectListMount(
195
hookName = 'useEffect';
196
}
197
let addendum;
198
+ // $FlowFixMe[invalid-compare]
199
if (destroy === null) {
200
addendum =
201
' You returned null. If your effect does not require clean ' +
202
'up, return undefined (or nothing).';
202
- // $FlowFixMe (@poteto) this check is safe on arbitrary non-null/void objects
203
+ // $FlowFixMe[incompatible-type] (@poteto) this check is safe on arbitrary non-null/void objects
204
} else if (typeof destroy.then === 'function') {
205
addendum =
206
'\n\nIt looks like you wrote ' +
@@ -924,7 +925,7 @@ function safelyCallDestroy(
925
);
926
} else {
927
try {
927
- // $FlowFixMe(incompatible-call) Already bound to resource
928
+ // $FlowFixMe[incompatible-type](incompatible-call) Already bound to resource
929
destroy_();
930
} catch (error) {
931
captureCommitPhaseError(current, nearestMountedAncestor, error);
@@ -951,11 +952,11 @@ function commitProfiler(
952
onRender(
953
id,
954
phase,
954
- // $FlowFixMe: This should be always a number in profiling mode
955
+ // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode
956
finishedWork.actualDuration,
956
- // $FlowFixMe: This should be always a number in profiling mode
957
+ // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode
958
finishedWork.treeBaseDuration,
958
- // $FlowFixMe: This should be always a number in profiling mode
959
+ // $FlowFixMe[incompatible-type]: This should be always a number in profiling mode
960
finishedWork.actualStartTime,
961
commitStartTime,
962
);
packages/react-reconciler/src/ReactFiberCommitHostEffects.js
+7
@@ -311,7 +311,9 @@ function isHostParent(fiber: Fiber): boolean {
311
return (
312
fiber.tag === HostComponent ||
313
fiber.tag === HostRoot ||
314
+ // $FlowFixMe[constant-condition]
315
(supportsResources ? fiber.tag === HostHoistable : false) ||
316
+ // $FlowFixMe[constant-condition]
317
(supportsSingletons
318
? fiber.tag === HostSingleton && isSingletonScope(fiber.type)
319
: false) ||
@@ -351,6 +353,7 @@ function getHostSibling(fiber: Fiber): ?Instance {
353
// singleton scope. If it is a singleton scope we skip over it because
354
// you only insert against this scope when you are already inside of it
355
if (
356
+ // $FlowFixMe[constant-condition]
357
supportsSingletons &&
358
node.tag === HostSingleton &&
359
isSingletonScope(node.type)
@@ -409,6 +412,7 @@ function insertOrAppendPlacementNodeIntoContainer(
412
}
413
414
if (
415
+ // $FlowFixMe[constant-condition]
416
(supportsSingletons ? tag === HostSingleton : false) &&
417
isSingletonScope(node.type)
418
) {
@@ -467,6 +471,7 @@ function insertOrAppendPlacementNode(
471
}
472
473
if (
474
+ // $FlowFixMe[constant-condition]
475
(supportsSingletons ? tag === HostSingleton : false) &&
476
isSingletonScope(node.type)
477
) {
@@ -512,6 +517,7 @@ function commitPlacement(finishedWork: Fiber): void {
517
parentFiber = parentFiber.return;
518
}
519
520
+ // $FlowFixMe[constant-condition]
521
if (!supportsMutation) {
522
if (enableFragmentRefs) {
523
commitImmutablePlacementNodeToFragmentInstances(
@@ -531,6 +537,7 @@ function commitPlacement(finishedWork: Fiber): void {
537
538
switch (hostParentFiber.tag) {
539
case HostSingleton: {
540
+ // $FlowFixMe[constant-condition]
541
if (supportsSingletons) {
542
const parent: Instance = hostParentFiber.stateNode;
543
const before = getHostSibling(finishedWork);
packages/react-reconciler/src/ReactFiberCommitViewTransitions.js
+3
@@ -140,6 +140,7 @@ function applyViewTransitionToHostInstancesRecursive(
140
collectMeasurements: null | Array<InstanceMeasurement>,
141
stopAtNestedViewTransitions: boolean,
142
): boolean {
143
+ // $FlowFixMe[constant-condition]
144
if (!supportsMutation) {
145
if (enableViewTransitionForPersistenceMode) {
146
while (child !== null) {
@@ -241,6 +242,7 @@ function restoreViewTransitionOnHostInstances(
242
child: null | Fiber,
243
stopAtNestedViewTransitions: boolean,
244
): void {
245
+ // $FlowFixMe[constant-condition]
246
if (!supportsMutation) {
247
return;
248
}
@@ -688,6 +690,7 @@ function measureViewTransitionHostInstancesRecursive(
690
previousMeasurements: null | Array<InstanceMeasurement>,
691
stopAtNestedViewTransitions: boolean,
692
): boolean {
693
+ // $FlowFixMe[constant-condition]
694
if (!supportsMutation) {
695
if (enableViewTransitionForPersistenceMode) {
696
while (child !== null) {
packages/react-reconciler/src/ReactFiberCommitWork.js
+37
-1
@@ -487,7 +487,7 @@ function commitBeforeMutationEffectsOnFiber(
487
if (
488
finishedWork.tag === SuspenseComponent &&
489
isSuspenseBoundaryBeingHidden(current, finishedWork) &&
490
- // $FlowFixMe[incompatible-call] found when upgrading Flow
490
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
491
doesFiberContain(finishedWork, focusedInstanceHandle)
492
) {
493
shouldFireAfterActiveInstanceBlur = true;
@@ -523,6 +523,7 @@ function commitBeforeMutationEffectsOnFiber(
523
}
524
case HostRoot: {
525
if ((flags & Snapshot) !== NoFlags) {
526
+ // $FlowFixMe[constant-condition]
527
if (supportsMutation) {
528
const root = finishedWork.stateNode;
529
clearContainer(root.containerInfo);
@@ -652,6 +653,7 @@ function commitLayoutEffectOnFiber(
653
break;
654
}
655
case HostSingleton: {
656
+ // $FlowFixMe[constant-condition]
657
if (supportsSingletons) {
658
// We acquire the singleton instance first so it has appropriate
659
// styles before other layout effects run. This isn't perfect because
@@ -969,6 +971,7 @@ function abortTracingMarkerTransitions(
971
// If one of the transitions on the tracing marker is a transition
972
// that was in an aborted subtree, we will abort that tracing marker
973
if (
974
+ // $FlowFixMe[invalid-compare]
975
abortedFiber !== null &&
976
markerTransitions.has(transition) &&
977
(markerInstance.aborts === null ||
@@ -1181,6 +1184,7 @@ function commitTransitionProgress(offscreenFiber: Fiber) {
1184
}
1185
1186
function hideOrUnhideAllChildren(parentFiber: Fiber, isHidden: boolean) {
1187
+ // $FlowFixMe[constant-condition]
1188
if (!supportsMutation) {
1189
return;
1190
}
@@ -1194,6 +1198,7 @@ function hideOrUnhideAllChildren(parentFiber: Fiber, isHidden: boolean) {
1198
}
1199
1200
function hideOrUnhideAllChildrenOnFiber(fiber: Fiber, isHidden: boolean) {
1201
+ // $FlowFixMe[constant-condition]
1202
if (!supportsMutation) {
1203
return;
1204
}
@@ -1242,6 +1247,7 @@ function hideOrUnhideAllChildrenOnFiber(fiber: Fiber, isHidden: boolean) {
1247
}
1248
1249
function hideOrUnhideNearestPortals(parentFiber: Fiber, isHidden: boolean) {
1250
+ // $FlowFixMe[constant-condition]
1251
if (!supportsMutation) {
1252
return;
1253
}
@@ -1255,6 +1261,7 @@ function hideOrUnhideNearestPortals(parentFiber: Fiber, isHidden: boolean) {
1261
}
1262
1263
function hideOrUnhideNearestPortalsOnFiber(fiber: Fiber, isHidden: boolean) {
1264
+ // $FlowFixMe[constant-condition]
1265
if (!supportsMutation) {
1266
return;
1267
}
@@ -1329,6 +1336,7 @@ function detachFiberAfterEffects(fiber: Fiber) {
1336
// one, too.
1337
if (fiber.tag === HostComponent) {
1338
const hostInstance: Instance = fiber.stateNode;
1339
+ // $FlowFixMe[invalid-compare]
1340
if (hostInstance !== null) {
1341
detachDeletedInstance(hostInstance);
1342
}
@@ -1366,6 +1374,7 @@ function commitDeletionEffects(
1374
) {
1375
const prevEffectStart = pushComponentEffectStart();
1376
1377
+ // $FlowFixMe[constant-condition]
1378
if (supportsMutation) {
1379
// We only have the top Fiber that was deleted but we need to recurse down its
1380
// children to find all the terminal nodes.
@@ -1389,6 +1398,7 @@ function commitDeletionEffects(
1398
findParent: while (parent !== null) {
1399
switch (parent.tag) {
1400
case HostSingleton: {
1401
+ // $FlowFixMe[constant-condition]
1402
if (supportsSingletons) {
1403
if (isSingletonScope(parent.type)) {
1404
hostParent = parent.stateNode;
@@ -1479,6 +1489,7 @@ function commitDeletionEffectsOnFiber(
1489
// that don't modify the stack.
1490
switch (deletedFiber.tag) {
1491
case HostHoistable: {
1492
+ // $FlowFixMe[constant-condition]
1493
if (supportsResources) {
1494
if (!offscreenSubtreeWasHidden) {
1495
safelyDetachRef(deletedFiber, nearestMountedAncestor);
@@ -1498,6 +1509,7 @@ function commitDeletionEffectsOnFiber(
1509
// Fall through
1510
}
1511
case HostSingleton: {
1512
+ // $FlowFixMe[constant-condition]
1513
if (supportsSingletons) {
1514
if (!offscreenSubtreeWasHidden) {
1515
safelyDetachRef(deletedFiber, nearestMountedAncestor);
@@ -1546,6 +1558,7 @@ function commitDeletionEffectsOnFiber(
1558
// We only need to remove the nearest host child. Set the host parent
1559
// to `null` on the stack to indicate that nested children don't
1560
// need to be removed.
1561
+ // $FlowFixMe[constant-condition]
1562
if (supportsMutation) {
1563
const prevHostParent = hostParent;
1564
const prevHostParentIsContainer = hostParentIsContainer;
@@ -1610,6 +1623,7 @@ function commitDeletionEffectsOnFiber(
1623
// Dehydrated fragments don't have any children
1624
1625
// Delete the dehydrated suspense boundary and all of its content.
1626
+ // $FlowFixMe[constant-condition]
1627
if (supportsMutation) {
1628
if (hostParent !== null) {
1629
if (hostParentIsContainer) {
@@ -1628,6 +1642,7 @@ function commitDeletionEffectsOnFiber(
1642
break;
1643
}
1644
case HostPortal: {
1645
+ // $FlowFixMe[constant-condition]
1646
if (supportsMutation) {
1647
// When we go into a portal, it becomes the parent to remove from.
1648
const prevHostParent = hostParent;
@@ -1642,6 +1657,7 @@ function commitDeletionEffectsOnFiber(
1657
hostParent = prevHostParent;
1658
hostParentIsContainer = prevHostParentIsContainer;
1659
} else {
1660
+ // $FlowFixMe[constant-condition]
1661
if (supportsPersistence) {
1662
commitHostPortalContainerChildren(
1663
deletedFiber.stateNode,
@@ -1831,6 +1847,7 @@ function commitActivityHydrationCallbacks(
1847
finishedRoot: FiberRoot,
1848
finishedWork: Fiber,
1849
) {
1850
+ // $FlowFixMe[constant-condition]
1851
if (!supportsHydration) {
1852
return;
1853
}
@@ -1865,6 +1882,7 @@ function commitSuspenseHydrationCallbacks(
1882
finishedRoot: FiberRoot,
1883
finishedWork: Fiber,
1884
) {
1885
+ // $FlowFixMe[constant-condition]
1886
if (!supportsHydration) {
1887
return;
1888
}
@@ -2099,6 +2117,7 @@ function commitMutationEffectsOnFiber(
2117
break;
2118
}
2119
case HostHoistable: {
2120
+ // $FlowFixMe[constant-condition]
2121
if (supportsResources) {
2122
// We cast because we always set the root at the React root and so it cannot be
2123
// null while we are processing mutation effects
@@ -2177,6 +2196,7 @@ function commitMutationEffectsOnFiber(
2196
// Fall through
2197
}
2198
case HostSingleton: {
2199
+ // $FlowFixMe[constant-condition]
2200
if (supportsSingletons) {
2201
recursivelyTraverseMutationEffects(root, finishedWork, lanes);
2202
commitReconciliationEffects(finishedWork, lanes);
@@ -2210,6 +2230,7 @@ function commitMutationEffectsOnFiber(
2230
safelyDetachRef(current, current.return);
2231
}
2232
}
2233
+ // $FlowFixMe[constant-condition]
2234
if (supportsMutation) {
2235
// TODO: ContentReset gets cleared by the children during the commit
2236
// phase. This is a refactor hazard because it means we must read
@@ -2250,6 +2271,7 @@ function commitMutationEffectsOnFiber(
2271
}
2272
} else {
2273
if (enableEagerAlternateStateNodeCleanup) {
2274
+ // $FlowFixMe[constant-condition]
2275
if (supportsPersistence) {
2276
if (finishedWork.alternate !== null) {
2277
// `finishedWork.alternate.stateNode` is pointing to a stale shadow
@@ -2270,6 +2292,7 @@ function commitMutationEffectsOnFiber(
2292
commitReconciliationEffects(finishedWork, lanes);
2293
2294
if (flags & Update) {
2295
+ // $FlowFixMe[constant-condition]
2296
if (supportsMutation) {
2297
if (finishedWork.stateNode === null) {
2298
throw new Error(
@@ -2294,6 +2317,7 @@ function commitMutationEffectsOnFiber(
2317
const prevProfilerEffectDuration = pushNestedEffectDurations();
2318
2319
pushRootMutationContext();
2320
+ // $FlowFixMe[constant-condition]
2321
if (supportsResources) {
2322
prepareToCommitHoistables();
2323
@@ -2310,6 +2334,7 @@ function commitMutationEffectsOnFiber(
2334
}
2335
2336
if (flags & Update) {
2337
+ // $FlowFixMe[constant-condition]
2338
if (supportsMutation && supportsHydration) {
2339
if (current !== null) {
2340
const prevRootState: RootState = current.memoizedState;
@@ -2318,6 +2343,7 @@ function commitMutationEffectsOnFiber(
2343
}
2344
}
2345
}
2346
+ // $FlowFixMe[constant-condition]
2347
if (supportsPersistence) {
2348
commitHostRootContainerChildren(root, finishedWork);
2349
}
@@ -2368,6 +2394,7 @@ function commitMutationEffectsOnFiber(
2394
const prevOffscreenDirectParentIsHidden = offscreenDirectParentIsHidden;
2395
offscreenDirectParentIsHidden = offscreenSubtreeIsHidden;
2396
const prevMutationContext = pushMutationContext();
2397
+ // $FlowFixMe[constant-condition]
2398
if (supportsResources) {
2399
const previousHoistableRoot = currentHoistableRoot;
2400
currentHoistableRoot = getHoistableRoot(
@@ -2391,6 +2418,7 @@ function commitMutationEffectsOnFiber(
2418
offscreenDirectParentIsHidden = prevOffscreenDirectParentIsHidden;
2419
2420
if (flags & Update) {
2421
+ // $FlowFixMe[constant-condition]
2422
if (supportsPersistence) {
2423
commitHostPortalContainerChildren(
2424
finishedWork.stateNode,
@@ -2577,6 +2605,7 @@ function commitMutationEffectsOnFiber(
2605
}
2606
}
2607
2608
+ // $FlowFixMe[constant-condition]
2609
if (supportsMutation) {
2610
// If it's trying to unhide but the parent is still hidden, then we should not unhide.
2611
if (isHidden || !offscreenDirectParentIsHidden) {
@@ -2623,6 +2652,7 @@ function commitMutationEffectsOnFiber(
2652
const prevMutationContext = pushMutationContext();
2653
const prevUpdate = inUpdateViewTransition;
2654
const isViewTransitionEligible =
2655
+ // $FlowFixMe[constant-condition]
2656
enableViewTransition &&
2657
includesOnlyViewTransitionEligibleLanes(lanes);
2658
const props = finishedWork.memoizedProps;
@@ -3016,6 +3046,7 @@ export function disappearLayoutEffects(finishedWork: Fiber) {
3046
break;
3047
}
3048
case HostSingleton: {
3049
+ // $FlowFixMe[constant-condition]
3050
if (supportsSingletons) {
3051
// TODO (Offscreen) Check: flags & RefStatic
3052
commitHostSingletonRelease(finishedWork);
@@ -3160,6 +3191,7 @@ export function reappearLayoutEffects(
3191
// ...
3192
// }
3193
case HostSingleton: {
3194
+ // $FlowFixMe[constant-condition]
3195
if (supportsSingletons) {
3196
// We acquire the singleton instance first so it has appropriate
3197
// styles before other layout effects run. This isn't perfect because
@@ -3261,6 +3293,7 @@ export function reappearLayoutEffects(
3293
}
3294
case OffscreenComponent: {
3295
const offscreenState: OffscreenState = finishedWork.memoizedState;
3296
+ // $FlowFixMe[invalid-compare]
3297
const isHidden = offscreenState !== null;
3298
if (isHidden) {
3299
// Nested Offscreen tree is still hidden. Don't re-appear its effects.
@@ -3398,6 +3431,7 @@ function commitOffscreenPassiveMountEffects(
3431
const offscreenState: OffscreenState = finishedWork.memoizedState;
3432
const queue: OffscreenQueue | null = (finishedWork.updateQueue: any);
3433
3434
+ // $FlowFixMe[invalid-compare]
3435
const isHidden = offscreenState !== null;
3436
if (queue !== null) {
3437
if (isHidden) {
@@ -3712,6 +3746,7 @@ function commitPassiveMountOnFiber(
3746
}
3747
3748
if (isViewTransitionEligible) {
3749
+ // $FlowFixMe[constant-condition]
3750
if (supportsMutation && rootViewTransitionNameCanceled) {
3751
restoreRootViewTransitionName(finishedRoot.containerInfo);
3752
}
@@ -4687,6 +4722,7 @@ function accumulateSuspenseyCommitOnFiber(
4722
}
4723
case HostRoot:
4724
case HostPortal: {
4725
+ // $FlowFixMe[constant-condition]
4726
if (supportsResources) {
4727
const previousHoistableRoot = currentHoistableRoot;
4728
const container: Container = fiber.stateNode.containerInfo;
packages/react-reconciler/src/ReactFiberCompleteWork.js
+16
@@ -205,6 +205,7 @@ function markUpdate(workInProgress: Fiber) {
205
* it received an update that requires a clone of the tree above.
206
*/
207
function markCloned(workInProgress: Fiber) {
208
+ // $FlowFixMe[constant-condition]
209
if (supportsPersistence) {
210
workInProgress.flags |= Cloned;
211
}
@@ -245,6 +246,7 @@ function appendAllChildren(
246
needsVisibilityToggle: boolean,
247
isHidden: boolean,
248
) {
249
+ // $FlowFixMe[constant-condition]
250
if (supportsMutation) {
251
// We only have the top Fiber that was created but we need recurse down its
252
// children to find all the terminal nodes.
@@ -254,6 +256,7 @@ function appendAllChildren(
256
appendInitialChild(parent, node.stateNode);
257
} else if (
258
node.tag === HostPortal ||
259
+ // $FlowFixMe[constant-condition]
260
(supportsSingletons ? node.tag === HostSingleton : false)
261
) {
262
// If we have a portal child, then we don't want to traverse
@@ -280,6 +283,7 @@ function appendAllChildren(
283
node.sibling.return = node.return;
284
node = node.sibling;
285
}
286
+ // $FlowFixMe[constant-condition]
287
} else if (supportsPersistence) {
288
// We only have the top Fiber that was created but we need recurse down its
289
// children to find all the terminal nodes.
@@ -357,6 +361,7 @@ function appendAllChildrenToContainer(
361
// about their presence, we track and return if they were added to the
362
// child set.
363
let hasOffscreenComponentChild = false;
364
+ // $FlowFixMe[constant-condition]
365
if (supportsPersistence) {
366
// We only have the top Fiber that was created but we need recurse down its
367
// children to find all the terminal nodes.
@@ -428,6 +433,7 @@ function appendAllChildrenToContainer(
433
}
434
435
function updateHostContainer(current: null | Fiber, workInProgress: Fiber) {
436
+ // $FlowFixMe[constant-condition]
437
if (supportsPersistence) {
438
if (doesRequireClone(current, workInProgress)) {
439
const portalOrRoot: {
@@ -459,6 +465,7 @@ function updateHostComponent(
465
newProps: Props,
466
renderLanes: Lanes,
467
) {
468
+ // $FlowFixMe[constant-condition]
469
if (supportsMutation) {
470
// If we have an alternate, that means this is an update and we need to
471
// schedule a side-effect to do the updates.
@@ -470,6 +477,7 @@ function updateHostComponent(
477
}
478
479
markUpdate(workInProgress);
480
+ // $FlowFixMe[constant-condition]
481
} else if (supportsPersistence) {
482
const currentInstance = current.stateNode;
483
const oldProps = current.memoizedProps;
@@ -667,11 +675,13 @@ function updateHostText(
675
oldText: string,
676
newText: string,
677
) {
678
+ // $FlowFixMe[constant-condition]
679
if (supportsMutation) {
680
// If the text differs, mark it as an update. All the work in done in commitWork.
681
if (oldText !== newText) {
682
markUpdate(workInProgress);
683
}
684
+ // $FlowFixMe[constant-condition]
685
} else if (supportsPersistence) {
686
if (oldText !== newText) {
687
// If the text content differs, we'll create a new text instance for it.
@@ -922,6 +932,7 @@ function completeDehydratedActivityBoundary(
932
bubbleProperties(workInProgress);
933
if (enableProfilerTimer) {
934
if ((workInProgress.mode & ProfileMode) !== NoMode) {
935
+ // $FlowFixMe[invalid-compare]
936
const isTimedOutSuspense = nextState !== null;
937
if (isTimedOutSuspense) {
938
// Don't count time spent in a timed out Suspense subtree as part of the base duration.
@@ -1004,6 +1015,7 @@ function completeDehydratedSuspenseBoundary(
1015
bubbleProperties(workInProgress);
1016
if (enableProfilerTimer) {
1017
if ((workInProgress.mode & ProfileMode) !== NoMode) {
1018
+ // $FlowFixMe[invalid-compare]
1019
const isTimedOutSuspense = nextState !== null;
1020
if (isTimedOutSuspense) {
1021
// Don't count time spent in a timed out Suspense subtree as part of the base duration.
@@ -1184,6 +1196,7 @@ function completeWork(
1196
return null;
1197
}
1198
case HostHoistable: {
1199
+ // $FlowFixMe[constant-condition]
1200
if (supportsResources) {
1201
// The branching here is more complicated than you might expect because
1202
// a HostHoistable sometimes corresponds to a Resource and sometimes
@@ -1253,6 +1266,7 @@ function completeWork(
1266
const oldProps = current.memoizedProps;
1267
// This is an Instance
1268
// We may have props to update on the Hoistable instance.
1269
+ // $FlowFixMe[constant-condition]
1270
if (supportsMutation) {
1271
if (oldProps !== newProps) {
1272
markUpdate(workInProgress);
@@ -1284,11 +1298,13 @@ function completeWork(
1298
// Fall through
1299
}
1300
case HostSingleton: {
1301
+ // $FlowFixMe[constant-condition]
1302
if (supportsSingletons) {
1303
popHostContext(workInProgress);
1304
const rootContainerInstance = getRootHostContainer();
1305
const type = workInProgress.type;
1306
if (current !== null && workInProgress.stateNode != null) {
1307
+ // $FlowFixMe[constant-condition]
1308
if (supportsMutation) {
1309
const oldProps = current.memoizedProps;
1310
if (oldProps !== newProps) {
packages/react-reconciler/src/ReactFiberConcurrentUpdates.js
+1
@@ -64,6 +64,7 @@ export function finishQueueingConcurrentUpdates(): void {
64
const lane: Lane = concurrentQueues[i];
65
concurrentQueues[i++] = null;
66
67
+ // $FlowFixMe[invalid-compare]
68
if (queue !== null && update !== null) {
69
const pending = queue.pending;
70
if (pending === null) {
packages/react-reconciler/src/ReactFiberGestureScheduler.js
+2
@@ -53,6 +53,7 @@ export function scheduleGesture(
53
return prev;
54
}
55
const next = prev.next;
56
+ // $FlowFixMe[invalid-compare]
57
if (next === null) {
58
break;
59
}
@@ -119,6 +120,7 @@ export function startScheduledGesture(
120
return prev;
121
}
122
const next = prev.next;
123
+ // $FlowFixMe[invalid-compare]
124
if (next === null) {
125
break;
126
}
packages/react-reconciler/src/ReactFiberHooks.js
+10
-5
@@ -415,9 +415,9 @@ function warnIfAsyncClientComponent(Component: Function) {
415
// for transpiled async functions. Neither mechanism is completely
416
// bulletproof but together they cover the most common cases.
417
const isAsyncFunction =
418
- // $FlowIgnore[method-unbinding]
418
+ // $FlowFixMe[method-unbinding]
419
Object.prototype.toString.call(Component) === '[object AsyncFunction]' ||
420
- // $FlowIgnore[method-unbinding]
420
+ // $FlowFixMe[method-unbinding]
421
Object.prototype.toString.call(Component) ===
422
'[object AsyncGeneratorFunction]';
423
if (isAsyncFunction) {
@@ -1148,6 +1148,7 @@ function useThenable<T>(thenable: Thenable<T>): T {
1148
}
1149
1150
function use<T>(usable: Usable<T>): T {
1151
+ // $FlowFixMe[invalid-compare]
1152
if (usable !== null && typeof usable === 'object') {
1153
// $FlowFixMe[method-unbinding]
1154
if (typeof usable.then === 'function') {
@@ -1526,6 +1527,7 @@ function updateReducerImpl<S, A>(
1527
}
1528
}
1529
update = update.next;
1530
+ // $FlowFixMe[invalid-compare]
1531
} while (update !== null && update !== first);
1532
1533
if (newBaseQueueLast === null) {
@@ -2472,6 +2474,7 @@ function updateActionStateImpl<S, P>(
2474
let state: Awaited<S>;
2475
if (
2476
typeof actionResult === 'object' &&
2477
+ // $FlowFixMe[invalid-compare]
2478
actionResult !== null &&
2479
// $FlowFixMe[method-unbinding]
2480
typeof actionResult.then === 'function'
@@ -2645,7 +2648,7 @@ function updateEffectImpl(
2648
if (nextDeps !== null) {
2649
const prevEffect: Effect = currentHook.memoizedState;
2650
const prevDeps = prevEffect.deps;
2648
- // $FlowFixMe[incompatible-call] (@poteto)
2651
+ // $FlowFixMe[incompatible-type] (@poteto)
2652
if (areHookInputsEqual(nextDeps, prevDeps)) {
2653
hook.memoizedState = pushSimpleEffect(
2654
hookFlags,
@@ -2725,7 +2728,7 @@ function mountEvent<Args, Return, F: (...Array<Args>) => Return>(
2728
const hook = mountWorkInProgressHook();
2729
const ref = {impl: callback};
2730
hook.memoizedState = ref;
2728
- // $FlowIgnore[incompatible-return]
2731
+ // $FlowFixMe[incompatible-type]
2732
return function eventFn() {
2733
if (isInvalidExecutionContextForEventFunction()) {
2734
throw new Error(
@@ -2742,7 +2745,7 @@ function updateEvent<Args, Return, F: (...Array<Args>) => Return>(
2745
const hook = updateWorkInProgressHook();
2746
const ref = hook.memoizedState;
2747
useEffectEventImpl({ref, nextImpl: callback});
2745
- // $FlowIgnore[incompatible-return]
2748
+ // $FlowFixMe[incompatible-type]
2749
return function eventFn() {
2750
if (isInvalidExecutionContextForEventFunction()) {
2751
throw new Error(
@@ -2833,6 +2836,7 @@ function mountImperativeHandle<T>(
2836
console.error(
2837
'Expected useImperativeHandle() second argument to be a function ' +
2838
'that creates a handle. Instead received: %s.',
2839
+ // $FlowFixMe[invalid-compare]
2840
create !== null ? typeof create : 'null',
2841
);
2842
}
@@ -2867,6 +2871,7 @@ function updateImperativeHandle<T>(
2871
console.error(
2872
'Expected useImperativeHandle() second argument to be a function ' +
2873
'that creates a handle. Instead received: %s.',
2874
+ // $FlowFixMe[invalid-compare]
2875
create !== null ? typeof create : 'null',
2876
);
2877
}
packages/react-reconciler/src/ReactFiberHostContext.js
+2
@@ -105,6 +105,7 @@ function pushHostContext(fiber: Fiber): void {
105
// we would need to push a context value even for host fibers that
106
// haven't been upgraded yet.
107
const transitionStatus: TransitionStatus = stateHook.memoizedState;
108
+ // $FlowFixMe[constant-condition]
109
if (isPrimaryRenderer) {
110
HostTransitionContext._currentValue = transitionStatus;
111
} else {
@@ -149,6 +150,7 @@ function popHostContext(fiber: Fiber): void {
150
// to `NotPendingTransition`. We can do this because you're not allowed to nest forms. If
151
// we allowed for multiple nested host transition providers, then we'd
152
// need to reset this to the parent provider's status.
153
+ // $FlowFixMe[constant-condition]
154
if (isPrimaryRenderer) {
155
HostTransitionContext._currentValue = NotPendingTransition;
156
} else {
packages/react-reconciler/src/ReactFiberHydrationContext.js
+32
@@ -160,6 +160,7 @@ export function markDidThrowWhileHydratingDEV() {
160
}
161
162
function enterHydrationState(fiber: Fiber): boolean {
163
+ // $FlowFixMe[constant-condition]
164
if (!supportsHydration) {
165
return false;
166
}
@@ -182,6 +183,7 @@ function reenterHydrationStateFromDehydratedActivityInstance(
183
activityInstance: ActivityInstance,
184
treeContext: TreeContext | null,
185
): boolean {
186
+ // $FlowFixMe[constant-condition]
187
if (!supportsHydration) {
188
return false;
189
}
@@ -204,6 +206,7 @@ function reenterHydrationStateFromDehydratedSuspenseInstance(
206
suspenseInstance: SuspenseInstance,
207
treeContext: TreeContext | null,
208
): boolean {
209
+ // $FlowFixMe[constant-condition]
210
if (!supportsHydration) {
211
return false;
212
}
@@ -257,6 +260,8 @@ function tryHydrateInstance(
260
fiber.pendingProps,
261
rootOrSingletonContext,
262
);
263
+ // $FlowFixMe[invalid-compare]
264
+ // $FlowFixMe[invalid-compare]
265
if (instance !== null) {
266
fiber.stateNode = (instance: Instance);
267
@@ -267,7 +272,9 @@ function tryHydrateInstance(
272
fiber.type,
273
fiber.pendingProps,
274
hostContext,
275
+ // $FlowFixMe[invalid-compare]
276
);
277
+ // $FlowFixMe[invalid-compare]
278
if (differences !== null) {
279
const diffNode = buildHydrationDiffNode(fiber, 0);
280
diffNode.serverProps = differences;
@@ -289,8 +296,10 @@ function tryHydrateText(fiber: Fiber, nextInstance: any) {
296
const textInstance = canHydrateTextInstance(
297
nextInstance,
298
text,
299
+ // $FlowFixMe[invalid-compare]
300
rootOrSingletonContext,
301
);
302
+ // $FlowFixMe[invalid-compare]
303
if (textInstance !== null) {
304
fiber.stateNode = (textInstance: TextInstance);
305
hydrationParentFiber = fiber;
@@ -307,9 +316,11 @@ function tryHydrateActivity(
316
): null | ActivityInstance {
317
// fiber is a ActivityComponent Fiber
318
const activityInstance = canHydrateActivityInstance(
319
+ // $FlowFixMe[invalid-compare]
320
nextInstance,
321
rootOrSingletonContext,
322
);
323
+ // $FlowFixMe[invalid-compare]
324
if (activityInstance !== null) {
325
const activityState: ActivityState = {
326
dehydrated: activityInstance,
@@ -339,10 +350,12 @@ function tryHydrateSuspense(
350
nextInstance: any,
351
): null | SuspenseInstance {
352
// fiber is a SuspenseComponent Fiber
353
+ // $FlowFixMe[invalid-compare]
354
const suspenseInstance = canHydrateSuspenseInstance(
355
nextInstance,
356
rootOrSingletonContext,
357
);
358
+ // $FlowFixMe[invalid-compare]
359
if (suspenseInstance !== null) {
360
const suspenseState: SuspenseState = {
361
dehydrated: suspenseInstance,
@@ -403,6 +416,7 @@ function throwOnHydrationMismatch(fiber: Fiber, fromText: boolean = false) {
416
}
417
418
function claimHydratableSingleton(fiber: Fiber): void {
419
+ // $FlowFixMe[constant-condition]
420
if (supportsSingletons) {
421
if (!isHydrating) {
422
return;
@@ -420,11 +434,13 @@ function claimHydratableSingleton(fiber: Fiber): void {
434
if (__DEV__) {
435
if (!didSuspendOrErrorDEV) {
436
const differences = diffHydratedPropsForDevWarnings(
437
+ // $FlowFixMe[invalid-compare]
438
instance,
439
fiber.type,
440
fiber.pendingProps,
441
currentHostContext,
442
);
443
+ // $FlowFixMe[invalid-compare]
444
if (differences !== null) {
445
const diffNode = buildHydrationDiffNode(fiber, 0);
446
diffNode.serverProps = differences;
@@ -543,6 +559,7 @@ function prepareToHydrateHostInstance(
559
fiber: Fiber,
560
hostContext: HostContext,
561
): void {
562
+ // $FlowFixMe[constant-condition]
563
if (!supportsHydration) {
564
throw new Error(
565
'Expected prepareToHydrateHostInstance() to never be called. ' +
@@ -564,6 +581,7 @@ function prepareToHydrateHostInstance(
581
}
582
583
function prepareToHydrateHostTextInstance(fiber: Fiber): void {
584
+ // $FlowFixMe[constant-condition]
585
if (!supportsHydration) {
586
throw new Error(
587
'Expected prepareToHydrateHostTextInstance() to never be called. ' +
@@ -582,12 +600,14 @@ function prepareToHydrateHostTextInstance(fiber: Fiber): void {
600
switch (returnFiber.tag) {
601
case HostRoot: {
602
if (__DEV__) {
603
+ // $FlowFixMe[invalid-compare]
604
if (shouldWarnIfMismatchDev) {
605
const difference = diffHydratedTextForDevWarnings(
606
textInstance,
607
textContent,
608
parentProps,
609
);
610
+ // $FlowFixMe[invalid-compare]
611
if (difference !== null) {
612
const diffNode = buildHydrationDiffNode(fiber, 0);
613
diffNode.serverProps = difference;
@@ -599,6 +619,7 @@ function prepareToHydrateHostTextInstance(fiber: Fiber): void {
619
case HostSingleton:
620
case HostComponent: {
621
parentProps = returnFiber.memoizedProps;
622
+ // $FlowFixMe[invalid-compare]
623
if (__DEV__) {
624
if (shouldWarnIfMismatchDev) {
625
const difference = diffHydratedTextForDevWarnings(
@@ -606,6 +627,7 @@ function prepareToHydrateHostTextInstance(fiber: Fiber): void {
627
textContent,
628
parentProps,
629
);
630
+ // $FlowFixMe[invalid-compare]
631
if (difference !== null) {
632
const diffNode = buildHydrationDiffNode(fiber, 0);
633
diffNode.serverProps = difference;
@@ -630,6 +652,7 @@ function prepareToHydrateHostTextInstance(fiber: Fiber): void {
652
}
653
654
function prepareToHydrateHostActivityInstance(fiber: Fiber): void {
655
+ // $FlowFixMe[constant-condition]
656
if (!supportsHydration) {
657
throw new Error(
658
'Expected prepareToHydrateHostActivityInstance() to never be called. ' +
@@ -651,6 +674,7 @@ function prepareToHydrateHostActivityInstance(fiber: Fiber): void {
674
}
675
676
function prepareToHydrateHostSuspenseInstance(fiber: Fiber): void {
677
+ // $FlowFixMe[constant-condition]
678
if (!supportsHydration) {
679
throw new Error(
680
'Expected prepareToHydrateHostSuspenseInstance() to never be called. ' +
@@ -692,6 +716,7 @@ function skipPastDehydratedActivityInstance(
716
function skipPastDehydratedSuspenseInstance(
717
fiber: Fiber,
718
): null | HydratableInstance {
719
+ // $FlowFixMe[constant-condition]
720
if (!supportsHydration) {
721
throw new Error(
722
'Expected skipPastDehydratedSuspenseInstance() to never be called. ' +
@@ -732,6 +757,7 @@ function popToNextHostParent(fiber: Fiber): void {
757
}
758
759
function popHydrationState(fiber: Fiber): boolean {
760
+ // $FlowFixMe[constant-condition]
761
if (!supportsHydration) {
762
return false;
763
}
@@ -751,6 +777,7 @@ function popHydrationState(fiber: Fiber): boolean {
777
778
const tag = fiber.tag;
779
780
+ // $FlowFixMe[constant-condition]
781
if (supportsSingletons) {
782
// With float we never clear the Root, or Singleton instances. We also do not clear Instances
783
// that have singleton text content
@@ -792,6 +819,7 @@ function popHydrationState(fiber: Fiber): boolean {
819
nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
820
} else if (tag === ActivityComponent) {
821
nextHydratableInstance = skipPastDehydratedActivityInstance(fiber);
822
+ // $FlowFixMe[constant-condition]
823
} else if (supportsSingletons && tag === HostSingleton) {
824
nextHydratableInstance = getNextHydratableSiblingAfterSingleton(
825
fiber.type,
@@ -805,6 +833,7 @@ function popHydrationState(fiber: Fiber): boolean {
833
return true;
834
}
835
836
+// $FlowFixMe[invalid-compare]
837
function warnIfUnhydratedTailNodes(fiber: Fiber) {
838
if (__DEV__) {
839
let nextInstance = nextHydratableInstance;
@@ -813,6 +842,7 @@ function warnIfUnhydratedTailNodes(fiber: Fiber) {
842
const description =
843
describeHydratableInstanceForDevWarnings(nextInstance);
844
diffNode.serverTail.push(description);
845
+ // $FlowFixMe[invalid-compare]
846
if (description.type === 'Suspense') {
847
const suspenseInstance: SuspenseInstance = (nextInstance: any);
848
nextInstance =
@@ -825,6 +855,7 @@ function warnIfUnhydratedTailNodes(fiber: Fiber) {
855
}
856
857
function resetHydrationState(): void {
858
+ // $FlowFixMe[constant-condition]
859
if (!supportsHydration) {
860
return;
861
}
@@ -845,6 +876,7 @@ function resetHydrationState(): void {
876
// before re-running beginWork on the same fiber, or when throwAndUnwindWorkLoop
877
// calls unwindWork on ancestor fibers.
878
function popHydrationStateOnInterruptedWork(fiber: Fiber): void {
879
+ // $FlowFixMe[constant-condition]
880
if (!supportsHydration) {
881
return;
882
}
packages/react-reconciler/src/ReactFiberLane.js
+1
@@ -942,6 +942,7 @@ export function markRootFinished(
942
// commits, they behave like regular updates.
943
for (let i = 0; i < hiddenUpdatesForLane.length; i++) {
944
const update = hiddenUpdatesForLane[i];
945
+ // $FlowFixMe[invalid-compare]
946
if (update !== null) {
947
update.lane &= ~OffscreenLane;
948
}
packages/react-reconciler/src/ReactFiberNewContext.js
+11
-2
@@ -84,6 +84,7 @@ export function pushProvider<T>(
84
context: ReactContext<T>,
85
nextValue: T,
86
): void {
87
+ // $FlowFixMe[constant-condition]
88
if (isPrimaryRenderer) {
89
push(valueCursor, context._currentValue, providerFiber);
90
@@ -131,6 +132,7 @@ export function popProvider(
132
): void {
133
const currentValue = valueCursor.current;
134
135
+ // $FlowFixMe[constant-condition]
136
if (isPrimaryRenderer) {
137
context._currentValue = currentValue;
138
if (__DEV__) {
@@ -236,6 +238,7 @@ function propagateContextChanges<T>(
238
findContext: for (let i = 0; i < contexts.length; i++) {
239
const context: ReactContext<T> = contexts[i];
240
// Check if the context matches.
241
+ // $FlowFixMe[invalid-compare]
242
if (dependency.context === context) {
243
// Match! Schedule an update on this fiber.
244
@@ -520,6 +523,7 @@ export function checkIfContextChanged(
523
let dependency = currentDependencies.firstContext;
524
while (dependency !== null) {
525
const context = dependency.context;
526
+ // $FlowFixMe[constant-condition]
527
const newValue = isPrimaryRenderer
528
? context._currentValue
529
: context._currentValue2;
@@ -577,6 +581,7 @@ function readContextForConsumer<T>(
581
consumer: Fiber | null,
582
context: ReactContext<T>,
583
): T {
584
+ // $FlowFixMe[constant-condition]
585
const value = isPrimaryRenderer
586
? context._currentValue
587
: context._currentValue2;
@@ -598,20 +603,24 @@ function readContextForConsumer<T>(
603
}
604
605
// This is the first dependency for this component. Create a new list.
606
+ // $FlowFixMe[incompatible-type]
607
lastContextDependency = contextItem;
608
consumer.dependencies = __DEV__
603
- ? {
609
+ ? // $FlowFixMe[incompatible-type]
610
+ {
611
lanes: NoLanes,
612
firstContext: contextItem,
613
_debugThenableState: null,
614
}
608
- : {
615
+ : // $FlowFixMe[incompatible-type]
616
+ {
617
lanes: NoLanes,
618
firstContext: contextItem,
619
};
620
consumer.flags |= NeedsPropagation;
621
} else {
622
// Append a new context item.
623
+ // $FlowFixMe[incompatible-type]
624
lastContextDependency = lastContextDependency.next = contextItem;
625
}
626
return value;
packages/react-reconciler/src/ReactFiberPerformanceTrack.js
+4
@@ -511,6 +511,7 @@ function logComponentEffectErrored(
511
performance.measure.bind(performance, measureName, options),
512
);
513
} else {
514
+ // $FlowFixMe[incompatible-type]
515
performance.measure(measureName, options);
516
}
517
performance.clearMeasures(measureName);
@@ -783,6 +784,7 @@ export function logBlockingStart(
784
performance.measure.bind(performance, label, measureOptions),
785
);
786
} else {
787
+ // $FlowFixMe[incompatible-type]
788
performance.measure(label, measureOptions);
789
}
790
performance.clearMeasures(label);
@@ -889,6 +891,7 @@ export function logGestureStart(
891
performance.measure.bind(performance, label, measureOptions),
892
);
893
} else {
894
+ // $FlowFixMe[incompatible-type]
895
performance.measure(label, measureOptions);
896
}
897
performance.clearMeasures(label);
@@ -1030,6 +1033,7 @@ export function logTransitionStart(
1033
performance.measure.bind(performance, label, measureOptions),
1034
);
1035
} else {
1036
+ // $FlowFixMe[incompatible-type]
1037
performance.measure(label, measureOptions);
1038
}
1039
performance.clearMeasures(label);
packages/react-reconciler/src/ReactFiberReconciler.js
+1
@@ -880,6 +880,7 @@ export function injectIntoDevTools(): boolean {
880
// which may not match for third party renderers.
881
reconcilerVersion: ReactVersion,
882
};
883
+ // $FlowFixMe[invalid-compare]
884
if (extraDevToolsConfig !== null) {
885
internals.rendererConfig = (extraDevToolsConfig: RendererInspectionConfig);
886
}
packages/react-reconciler/src/ReactFiberRootScheduler.js
+1
@@ -662,6 +662,7 @@ function scheduleImmediateRootScheduleTask() {
662
663
// TODO: Can we land supportsMicrotasks? Which environments don't support it?
664
// Alternatively, can we move this check to the host config?
665
+ // $FlowFixMe[constant-condition]
666
if (supportsMicrotasks) {
667
scheduleMicrotask(() => {
668
// In Safari, appending an iframe forces microtasks to run.
packages/react-reconciler/src/ReactFiberScope.js
+8
@@ -40,6 +40,7 @@ function collectScopedNodes(
40
const {type, memoizedProps, stateNode} = node;
41
const instance = getPublicInstance(stateNode);
42
if (
43
+ // $FlowFixMe[invalid-compare]
44
instance !== null &&
45
fn(type, memoizedProps || emptyObject, instance) === true
46
) {
@@ -65,6 +66,7 @@ function collectFirstScopedNode(
66
if (node.tag === HostComponent) {
67
const {type, memoizedProps, stateNode} = node;
68
const instance = getPublicInstance(stateNode);
69
+ // $FlowFixMe[invalid-compare]
70
if (instance !== null && fn(type, memoizedProps, instance) === true) {
71
return instance;
72
}
@@ -145,11 +147,13 @@ function DO_NOT_USE_queryAllNodes(
147
fn: ReactScopeQuery,
148
): null | Array<Object> {
149
const currentFiber = getInstanceFromScope(this);
150
+ // $FlowFixMe[invalid-compare]
151
if (currentFiber === null) {
152
return null;
153
}
154
const child = currentFiber.child;
155
const scopedNodes: Array<any> = [];
156
+ // $FlowFixMe[invalid-compare]
157
if (child !== null) {
158
collectScopedNodesFromChildren(child, fn, scopedNodes);
159
}
@@ -161,10 +165,12 @@ function DO_NOT_USE_queryFirstNode(
165
fn: ReactScopeQuery,
166
): null | Object {
167
const currentFiber = getInstanceFromScope(this);
168
+ // $FlowFixMe[invalid-compare]
169
if (currentFiber === null) {
170
return null;
171
}
172
const child = currentFiber.child;
173
+ // $FlowFixMe[invalid-compare]
174
if (child !== null) {
175
return collectFirstScopedNodeFromChildren(child, fn);
176
}
@@ -187,11 +193,13 @@ function getChildContextValues<T>(
193
context: ReactContext<T>,
194
): Array<T> {
195
const currentFiber = getInstanceFromScope(this);
196
+ // $FlowFixMe[invalid-compare]
197
if (currentFiber === null) {
198
return [];
199
}
200
const child = currentFiber.child;
201
const childContextValues: Array<T> = [];
202
+ // $FlowFixMe[invalid-compare]
203
if (child !== null) {
204
collectNearestChildContextValues(child, context, childContextValues);
205
}
packages/react-reconciler/src/ReactFiberSuspenseComponent.js
+1
@@ -62,6 +62,7 @@ export type RetryQueue = Set<Wakeable>;
62
63
export function findFirstSuspended(row: Fiber): null | Fiber {
64
let node = row;
65
+ // $FlowFixMe[invalid-compare]
66
while (node !== null) {
67
if (node.tag === SuspenseComponent) {
68
const state: SuspenseState | null = node.memoizedState;
packages/react-reconciler/src/ReactFiberSuspenseContext.js
+1
@@ -92,6 +92,7 @@ export function pushPrimaryTreeSuspenseHandler(handler: Fiber): void {
92
shellBoundary = handler;
93
} else {
94
const prevState: SuspenseState = current.memoizedState;
95
+ // $FlowFixMe[invalid-compare]
96
if (prevState !== null) {
97
// This boundary is showing a fallback in the current UI.
98
shellBoundary = handler;
packages/react-reconciler/src/ReactFiberThenable.js
+1
@@ -308,6 +308,7 @@ export function suspendCommit(): void {
308
// This extra indirection only exists so it can handle passing
309
// noopSuspenseyCommitThenable through to throwException.
310
// TODO: Factor the thenable check out of throwException
311
+ // $FlowFixMe[incompatible-type]
312
suspendedThenable = noopSuspenseyCommitThenable;
313
throw SuspenseyCommitException;
314
}
packages/react-reconciler/src/ReactFiberTracingMarkerComponent.js
+3
@@ -63,6 +63,7 @@ export function processTransitionCallbacks(
63
callbacks: TransitionTracingCallbacks,
64
): void {
65
if (enableTransitionTracing) {
66
+ // $FlowFixMe[invalid-compare]
67
if (pendingTransitions !== null) {
68
const transitionStart = pendingTransitions.transitionStart;
69
const onTransitionStart = callbacks.onTransitionStart;
@@ -78,9 +79,11 @@ export function processTransitionCallbacks(
79
const onMarkerProgress = callbacks.onMarkerProgress;
80
if (onMarkerProgress != null && markerProgress !== null) {
81
markerProgress.forEach((markerInstance, markerName) => {
82
+ // $FlowFixMe[invalid-compare]
83
if (markerInstance.transitions !== null) {
84
// TODO: Clone the suspense object so users can't modify it
85
const pending =
86
+ // $FlowFixMe[invalid-compare]
87
markerInstance.pendingBoundaries !== null
88
? Array.from(markerInstance.pendingBoundaries.values())
89
: [];
packages/react-reconciler/src/ReactFiberTransition.js
+4
@@ -135,6 +135,7 @@ function chainGestureCancellation(
135
prevCancel: null | (() => void),
136
): () => void {
137
return function cancelGesture(): void {
138
+ // $FlowFixMe[invalid-compare]
139
if (scheduledGesture !== null) {
140
cancelScheduledGesture(root, scheduledGesture);
141
}
@@ -245,6 +246,7 @@ export function requestCacheFromPool(renderLanes: Lanes): Cache {
246
const freshCache = createCache();
247
root.pooledCache = freshCache;
248
retainCache(freshCache);
249
+ // $FlowFixMe[invalid-compare]
250
if (freshCache !== null) {
251
root.pooledCacheLanes |= renderLanes;
252
}
@@ -329,6 +331,7 @@ export function getSuspendedCache(): SpawnedCachePool | null {
331
return {
332
// We must also save the parent, so that when we resume we can detect
333
// a refresh.
334
+ // $FlowFixMe[constant-condition]
335
parent: isPrimaryRenderer
336
? CacheContext._currentValue
337
: CacheContext._currentValue2,
@@ -345,6 +348,7 @@ export function getOffscreenDeferredCache(): SpawnedCachePool | null {
348
return {
349
// We must also store the parent, so that when we resume we can detect
350
// a refresh.
351
+ // $FlowFixMe[constant-condition]
352
parent: isPrimaryRenderer
353
? CacheContext._currentValue
354
: CacheContext._currentValue2,
packages/react-reconciler/src/ReactFiberWorkLoop.js
+5
-2
@@ -1321,7 +1321,9 @@ function recoverFromConcurrentError(
1321
// Before rendering again, save the errors from the previous attempt.
1322
const errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
1323
1324
+ // $FlowFixMe[constant-condition]
1325
const wasRootDehydrated = supportsHydration && isRootDehydrated(root);
1326
+ // $FlowFixMe[constant-condition]
1327
if (wasRootDehydrated) {
1328
// The shell failed to hydrate. Set a flag to force a client rendering
1329
// during the next attempt. To do this, we call prepareFreshStack now
@@ -3042,7 +3044,7 @@ function workLoopConcurrent(nonIdle: boolean) {
3044
if (workInProgress !== null) {
3045
const yieldAfter = now() + (nonIdle ? 25 : 5);
3046
do {
3045
- // $FlowFixMe[incompatible-call] flow doesn't know that now() is side-effect free
3047
+ // $FlowFixMe[incompatible-type] flow doesn't know that now() is side-effect free
3048
performUnitOfWork(workInProgress);
3049
} while (workInProgress !== null && now() < yieldAfter);
3050
}
@@ -3052,7 +3054,7 @@ function workLoopConcurrent(nonIdle: boolean) {
3054
function workLoopConcurrentByScheduler() {
3055
// Perform work until Scheduler asks us to yield
3056
while (workInProgress !== null && !shouldYield()) {
3055
- // $FlowFixMe[incompatible-call] flow doesn't know that shouldYield() is side-effect free
3057
+ // $FlowFixMe[incompatible-type] flow doesn't know that shouldYield() is side-effect free
3058
performUnitOfWork(workInProgress);
3059
}
3060
}
@@ -4371,6 +4373,7 @@ function flushSpawnedWork(): void {
4373
4374
// Eagerly flush any event replaying that we unblocked within this commit.
4375
// This ensures that those are observed before we render any new changes.
4376
+ // $FlowFixMe[constant-condition]
4377
if (supportsHydration) {
4378
flushHydrationEvents();
4379
}
packages/react-reconciler/src/ReactTestSelectors.js
+9
@@ -130,6 +130,7 @@ function findFiberRootForHostRoot(hostRoot: Instance): Fiber {
130
} else {
131
const fiberRoot = findFiberRoot(hostRoot);
132
133
+ // $FlowFixMe[invalid-compare]
134
if (fiberRoot === null) {
135
throw new Error(
136
'Could not find React container within specified host subtree.',
@@ -177,7 +178,9 @@ function matchSelector(fiber: Fiber, selector: Selector): boolean {
178
tag === HostSingleton
179
) {
180
const textContent = getTextContent(fiber);
181
+ // $FlowFixMe[invalid-compare]
182
if (
183
+ // $FlowFixMe[invalid-compare]
184
textContent !== null &&
185
textContent.indexOf(((selector: any): TextSelector).value) >= 0
186
) {
@@ -307,6 +310,7 @@ export function findAllNodes(
310
hostRoot: Instance,
311
selectors: Array<Selector>,
312
): Array<Instance> {
313
+ // $FlowFixMe[constant-condition]
314
if (!supportsTestSelectors) {
315
throw new Error('Test selector API is not supported by this renderer.');
316
}
@@ -346,6 +350,7 @@ export function getFindAllNodesFailureDescription(
350
hostRoot: Instance,
351
selectors: Array<Selector>,
352
): string | null {
353
+ // $FlowFixMe[constant-condition]
354
if (!supportsTestSelectors) {
355
throw new Error('Test selector API is not supported by this renderer.');
356
}
@@ -417,6 +422,7 @@ export function findBoundingRects(
422
hostRoot: Instance,
423
selectors: Array<Selector>,
424
): Array<BoundingRect> {
425
+ // $FlowFixMe[constant-condition]
426
if (!supportsTestSelectors) {
427
throw new Error('Test selector API is not supported by this renderer.');
428
}
@@ -507,6 +513,7 @@ export function focusWithin(
513
hostRoot: Instance,
514
selectors: Array<Selector>,
515
): boolean {
516
+ // $FlowFixMe[constant-condition]
517
if (!supportsTestSelectors) {
518
throw new Error('Test selector API is not supported by this renderer.');
519
}
@@ -545,6 +552,7 @@ export function focusWithin(
552
const commitHooks: Array<Function> = [];
553
554
export function onCommitRoot(): void {
555
+ // $FlowFixMe[constant-condition]
556
if (supportsTestSelectors) {
557
commitHooks.forEach(commitHook => commitHook());
558
}
@@ -562,6 +570,7 @@ export function observeVisibleRects(
570
callback: (intersections: Array<{ratio: number, rect: BoundingRect}>) => void,
571
options?: IntersectionObserverOptions,
572
): {disconnect: () => void} {
573
+ // $FlowFixMe[constant-condition]
574
if (!supportsTestSelectors) {
575
throw new Error('Test selector API is not supported by this renderer.');
576
}
packages/react-server-dom-esm/src/ReactFlightESMNodeLoader.js
+2
-2
@@ -726,7 +726,7 @@ async function transformModuleIfNeeded(
726
if (sourceMappingURL) {
727
const sourceMapResult = await loader(
728
sourceMappingURL,
729
- // $FlowFixMe
729
+ // $FlowFixMe[incompatible-type]
730
{
731
format: 'json',
732
conditions: [],
@@ -738,7 +738,7 @@ async function transformModuleIfNeeded(
738
const sourceMapString =
739
typeof sourceMapResult.source === 'string'
740
? sourceMapResult.source
741
- : // $FlowFixMe
741
+ : // $FlowFixMe[extra-arg]
742
sourceMapResult.source.toString('utf8');
743
sourceMap = JSON.parse(sourceMapString);
744
packages/react-server-dom-esm/src/ReactFlightESMReferences.js
+1
-1
@@ -49,7 +49,7 @@ const FunctionBind = Function.prototype.bind;
49
// $FlowFixMe[method-unbinding]
50
const ArraySlice = Array.prototype.slice;
51
function bind(this: ServerReference<any>): any {
52
- // $FlowFixMe[incompatible-call]
52
+ // $FlowFixMe[incompatible-type]
53
const newFn = FunctionBind.apply(this, arguments);
54
if (this.$$typeof === SERVER_REFERENCE_TAG) {
55
if (__DEV__) {
packages/react-server-dom-esm/src/client/ReactFlightClientConfigBundlerESM.js
+3
-3
@@ -139,7 +139,7 @@ export function getModuleDebugInfo<T>(
139
if (ioInfo === undefined) {
140
let href;
141
try {
142
- // $FlowFixMe
142
+ // $FlowFixMe[incompatible-type]
143
href = new URL(filename, document.baseURI).href;
144
} catch (_) {
145
href = filename;
@@ -162,10 +162,10 @@ export function getModuleDebugInfo<T>(
162
}
163
}
164
const value = Promise.resolve(href);
165
- // $FlowFixMe
165
+ // $FlowFixMe[prop-missing]
166
value.status = 'fulfilled';
167
// Is there some more useful representation for the chunk?
168
- // $FlowFixMe
168
+ // $FlowFixMe[prop-missing]
169
value.value = href;
170
// Create a fake stack frame that points to the beginning of the chunk. This is
171
// probably not source mapped so will link to the compiled source rather than
packages/react-server-dom-esm/src/server/ReactFlightDOMServerNode.js
+3
-3
@@ -124,11 +124,11 @@ function startReadingFromDebugChannelReadable(
124
const ws: WebSocket = (stream: any);
125
ws.binaryType = 'arraybuffer';
126
ws.addEventListener('message', event => {
127
- // $FlowFixMe
127
+ // $FlowFixMe[incompatible-type]
128
onData(event.data);
129
});
130
ws.addEventListener('error', event => {
131
- // $FlowFixMe
131
+ // $FlowFixMe[prop-missing]
132
onError(event.error);
133
});
134
ws.addEventListener('close', onClose);
@@ -468,7 +468,7 @@ function decodeReplyFromBusboy<T>(
468
busboyStream.on('error', err => {
469
reportGlobalError(
470
response,
471
- // $FlowFixMe[incompatible-call] types Error and mixed are incompatible
471
+ // $FlowFixMe[incompatible-type] types Error and mixed are incompatible
472
err,
473
);
474
});
packages/react-server-dom-fb/src/ReactDOMServerFB.js
+1
-1
@@ -44,7 +44,7 @@ opaque type Stream = {
44
};
45
46
function renderToStream(children: ReactNodeList, options: Options): Stream {
47
- const destination = {
47
+ const destination: Destination = {
48
buffer: '',
49
done: false,
50
fatal: false,
packages/react-server-dom-parcel/src/ReactFlightParcelReferences.js
+1
-1
@@ -56,7 +56,7 @@ const FunctionBind = Function.prototype.bind;
56
// $FlowFixMe[method-unbinding]
57
const ArraySlice = Array.prototype.slice;
58
function bind(this: ServerReference<any>): any {
59
- // $FlowFixMe[incompatible-call]
59
+ // $FlowFixMe[incompatible-type]
60
const newFn = FunctionBind.apply(this, arguments);
61
if (this.$$typeof === SERVER_REFERENCE_TAG) {
62
if (__DEV__) {
packages/react-server-dom-parcel/src/server/ReactFlightDOMServerBrowser.js
+3
@@ -156,6 +156,7 @@ export function renderToReadableStream(
156
},
157
},
158
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
159
+ // $FlowFixMe[incompatible-type]
160
{highWaterMark: 0},
161
);
162
debugStream.pipeTo(debugChannelWritable);
@@ -178,6 +179,7 @@ export function renderToReadableStream(
179
},
180
},
181
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
182
+ // $FlowFixMe[incompatible-type]
183
{highWaterMark: 0},
184
);
185
return stream;
@@ -206,6 +208,7 @@ export function prerender(
208
},
209
},
210
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
211
+ // $FlowFixMe[incompatible-type]
212
{highWaterMark: 0},
213
);
214
resolve({prelude: stream});
packages/react-server-dom-parcel/src/server/ReactFlightDOMServerEdge.js
+4
-1
@@ -161,6 +161,7 @@ export function renderToReadableStream(
161
},
162
},
163
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
164
+ // $FlowFixMe[incompatible-type]
165
{highWaterMark: 0},
166
);
167
debugStream.pipeTo(debugChannelWritable);
@@ -183,6 +184,7 @@ export function renderToReadableStream(
184
},
185
},
186
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
187
+ // $FlowFixMe[incompatible-type]
188
{highWaterMark: 0},
189
);
190
return stream;
@@ -211,6 +213,7 @@ export function prerender(
213
},
214
},
215
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
216
+ // $FlowFixMe[incompatible-type]
217
{highWaterMark: 0},
218
);
219
resolve({prelude: stream});
@@ -310,7 +313,7 @@ export function decodeReplyFromAsyncIterable<T>(
313
reportGlobalError(response, reason);
314
if (typeof (iterator: any).throw === 'function') {
315
// The iterator protocol doesn't necessarily include this but a generator do.
313
- // $FlowFixMe should be able to pass mixed
316
+ // $FlowFixMe[prop-missing] should be able to pass mixed
317
iterator.throw(reason).then(error, error);
318
}
319
}
packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js
+7
-4
@@ -137,11 +137,11 @@ function startReadingFromDebugChannelReadable(
137
const ws: WebSocket = (stream: any);
138
ws.binaryType = 'arraybuffer';
139
ws.addEventListener('message', event => {
140
- // $FlowFixMe
140
+ // $FlowFixMe[incompatible-type]
141
onData(event.data);
142
});
143
ws.addEventListener('error', event => {
144
- // $FlowFixMe
144
+ // $FlowFixMe[prop-missing]
145
onError(event.error);
146
});
147
ws.addEventListener('close', onClose);
@@ -386,6 +386,7 @@ export function renderToReadableStream(
386
},
387
},
388
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
389
+ // $FlowFixMe[incompatible-type]
390
{highWaterMark: 0},
391
);
392
debugStream.pipeTo(debugChannelWritable);
@@ -410,6 +411,7 @@ export function renderToReadableStream(
411
},
412
},
413
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
414
+ // $FlowFixMe[incompatible-type]
415
{highWaterMark: 0},
416
);
417
return stream;
@@ -520,6 +522,7 @@ export function prerender(
522
},
523
},
524
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
525
+ // $FlowFixMe[incompatible-type]
526
{highWaterMark: 0},
527
);
528
resolve({prelude: stream});
@@ -698,7 +701,7 @@ export function decodeReplyFromBusboy<T>(
701
busboyStream.on('error', err => {
702
reportGlobalError(
703
response,
701
- // $FlowFixMe[incompatible-call] types Error and mixed are incompatible
704
+ // $FlowFixMe[incompatible-type] types Error and mixed are incompatible
705
err,
706
);
707
});
@@ -768,7 +771,7 @@ export function decodeReplyFromAsyncIterable<T>(
771
reportGlobalError(response, reason);
772
if (typeof (iterator: any).throw === 'function') {
773
// The iterator protocol doesn't necessarily include this but a generator do.
771
- // $FlowFixMe should be able to pass mixed
774
+ // $FlowFixMe[prop-missing] should be able to pass mixed
775
iterator.throw(reason).then(error, error);
776
}
777
}
packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js
+6
-1
@@ -63,7 +63,7 @@ const FunctionBind = Function.prototype.bind;
63
// $FlowFixMe[method-unbinding]
64
const ArraySlice = Array.prototype.slice;
65
function bind(this: ServerReference<any>): any {
66
- // $FlowFixMe[incompatible-call]
66
+ // $FlowFixMe[incompatible-type]
67
const newFn = FunctionBind.apply(this, arguments);
68
if (this.$$typeof === SERVER_REFERENCE_TAG) {
69
if (__DEV__) {
@@ -261,6 +261,8 @@ function getReference(target: Function, name: string | symbol): $FlowFixMe {
261
262
const clientReference: ClientReference<any> =
263
registerClientReferenceImpl(({}: any), target.$$id, true);
264
+ // $FlowFixMe[incompatible-variance]
265
+ // $FlowFixMe[incompatible-type]
266
const proxy = new Proxy(clientReference, proxyHandlers);
267
268
// Treat this as a resolved Promise for React's use()
@@ -355,5 +357,8 @@ export function createClientModuleProxy<T>(
357
moduleId,
358
false,
359
);
360
+ // $FlowFixMe[incompatible-variance]
361
+ // $FlowFixMe[incompatible-type]
362
+ // $FlowFixMe[incompatible-exact]
363
return new Proxy(clientReference, proxyHandlers);
364
}
packages/react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopackBrowser.js
+3
-3
@@ -33,7 +33,7 @@ export function addChunkDebugInfo(
33
if (ioInfo === undefined) {
34
let href;
35
try {
36
- // $FlowFixMe
36
+ // $FlowFixMe[incompatible-type]
37
href = new URL(filename, document.baseURI).href;
38
} catch (_) {
39
href = filename;
@@ -56,10 +56,10 @@ export function addChunkDebugInfo(
56
}
57
}
58
const value = Promise.resolve(href);
59
- // $FlowFixMe
59
+ // $FlowFixMe[prop-missing]
60
value.status = 'fulfilled';
61
// Is there some more useful representation for the chunk?
62
- // $FlowFixMe
62
+ // $FlowFixMe[prop-missing]
63
value.value = href;
64
// Create a fake stack frame that points to the beginning of the chunk. This is
65
// probably not source mapped so will link to the compiled source rather than
packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerBrowser.js
+3
@@ -153,6 +153,7 @@ function renderToReadableStream(
153
},
154
},
155
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
156
+ // $FlowFixMe[incompatible-type]
157
{highWaterMark: 0},
158
);
159
debugStream.pipeTo(debugChannelWritable);
@@ -175,6 +176,7 @@ function renderToReadableStream(
176
},
177
},
178
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
179
+ // $FlowFixMe[incompatible-type]
180
{highWaterMark: 0},
181
);
182
return stream;
@@ -204,6 +206,7 @@ function prerender(
206
},
207
},
208
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
209
+ // $FlowFixMe[incompatible-type]
210
{highWaterMark: 0},
211
);
212
resolve({prelude: stream});
packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerEdge.js
+4
-1
@@ -158,6 +158,7 @@ function renderToReadableStream(
158
},
159
},
160
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
161
+ // $FlowFixMe[incompatible-type]
162
{highWaterMark: 0},
163
);
164
debugStream.pipeTo(debugChannelWritable);
@@ -180,6 +181,7 @@ function renderToReadableStream(
181
},
182
},
183
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
184
+ // $FlowFixMe[incompatible-type]
185
{highWaterMark: 0},
186
);
187
return stream;
@@ -209,6 +211,7 @@ function prerender(
211
},
212
},
213
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
214
+ // $FlowFixMe[incompatible-type]
215
{highWaterMark: 0},
216
);
217
resolve({prelude: stream});
@@ -309,7 +312,7 @@ function decodeReplyFromAsyncIterable<T>(
312
reportGlobalError(response, reason);
313
if (typeof (iterator: any).throw === 'function') {
314
// The iterator protocol doesn't necessarily include this but a generator do.
312
- // $FlowFixMe should be able to pass mixed
315
+ // $FlowFixMe[prop-missing] should be able to pass mixed
316
iterator.throw(reason).then(error, error);
317
}
318
}
packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js
+7
-4
@@ -130,11 +130,11 @@ function startReadingFromDebugChannelReadable(
130
const ws: WebSocket = (stream: any);
131
ws.binaryType = 'arraybuffer';
132
ws.addEventListener('message', event => {
133
- // $FlowFixMe
133
+ // $FlowFixMe[incompatible-type]
134
onData(event.data);
135
});
136
ws.addEventListener('error', event => {
137
- // $FlowFixMe
137
+ // $FlowFixMe[prop-missing]
138
onError(event.error);
139
});
140
ws.addEventListener('close', onClose);
@@ -381,6 +381,7 @@ function renderToReadableStream(
381
},
382
},
383
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
384
+ // $FlowFixMe[incompatible-type]
385
{highWaterMark: 0},
386
);
387
debugStream.pipeTo(debugChannelWritable);
@@ -405,6 +406,7 @@ function renderToReadableStream(
406
},
407
},
408
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
409
+ // $FlowFixMe[incompatible-type]
410
{highWaterMark: 0},
411
);
412
return stream;
@@ -517,6 +519,7 @@ function prerender(
519
},
520
},
521
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
522
+ // $FlowFixMe[incompatible-type]
523
{highWaterMark: 0},
524
);
525
resolve({prelude: stream});
@@ -690,7 +693,7 @@ function decodeReplyFromBusboy<T>(
693
busboyStream.on('error', err => {
694
reportGlobalError(
695
response,
693
- // $FlowFixMe[incompatible-call] types Error and mixed are incompatible
696
+ // $FlowFixMe[incompatible-type] types Error and mixed are incompatible
697
err,
698
);
699
});
@@ -762,7 +765,7 @@ function decodeReplyFromAsyncIterable<T>(
765
reportGlobalError(response, reason);
766
if (typeof (iterator: any).throw === 'function') {
767
// The iterator protocol doesn't necessarily include this but a generator do.
765
- // $FlowFixMe should be able to pass mixed
768
+ // $FlowFixMe[prop-missing] should be able to pass mixed
769
iterator.throw(reason).then(error, error);
770
}
771
}
packages/react-server-dom-unbundled/src/ReactFlightUnbundledNodeLoader.js
+2
-2
@@ -726,7 +726,7 @@ async function transformModuleIfNeeded(
726
if (sourceMappingURL) {
727
const sourceMapResult = await loader(
728
sourceMappingURL,
729
- // $FlowFixMe
729
+ // $FlowFixMe[incompatible-type]
730
{
731
format: 'json',
732
conditions: [],
@@ -738,7 +738,7 @@ async function transformModuleIfNeeded(
738
const sourceMapString =
739
typeof sourceMapResult.source === 'string'
740
? sourceMapResult.source
741
- : // $FlowFixMe
741
+ : // $FlowFixMe[extra-arg]
742
sourceMapResult.source.toString('utf8');
743
sourceMap = JSON.parse(sourceMapString);
744
packages/react-server-dom-unbundled/src/ReactFlightUnbundledReferences.js
+6
-1
@@ -63,7 +63,7 @@ const FunctionBind = Function.prototype.bind;
63
// $FlowFixMe[method-unbinding]
64
const ArraySlice = Array.prototype.slice;
65
function bind(this: ServerReference<any>): any {
66
- // $FlowFixMe[incompatible-call]
66
+ // $FlowFixMe[incompatible-type]
67
const newFn = FunctionBind.apply(this, arguments);
68
if (this.$$typeof === SERVER_REFERENCE_TAG) {
69
if (__DEV__) {
@@ -261,6 +261,8 @@ function getReference(target: Function, name: string | symbol): $FlowFixMe {
261
262
const clientReference: ClientReference<any> =
263
registerClientReferenceImpl(({}: any), target.$$id, true);
264
+ // $FlowFixMe[incompatible-variance]
265
+ // $FlowFixMe[incompatible-type]
266
const proxy = new Proxy(clientReference, proxyHandlers);
267
268
// Treat this as a resolved Promise for React's use()
@@ -355,5 +357,8 @@ export function createClientModuleProxy<T>(
357
moduleId,
358
false,
359
);
360
+ // $FlowFixMe[incompatible-variance]
361
+ // $FlowFixMe[incompatible-type]
362
+ // $FlowFixMe[incompatible-exact]
363
return new Proxy(clientReference, proxyHandlers);
364
}
packages/react-server-dom-unbundled/src/server/ReactFlightDOMServerNode.js
+7
-4
@@ -130,11 +130,11 @@ function startReadingFromDebugChannelReadable(
130
const ws: WebSocket = (stream: any);
131
ws.binaryType = 'arraybuffer';
132
ws.addEventListener('message', event => {
133
- // $FlowFixMe
133
+ // $FlowFixMe[incompatible-type]
134
onData(event.data);
135
});
136
ws.addEventListener('error', event => {
137
- // $FlowFixMe
137
+ // $FlowFixMe[prop-missing]
138
onError(event.error);
139
});
140
ws.addEventListener('close', onClose);
@@ -381,6 +381,7 @@ function renderToReadableStream(
381
},
382
},
383
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
384
+ // $FlowFixMe[incompatible-type]
385
{highWaterMark: 0},
386
);
387
debugStream.pipeTo(debugChannelWritable);
@@ -405,6 +406,7 @@ function renderToReadableStream(
406
},
407
},
408
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
409
+ // $FlowFixMe[incompatible-type]
410
{highWaterMark: 0},
411
);
412
return stream;
@@ -517,6 +519,7 @@ function prerender(
519
},
520
},
521
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
522
+ // $FlowFixMe[incompatible-type]
523
{highWaterMark: 0},
524
);
525
resolve({prelude: stream});
@@ -690,7 +693,7 @@ function decodeReplyFromBusboy<T>(
693
busboyStream.on('error', err => {
694
reportGlobalError(
695
response,
693
- // $FlowFixMe[incompatible-call] types Error and mixed are incompatible
696
+ // $FlowFixMe[incompatible-type] types Error and mixed are incompatible
697
err,
698
);
699
});
@@ -762,7 +765,7 @@ function decodeReplyFromAsyncIterable<T>(
765
reportGlobalError(response, reason);
766
if (typeof (iterator: any).throw === 'function') {
767
// The iterator protocol doesn't necessarily include this but a generator do.
765
- // $FlowFixMe should be able to pass mixed
768
+ // $FlowFixMe[prop-missing] should be able to pass mixed
769
iterator.throw(reason).then(error, error);
770
}
771
}
packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js
+2
-2
@@ -726,7 +726,7 @@ async function transformModuleIfNeeded(
726
if (sourceMappingURL) {
727
const sourceMapResult = await loader(
728
sourceMappingURL,
729
- // $FlowFixMe
729
+ // $FlowFixMe[incompatible-type]
730
{
731
format: 'json',
732
conditions: [],
@@ -738,7 +738,7 @@ async function transformModuleIfNeeded(
738
const sourceMapString =
739
typeof sourceMapResult.source === 'string'
740
? sourceMapResult.source
741
- : // $FlowFixMe
741
+ : // $FlowFixMe[extra-arg]
742
sourceMapResult.source.toString('utf8');
743
sourceMap = JSON.parse(sourceMapString);
744
packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js
+6
-1
@@ -63,7 +63,7 @@ const FunctionBind = Function.prototype.bind;
63
// $FlowFixMe[method-unbinding]
64
const ArraySlice = Array.prototype.slice;
65
function bind(this: ServerReference<any>): any {
66
- // $FlowFixMe[incompatible-call]
66
+ // $FlowFixMe[incompatible-type]
67
const newFn = FunctionBind.apply(this, arguments);
68
if (this.$$typeof === SERVER_REFERENCE_TAG) {
69
if (__DEV__) {
@@ -261,6 +261,8 @@ function getReference(target: Function, name: string | symbol): $FlowFixMe {
261
262
const clientReference: ClientReference<any> =
263
registerClientReferenceImpl(({}: any), target.$$id, true);
264
+ // $FlowFixMe[incompatible-variance]
265
+ // $FlowFixMe[incompatible-type]
266
const proxy = new Proxy(clientReference, proxyHandlers);
267
268
// Treat this as a resolved Promise for React's use()
@@ -355,5 +357,8 @@ export function createClientModuleProxy<T>(
357
moduleId,
358
false,
359
);
360
+ // $FlowFixMe[incompatible-variance]
361
+ // $FlowFixMe[incompatible-type]
362
+ // $FlowFixMe[incompatible-exact]
363
return new Proxy(clientReference, proxyHandlers);
364
}
packages/react-server-dom-webpack/src/client/ReactFlightClientConfigBundlerWebpackBrowser.js
+3
-3
@@ -51,7 +51,7 @@ export function addChunkDebugInfo(
51
const scriptFilename = __webpack_get_script_filename__(chunkId);
52
let href;
53
try {
54
- // $FlowFixMe
54
+ // $FlowFixMe[incompatible-type]
55
href = new URL(scriptFilename, document.baseURI).href;
56
} catch (_) {
57
href = scriptFilename;
@@ -74,9 +74,9 @@ export function addChunkDebugInfo(
74
}
75
}
76
const value = Promise.resolve(href);
77
- // $FlowFixMe
77
+ // $FlowFixMe[prop-missing]
78
value.status = 'fulfilled';
79
- // $FlowFixMe
79
+ // $FlowFixMe[prop-missing]
80
value.value = {
81
chunkId: chunkId,
82
href: href,
packages/react-server-dom-webpack/src/server/ReactFlightDOMServerBrowser.js
+3
@@ -153,6 +153,7 @@ function renderToReadableStream(
153
},
154
},
155
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
156
+ // $FlowFixMe[incompatible-type]
157
{highWaterMark: 0},
158
);
159
debugStream.pipeTo(debugChannelWritable);
@@ -175,6 +176,7 @@ function renderToReadableStream(
176
},
177
},
178
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
179
+ // $FlowFixMe[incompatible-type]
180
{highWaterMark: 0},
181
);
182
return stream;
@@ -204,6 +206,7 @@ function prerender(
206
},
207
},
208
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
209
+ // $FlowFixMe[incompatible-type]
210
{highWaterMark: 0},
211
);
212
resolve({prelude: stream});
packages/react-server-dom-webpack/src/server/ReactFlightDOMServerEdge.js
+4
-1
@@ -158,6 +158,7 @@ function renderToReadableStream(
158
},
159
},
160
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
161
+ // $FlowFixMe[incompatible-type]
162
{highWaterMark: 0},
163
);
164
debugStream.pipeTo(debugChannelWritable);
@@ -180,6 +181,7 @@ function renderToReadableStream(
181
},
182
},
183
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
184
+ // $FlowFixMe[incompatible-type]
185
{highWaterMark: 0},
186
);
187
return stream;
@@ -209,6 +211,7 @@ function prerender(
211
},
212
},
213
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
214
+ // $FlowFixMe[incompatible-type]
215
{highWaterMark: 0},
216
);
217
resolve({prelude: stream});
@@ -309,7 +312,7 @@ function decodeReplyFromAsyncIterable<T>(
312
reportGlobalError(response, reason);
313
if (typeof (iterator: any).throw === 'function') {
314
// The iterator protocol doesn't necessarily include this but a generator do.
312
- // $FlowFixMe should be able to pass mixed
315
+ // $FlowFixMe[prop-missing] should be able to pass mixed
316
iterator.throw(reason).then(error, error);
317
}
318
}
packages/react-server-dom-webpack/src/server/ReactFlightDOMServerNode.js
+7
-3
@@ -130,11 +130,11 @@ function startReadingFromDebugChannelReadable(
130
const ws: WebSocket = (stream: any);
131
ws.binaryType = 'arraybuffer';
132
ws.addEventListener('message', event => {
133
- // $FlowFixMe
133
+ // $FlowFixMe[incompatible-type]
134
onData(event.data);
135
});
136
ws.addEventListener('error', event => {
137
- // $FlowFixMe
137
+ // $FlowFixMe[prop-missing]
138
onError(event.error);
139
});
140
ws.addEventListener('close', onClose);
@@ -381,6 +381,7 @@ function renderToReadableStream(
381
},
382
},
383
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
384
+ // $FlowFixMe[incompatible-type]
385
{highWaterMark: 0},
386
);
387
debugStream.pipeTo(debugChannelWritable);
@@ -405,6 +406,7 @@ function renderToReadableStream(
406
},
407
},
408
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
409
+ // $FlowFixMe[incompatible-type]
410
{highWaterMark: 0},
411
);
412
return stream;
@@ -517,6 +519,7 @@ function prerender(
519
},
520
},
521
// $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
522
+ // $FlowFixMe[incompatible-type]
523
{highWaterMark: 0},
524
);
525
resolve({prelude: stream});
@@ -691,6 +694,7 @@ function decodeReplyFromBusboy<T>(
694
reportGlobalError(
695
response,
696
// $FlowFixMe[incompatible-call] types Error and mixed are incompatible
697
+ // $FlowFixMe[incompatible-type]
698
err,
699
);
700
});
@@ -762,7 +766,7 @@ function decodeReplyFromAsyncIterable<T>(
766
reportGlobalError(response, reason);
767
if (typeof (iterator: any).throw === 'function') {
768
// The iterator protocol doesn't necessarily include this but a generator do.
765
- // $FlowFixMe should be able to pass mixed
769
+ // $FlowFixMe[prop-missing] should be able to pass mixed
770
iterator.throw(reason).then(error, error);
771
}
772
}
packages/react-server/src/ReactFizzComponentStack.js
+1
@@ -65,6 +65,7 @@ function describeComponentStackByType(
65
return describeFunctionComponentFrame(type);
66
}
67
}
68
+ // $FlowFixMe[invalid-compare]
69
if (typeof type === 'object' && type !== null) {
70
switch (type.$$typeof) {
71
case REACT_FORWARD_REF_TYPE: {
packages/react-server/src/ReactFizzHooks.js
+9
-4
@@ -360,6 +360,7 @@ export function useReducer<S, I, A>(
360
init?: I => S,
361
): [S, Dispatch<A>] {
362
if (__DEV__) {
363
+ // $FlowFixMe[invalid-compare]
364
if (reducer !== basicStateReducer) {
365
currentHookNameInDev = 'useReducer';
366
}
@@ -409,6 +410,7 @@ export function useReducer<S, I, A>(
410
isInHookUserCodeInDev = true;
411
}
412
let initialState;
413
+ // $FlowFixMe[invalid-compare]
414
if (reducer === basicStateReducer) {
415
// Special case for `useState`.
416
initialState =
@@ -445,6 +447,7 @@ function useMemo<T>(nextCreate: () => T, deps: Array<mixed> | void | null): T {
447
448
const nextDeps = deps === undefined ? null : deps;
449
450
+ // $FlowFixMe[invalid-compare]
451
if (workInProgressHook !== null) {
452
const prevState = workInProgressHook.memoizedState;
453
if (prevState !== null) {
@@ -545,7 +548,7 @@ function throwOnUseEffectEventCall() {
548
export function useEffectEvent<Args, Return, F: (...Array<Args>) => Return>(
549
callback: F,
550
): F {
548
- // $FlowIgnore[incompatible-return]
551
+ // $FlowFixMe[incompatible-type]
552
return throwOnUseEffectEventCall;
553
}
554
@@ -629,7 +632,7 @@ function useActionState<S, P>(
632
const actionStateHookIndex = actionStateCounter++;
633
const request: Request = (currentlyRenderingRequest: any);
634
632
- // $FlowIgnore[prop-missing]
635
+ // $FlowFixMe[prop-missing]
636
const formAction = action.$$FORM_ACTION;
637
if (typeof formAction === 'function') {
638
// This is a server action. These have additional features to enable
@@ -651,7 +654,7 @@ function useActionState<S, P>(
654
let state = initialState;
655
const componentKeyPath = (currentlyRenderingKeyPath: any);
656
const postbackActionState = getFormState(request);
654
- // $FlowIgnore[prop-missing]
657
+ // $FlowFixMe[prop-missing]
658
const isSignatureEqual = action.$$IS_SIGNATURE_EQUAL;
659
if (
660
postbackActionState !== null &&
@@ -687,7 +690,7 @@ function useActionState<S, P>(
690
691
// $FlowIgnore[prop-missing]
692
if (typeof boundAction.$$FORM_ACTION === 'function') {
690
- // $FlowIgnore[prop-missing]
693
+ // $FlowFixMe[prop-missing]
694
dispatch.$$FORM_ACTION = (prefix: string) => {
695
const metadata: ReactCustomFormAction =
696
boundAction.$$FORM_ACTION(prefix);
@@ -746,6 +749,7 @@ function useId(): string {
749
}
750
751
function use<T>(usable: Usable<T>): T {
752
+ // $FlowFixMe[invalid-compare]
753
if (usable !== null && typeof usable === 'object') {
754
// $FlowFixMe[method-unbinding]
755
if (typeof usable.then === 'function') {
@@ -803,6 +807,7 @@ function clientHookNotSupported() {
807
);
808
}
809
810
+// $FlowFixMe[constant-condition]
811
export const HooksDispatcher: Dispatcher = supportsClientAPIs
812
? {
813
readContext,
packages/react-server/src/ReactFizzNewContext.js
+6
-1
@@ -39,6 +39,7 @@ export const rootContextSnapshot: ContextSnapshot = null;
39
let currentActiveSnapshot: ContextSnapshot = null;
40
41
function popNode(prev: ContextNode<any>): void {
42
+ // $FlowFixMe[constant-condition]
43
if (isPrimaryRenderer) {
44
prev.context._currentValue = prev.parentValue;
45
} else {
@@ -47,6 +48,7 @@ function popNode(prev: ContextNode<any>): void {
48
}
49
50
function pushNode(next: ContextNode<any>): void {
51
+ // $FlowFixMe[constant-condition]
52
if (isPrimaryRenderer) {
53
next.context._currentValue = next.value;
54
} else {
@@ -162,7 +164,7 @@ export function switchContext(newSnapshot: ContextSnapshot): void {
164
const next = newSnapshot;
165
if (prev !== next) {
166
if (prev === null) {
165
- // $FlowFixMe[incompatible-call]: This has to be non-null since it's not equal to prev.
167
+ // $FlowFixMe[incompatible-type]: This has to be non-null since it's not equal to prev.
168
pushAllNext(next);
169
} else if (next === null) {
170
popAllPrevious(prev);
@@ -182,6 +184,7 @@ export function pushProvider<T>(
184
nextValue: T,
185
): ContextSnapshot {
186
let prevValue;
187
+ // $FlowFixMe[constant-condition]
188
if (isPrimaryRenderer) {
189
prevValue = context._currentValue;
190
context._currentValue = nextValue;
@@ -243,6 +246,7 @@ export function popProvider<T>(context: ReactContext<T>): ContextSnapshot {
246
);
247
}
248
}
249
+ // $FlowFixMe[constant-condition]
250
if (isPrimaryRenderer) {
251
const value = prevSnapshot.parentValue;
252
prevSnapshot.context._currentValue = value;
@@ -284,6 +288,7 @@ export function getActiveContext(): ContextSnapshot {
288
}
289
290
export function readContext<T>(context: ReactContext<T>): T {
291
+ // $FlowFixMe[constant-condition]
292
const value = isPrimaryRenderer
293
? context._currentValue
294
: context._currentValue2;
packages/react-server/src/ReactFizzServer.js
+43
-11
@@ -536,6 +536,7 @@ function RequestInstance(
536
progressiveChunkSize === undefined
537
? DEFAULT_PROGRESSIVE_CHUNK_SIZE
538
: progressiveChunkSize;
539
+ // $FlowFixMe[constant-condition]
540
this.status = isWorkLoopExternallyDriven ? OPEN : OPENING;
541
this.fatalError = null;
542
this.aborted = false;
@@ -791,6 +792,7 @@ let currentRequest: null | Request = null;
792
793
export function resolveRequest(): null | Request {
794
if (currentRequest) return currentRequest;
795
+ // $FlowFixMe[constant-condition]
796
if (supportsRequestStorage) {
797
const store = requestStorage.getStore();
798
if (store) return store;
@@ -801,6 +803,7 @@ export function resolveRequest(): null | Request {
803
function pingTask(request: Request, task: Task): void {
804
const pingedTasks = request.pingedTasks;
805
pingedTasks.push(task);
806
+ // $FlowFixMe[constant-condition]
807
if (isWorkLoopExternallyDriven) {
808
return;
809
} else {
@@ -1410,7 +1413,7 @@ function renderSuspenseBoundary(
1413
}
1414
return;
1415
}
1413
- // $FlowFixMe: Refined.
1416
+ // $FlowFixMe[incompatible-type]: Refined.
1417
const task: RenderTask = someTask;
1418
1419
const prevKeyPath = task.keyPath;
@@ -2220,11 +2223,12 @@ function renderSuspenseList(
2223
2224
let done = false;
2225
2226
+ // $FlowFixMe[invalid-compare]
2227
if (iterator === children) {
2228
// If it's an iterator we need to continue reading where we left
2229
// off. We can do that by reading the first few rows from the previous
2230
// thenable state.
2227
- // $FlowFixMe
2231
+ // $FlowFixMe[underconstrained-implicit-instantiation]
2232
let step = readPreviousThenableFromState();
2233
while (step !== undefined) {
2234
if (step.done) {
@@ -2360,7 +2364,7 @@ function renderHostElement(
2364
props,
2365
));
2366
if (isPreambleContext(newContext)) {
2363
- // $FlowFixMe: Refined
2367
+ // $FlowFixMe[incompatible-type]: Refined
2368
renderPreamble(request, (task: RenderTask), segment, children);
2369
} else {
2370
// We use the non-destructive form because if something suspends, we still
@@ -2985,9 +2989,13 @@ function renderElement(
2989
// TODO: Delete in LegacyHidden. It's an unstable API only used in the
2990
// www build. As a migration step, we could add a special prop to Offscreen
2991
// that simulates the old behavior (no hiding, no change to effects).
2992
+ // $FlowFixMe[invalid-compare]
2993
case REACT_LEGACY_HIDDEN_TYPE:
2994
+ // $FlowFixMe[invalid-compare] -- falls through
2995
case REACT_STRICT_MODE_TYPE:
2996
+ // $FlowFixMe[invalid-compare] -- falls through
2997
case REACT_PROFILER_TYPE:
2998
+ // $FlowFixMe[invalid-compare] -- falls through
2999
case REACT_FRAGMENT_TYPE: {
3000
const prevKeyPath = task.keyPath;
3001
task.keyPath = keyPath;
@@ -2995,14 +3003,17 @@ function renderElement(
3003
task.keyPath = prevKeyPath;
3004
return;
3005
}
3006
+ // $FlowFixMe[invalid-compare]
3007
case REACT_ACTIVITY_TYPE: {
3008
renderActivity(request, task, keyPath, props);
3009
return;
3010
}
3011
+ // $FlowFixMe[invalid-compare]
3012
case REACT_SUSPENSE_LIST_TYPE: {
3013
renderSuspenseList(request, task, keyPath, props);
3014
return;
3015
}
3016
+ // $FlowFixMe[invalid-compare]
3017
case REACT_VIEW_TRANSITION_TYPE: {
3018
if (enableViewTransition) {
3019
renderViewTransition(request, task, keyPath, props);
@@ -3010,6 +3021,7 @@ function renderElement(
3021
}
3022
// Fallthrough
3023
}
3024
+ // $FlowFixMe[invalid-compare]
3025
case REACT_SCOPE_TYPE: {
3026
if (enableScopeAPI) {
3027
const prevKeyPath = task.keyPath;
@@ -3020,33 +3032,40 @@ function renderElement(
3032
}
3033
throw new Error('ReactDOMServer does not yet support scope components.');
3034
}
3035
+ // $FlowFixMe[invalid-compare]
3036
case REACT_SUSPENSE_TYPE: {
3037
renderSuspenseBoundary(request, task, keyPath, props);
3038
return;
3039
}
3040
}
3041
3042
+ // $FlowFixMe[invalid-compare]
3043
if (typeof type === 'object' && type !== null) {
3044
switch (type.$$typeof) {
3045
+ // $FlowFixMe[invalid-compare]
3046
case REACT_FORWARD_REF_TYPE: {
3047
renderForwardRef(request, task, keyPath, type, props, ref);
3048
return;
3049
}
3050
+ // $FlowFixMe[invalid-compare]
3051
case REACT_MEMO_TYPE: {
3052
renderMemo(request, task, keyPath, type, props, ref);
3053
return;
3054
}
3055
+ // $FlowFixMe[invalid-compare]
3056
case REACT_CONTEXT_TYPE: {
3057
const context = type;
3058
renderContextProvider(request, task, keyPath, context, props);
3059
return;
3060
}
3061
+ // $FlowFixMe[invalid-compare]
3062
case REACT_CONSUMER_TYPE: {
3063
const context: ReactContext<any> = (type: ReactConsumerType<any>)
3064
._context;
3065
renderContextConsumer(request, task, keyPath, context, props);
3066
return;
3067
}
3068
+ // $FlowFixMe[invalid-compare]
3069
case REACT_LAZY_TYPE: {
3070
renderLazyComponent(request, task, keyPath, type, props, ref);
3071
return;
@@ -3059,6 +3078,7 @@ function renderElement(
3078
if (
3079
type === undefined ||
3080
(typeof type === 'object' &&
3081
+ // $FlowFixMe[invalid-compare]
3082
type !== null &&
3083
Object.keys(type).length === 0)
3084
) {
@@ -3544,11 +3564,12 @@ function retryNode(request: Request, task: Task): void {
3564
3565
let done = false;
3566
3567
+ // $FlowFixMe[invalid-compare]
3568
if (iterator === node) {
3569
// If it's an iterator we need to continue reading where we left
3570
// off. We can do that by reading the first few rows from the previous
3571
// thenable state.
3551
- // $FlowFixMe
3572
+ // $FlowFixMe[underconstrained-implicit-instantiation]
3573
let step = readPreviousThenableFromState();
3574
while (step !== undefined) {
3575
if (step.done) {
@@ -3838,7 +3859,7 @@ function renderChildrenArray(
3859
if (task.replay !== null) {
3860
replayFragment(
3861
request,
3841
- // $FlowFixMe: Refined.
3862
+ // $FlowFixMe[incompatible-type]: Refined.
3863
task,
3864
children,
3865
childIndex,
@@ -3978,6 +3999,7 @@ function trackPostpone(
3999
return;
4000
}
4001
4002
+ // $FlowFixMe[invalid-compare]
4003
if (boundary !== null && boundary.status === PENDING) {
4004
const boundaryNode = trackPostponedBoundary(
4005
request,
@@ -4009,6 +4031,7 @@ function trackPostpone(
4031
// We know that this will leave a hole so we might as well assign an ID now.
4032
// We might have one already if we had a parent that gave us its ID.
4033
if (segment.id === -1) {
4034
+ // $FlowFixMe[invalid-compare]
4035
if (segment.parentFlushed && boundary !== null) {
4036
// If this segment's parent was already flushed, it means we really just
4037
// skipped the parent and this segment is now the root.
@@ -4221,6 +4244,7 @@ function renderNode(
4244
4245
if (request.aborted) {
4246
// We are aborting so we can just bubble up to the task by falling through
4247
+ // $FlowFixMe[invalid-compare]
4248
} else if (typeof x === 'object' && x !== null) {
4249
// $FlowFixMe[method-unbinding]
4250
if (typeof x.then === 'function') {
@@ -4231,7 +4255,7 @@ function renderNode(
4255
: null;
4256
const newTask = spawnNewSuspendedReplayTask(
4257
request,
4234
- // $FlowFixMe: Refined.
4258
+ // $FlowFixMe[incompatible-type]: Refined.
4259
task,
4260
thenableState,
4261
);
@@ -4267,7 +4291,7 @@ function renderNode(
4291
: null;
4292
const newTask = spawnNewSuspendedReplayTask(
4293
request,
4270
- // $FlowFixMe: Refined.
4294
+ // $FlowFixMe[incompatible-type]: Refined.
4295
task,
4296
thenableState,
4297
);
@@ -4322,6 +4346,7 @@ function renderNode(
4346
4347
if (request.aborted) {
4348
// We are aborting so we can just bubble up to the task by falling through
4349
+ // $FlowFixMe[invalid-compare]
4350
} else if (typeof x === 'object' && x !== null) {
4351
// $FlowFixMe[method-unbinding]
4352
if (typeof x.then === 'function') {
@@ -4332,7 +4357,7 @@ function renderNode(
4357
: null;
4358
const newTask = spawnNewSuspendedRenderTask(
4359
request,
4335
- // $FlowFixMe: Refined.
4360
+ // $FlowFixMe[incompatible-type]: Refined.
4361
task,
4362
thenableState,
4363
);
@@ -4367,7 +4392,7 @@ function renderNode(
4392
: null;
4393
const newTask = spawnNewSuspendedRenderTask(
4394
request,
4370
- // $FlowFixMe: Refined.
4395
+ // $FlowFixMe[incompatible-type]: Refined.
4396
task,
4397
thenableState,
4398
);
@@ -4663,7 +4688,9 @@ function abortTask(task: Task, request: Request): void {
4688
node !== null &&
4689
(isArray(node) ||
4690
typeof node[ASYNC_ITERATOR] === 'function' ||
4691
+ // $FlowFixMe[invalid-compare]
4692
node.$$typeof === REACT_ELEMENT_TYPE ||
4693
+ // $FlowFixMe[invalid-compare]
4694
node.$$typeof === REACT_LAZY_TYPE) &&
4695
isArray(node._debugInfo)
4696
) {
@@ -4980,6 +5007,7 @@ function finishedSegment(
5007
boundary: Root | SuspenseBoundary,
5008
segment: Segment,
5009
) {
5010
+ // $FlowFixMe[invalid-compare]
5011
if (byteLengthOfChunk !== null) {
5012
// Count the bytes of all the chunks of this segment.
5013
const chunks = segment.chunks;
@@ -5149,13 +5177,13 @@ function retryTask(request: Request, task: Task): void {
5177
if (segment === null) {
5178
retryReplayTask(
5179
request,
5152
- // $FlowFixMe: Refined.
5180
+ // $FlowFixMe[incompatible-type]: Refined.
5181
task,
5182
);
5183
} else {
5184
retryRenderTask(
5185
request,
5158
- // $FlowFixMe: Refined.
5186
+ // $FlowFixMe[incompatible-type]: Refined.
5187
task,
5188
segment,
5189
);
@@ -5343,6 +5371,7 @@ function retryReplayTask(request: Request, task: ReplayTask): void {
5371
return;
5372
}
5373
5374
+ // $FlowFixMe[invalid-compare]
5375
if (typeof x === 'object' && x !== null) {
5376
// $FlowFixMe[method-unbinding]
5377
if (typeof x.then === 'function') {
@@ -6148,11 +6177,13 @@ function flushCompletedQueues(
6177
}
6178
6179
export function startWork(request: Request): void {
6180
+ // $FlowFixMe[constant-condition]
6181
if (isWorkLoopExternallyDriven) {
6182
return;
6183
} else {
6184
request.flushScheduled = request.destination !== null;
6185
// When prerendering we use microtasks for pinging work
6186
+ // $FlowFixMe[constant-condition]
6187
if (supportsRequestStorage) {
6188
scheduleMicrotask(() =>
6189
requestStorage.run(request, performWork, request),
@@ -6175,6 +6206,7 @@ export function startWork(request: Request): void {
6206
// During a prerender we don't want to be too aggressive in emitting early preloads
6207
// because we aren't responding to a live request and we can wait for the prerender to
6208
// postpone before we emit anything.
6209
+ // $FlowFixMe[constant-condition]
6210
if (supportsRequestStorage) {
6211
requestStorage.run(
6212
request,
packages/react-server/src/ReactFizzThenable.js
+2
-2
@@ -277,7 +277,7 @@ export function ensureSuspendableThenableStateDEV(
277
switch (lastThenable.status) {
278
case 'fulfilled': {
279
const previousThenableValue = lastThenable.value;
280
- // $FlowIgnore[method-unbinding] We rebind .then immediately.
280
+ // $FlowFixMe[method-unbinding] We rebind .then immediately.
281
const previousThenableThen = lastThenable.then.bind(lastThenable);
282
delete lastThenable.value;
283
delete (lastThenable: any).status;
@@ -295,7 +295,7 @@ export function ensureSuspendableThenableStateDEV(
295
}
296
case 'rejected': {
297
const previousThenableReason = lastThenable.reason;
298
- // $FlowIgnore[method-unbinding] We rebind .then immediately.
298
+ // $FlowFixMe[method-unbinding] We rebind .then immediately.
299
const previousThenableThen = lastThenable.then.bind(lastThenable);
300
delete lastThenable.reason;
301
delete (lastThenable: any).status;
packages/react-server/src/ReactFizzViewTransitionComponent.js
+1
@@ -36,6 +36,7 @@ function getClassNameByType(classByType: ?ViewTransitionClass): ?string {
36
for (let i = 0; i < activeTypes.length; i++) {
37
const match = classByType[activeTypes[i]];
38
if (match != null) {
39
+ // $FlowFixMe[invalid-compare]
40
if (match === 'none') {
41
// If anything matches "none" that takes precedence over any other
42
// type that also matches.
packages/react-server/src/ReactFlightActionServer.js
+3
-3
@@ -95,10 +95,10 @@ function decodeBoundActionMetaData(
95
bound: null | Promise<Array<any>>,
96
}>(actionResponse);
97
// Force it to initialize
98
- // $FlowFixMe
98
+ // $FlowFixMe[incompatible-type]
99
refPromise.then(() => {});
100
if (refPromise.status !== 'fulfilled') {
101
- // $FlowFixMe
101
+ // $FlowFixMe[prop-missing]
102
throw refPromise.reason;
103
}
104
return refPromise.value;
@@ -118,7 +118,7 @@ export function decodeAction<T>(
118
// $FlowFixMe[prop-missing]
119
body.forEach((value: string | File, key: string) => {
120
if (!key.startsWith('$ACTION_')) {
121
- // $FlowFixMe[incompatible-call]
121
+ // $FlowFixMe[incompatible-type]
122
formData.append(key, value);
123
return;
124
}
packages/react-server/src/ReactFlightHooks.js
+1
@@ -128,6 +128,7 @@ function useId(): string {
128
129
function use<T>(usable: Usable<T>): T {
130
if (
131
+ // $FlowFixMe[invalid-compare]
132
(usable !== null && typeof usable === 'object') ||
133
typeof usable === 'function'
134
) {
packages/react-server/src/ReactFlightReplyServer.js
+8
-5
@@ -151,6 +151,7 @@ ReactPromise.prototype.then = function <T>(
151
while (inspectedValue instanceof ReactPromise) {
152
cycleProtection++;
153
if (
154
+ // $FlowFixMe[invalid-compare]
155
inspectedValue === chunk ||
156
visited.has(inspectedValue) ||
157
cycleProtection > 1000
@@ -161,6 +162,7 @@ ReactPromise.prototype.then = function <T>(
162
return;
163
}
164
visited.add(inspectedValue);
165
+ // $FlowFixMe[invalid-compare]
166
if (inspectedValue.status === INITIALIZED) {
167
inspectedValue = inspectedValue.value;
168
} else {
@@ -301,7 +303,7 @@ function triggerErrorOnChunk<T>(
303
// a stream chunk since any other row shouldn't have more than one entry.
304
const streamChunk: InitializedStreamChunk<any> = (chunk: any);
305
const controller = streamChunk.reason;
304
- // $FlowFixMe[incompatible-call]: The error method should accept mixed.
306
+ // $FlowFixMe[incompatible-type]: The error method should accept mixed.
307
controller.error(error);
308
return;
309
}
@@ -1041,7 +1043,7 @@ function getOutlinedModel<T>(
1043
switch (chunk.status) {
1044
case RESOLVED_MODEL:
1045
initializeModelChunk(chunk);
1044
- // $FlowFixMe[incompatible-cast] We just initialized this chunk so it can't be a ResolvedModelChunk anymore.
1046
+ // $FlowFixMe[incompatible-type] We just initialized this chunk so it can't be a ResolvedModelChunk anymore.
1047
chunk = (chunk: Exclude<SomeChunk<T>, ResolvedModelChunk<T>>);
1048
break;
1049
}
@@ -1067,6 +1069,7 @@ function getOutlinedModel<T>(
1069
const name = path[i];
1070
if (
1071
typeof value === 'object' &&
1072
+ // $FlowFixMe[invalid-compare] This check is still needed at runtime.
1073
value !== null &&
1074
(getPrototypeOf(value) === ObjectPrototype ||
1075
getPrototypeOf(value) === ArrayPrototype) &&
@@ -1077,7 +1080,7 @@ function getOutlinedModel<T>(
1080
localLength = 0;
1081
arrayRoot =
1082
rootArrayContexts.get(
1080
- // $FlowFixMe[incompatible-cast] Our `isArray` typing can't narrow `mixed`
1083
+ // $FlowFixMe[incompatible-type] Our `isArray` typing can't narrow `mixed`
1084
(value: $ReadOnlyArray<mixed>),
1085
) || arrayRoot;
1086
} else {
@@ -1434,7 +1437,7 @@ function parseReadableStream<T>(
1437
}
1438
closed = true;
1439
if (previousBlockedChunk === null) {
1437
- // $FlowFixMe[incompatible-call]
1440
+ // $FlowFixMe[incompatible-type]
1441
controller.error(error);
1442
} else {
1443
const blockedChunk = previousBlockedChunk;
@@ -1664,7 +1667,7 @@ function parseModelString(
1667
);
1668
const referencedFormDataKey = formDataKey.slice(formPrefix.length);
1669
for (let i = 0; i < referencedFormDataValue.length; i++) {
1667
- // $FlowFixMe[incompatible-call]
1670
+ // $FlowFixMe[incompatible-type]
1671
data.append(referencedFormDataKey, referencedFormDataValue[i]);
1672
}
1673
consumeBackingEntry(backingFormData, formDataKey);
packages/react-server/src/ReactFlightServer.js
+39
-21
@@ -393,7 +393,7 @@ function patchConsole(consoleInst: typeof console, methodName: string) {
393
) {
394
const originalMethod = descriptor.value;
395
const originalName = Object.getOwnPropertyDescriptor(
396
- // $FlowFixMe[incompatible-call]: We should be able to get descriptors from any function.
396
+ // $FlowFixMe[incompatible-type]: We should be able to get descriptors from any function.
397
originalMethod,
398
'name',
399
);
@@ -422,6 +422,7 @@ function patchConsole(consoleInst: typeof console, methodName: string) {
422
emitConsoleChunk(request, methodName, owner, env, stack, args);
423
}
424
// $FlowFixMe[incompatible-call]
425
+ // $FlowFixMe[incompatible-type]
426
return originalMethod.apply(this, arguments);
427
};
428
if (originalName) {
@@ -438,6 +439,7 @@ function patchConsole(consoleInst: typeof console, methodName: string) {
439
}
440
}
441
442
+// $FlowFixMe[invalid-compare]
443
if (__DEV__ && typeof console === 'object' && console !== null) {
444
// Instrument console to capture logs for replaying on the client.
445
patchConsole(console, 'assert');
@@ -870,6 +872,7 @@ let currentRequest: null | Request = null;
872
873
export function resolveRequest(): null | Request {
874
if (currentRequest) return currentRequest;
875
+ // $FlowFixMe[constant-condition]
876
if (supportsRequestStorage) {
877
const store = requestStorage.getStore();
878
if (store) return store;
@@ -1170,7 +1173,7 @@ function serializeReadableStream(
1173
// receiving side. It also implies that different chunks can be split up or merged as opposed
1174
// to a readable stream that happens to have Uint8Array as the type which might expect it to be
1175
// received in the same slices.
1173
- // $FlowFixMe: This is a Node.js extension.
1176
+ // $FlowFixMe[prop-missing]: This is a Node.js extension.
1177
let supportsBYOB: void | boolean = stream.supportsBYOB;
1178
if (supportsBYOB === undefined) {
1179
try {
@@ -1248,7 +1251,8 @@ function serializeReadableStream(
1251
erroredTask(request, streamTask, reason);
1252
enqueueFlush(request);
1253
1251
- // $FlowFixMe should be able to pass mixed
1254
+ // $FlowFixMe[incompatible-type] should be able to pass mixed
1255
+ // $FlowFixMe[incompatible-use]
1256
reader.cancel(reason).then(error, error);
1257
}
1258
function abortStream() {
@@ -1267,7 +1271,7 @@ function serializeReadableStream(
1271
erroredTask(request, streamTask, reason);
1272
enqueueFlush(request);
1273
}
1270
- // $FlowFixMe should be able to pass mixed
1274
+ // $FlowFixMe[incompatible-use] should be able to pass mixed
1275
reader.cancel(reason).then(error, error);
1276
}
1277
@@ -1381,7 +1385,7 @@ function serializeAsyncIterable(
1385
enqueueFlush(request);
1386
if (typeof (iterator: any).throw === 'function') {
1387
// The iterator protocol doesn't necessarily include this but a generator do.
1384
- // $FlowFixMe should be able to pass mixed
1388
+ // $FlowFixMe[prop-missing] should be able to pass mixed
1389
iterator.throw(reason).then(error, error);
1390
}
1391
}
@@ -1403,7 +1407,7 @@ function serializeAsyncIterable(
1407
}
1408
if (typeof (iterator: any).throw === 'function') {
1409
// The iterator protocol doesn't necessarily include this but a generator do.
1406
- // $FlowFixMe should be able to pass mixed
1410
+ // $FlowFixMe[prop-missing] should be able to pass mixed
1411
iterator.throw(reason).then(error, error);
1412
}
1413
}
@@ -1603,10 +1607,10 @@ function processServerComponentReturnValue(
1607
// tempting to try to return the value from a generator.
1608
if (iterator === iterableChild) {
1609
const isGeneratorComponent =
1606
- // $FlowIgnore[method-unbinding]
1610
+ // $FlowFixMe[method-unbinding]
1611
Object.prototype.toString.call(Component) ===
1612
'[object GeneratorFunction]' &&
1609
- // $FlowIgnore[method-unbinding]
1613
+ // $FlowFixMe[method-unbinding]
1614
Object.prototype.toString.call(iterableChild) ===
1615
'[object Generator]';
1616
if (!isGeneratorComponent) {
@@ -1643,10 +1647,10 @@ function processServerComponentReturnValue(
1647
// tempting to try to return the value from a generator.
1648
if (iterator === iterableChild) {
1649
const isGeneratorComponent =
1646
- // $FlowIgnore[method-unbinding]
1650
+ // $FlowFixMe[method-unbinding]
1651
Object.prototype.toString.call(Component) ===
1652
'[object AsyncGeneratorFunction]' &&
1649
- // $FlowIgnore[method-unbinding]
1653
+ // $FlowFixMe[method-unbinding]
1654
Object.prototype.toString.call(iterableChild) ===
1655
'[object AsyncGenerator]';
1656
if (!isGeneratorComponent) {
@@ -1746,6 +1750,7 @@ function renderFunctionComponent<Props>(
1750
}
1751
}
1752
prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
1753
+ // $FlowFixMe[constant-condition]
1754
if (supportsComponentStorage) {
1755
// Run the component in an Async Context that tracks the current owner.
1756
if (task.debugTask) {
@@ -1789,6 +1794,7 @@ function renderFunctionComponent<Props>(
1794
if (request.status === ABORTING) {
1795
if (
1796
typeof result === 'object' &&
1797
+ // $FlowFixMe[invalid-compare]
1798
result !== null &&
1799
typeof result.then === 'function' &&
1800
!isClientReference(result)
@@ -1894,6 +1900,7 @@ function warnForMissingKey(
1900
);
1901
};
1902
1903
+ // $FlowFixMe[constant-condition]
1904
if (supportsComponentStorage) {
1905
// Run the component in an Async Context that tracks the current owner.
1906
if (debugTask) {
@@ -3074,6 +3081,7 @@ function serializeServerReference(
3081
request.bundlerConfig,
3082
serverReference,
3083
);
3084
+ // $FlowFixMe[constant-condition]
3085
if (error) {
3086
const frames = parseStackTrace(error, 1);
3087
if (frames.length > 0) {
@@ -3267,17 +3275,17 @@ function serializeDebugBlob(request: Request, blob: Blob): string {
3275
}
3276
// TODO: Emit the chunk early and refer to it later by dedupe.
3277
model.push(entry.value);
3270
- // $FlowFixMe[incompatible-call]
3278
+ // $FlowFixMe[incompatible-type]
3279
return reader.read().then(progress).catch(error);
3280
}
3281
function error(reason: mixed) {
3282
const digest = '';
3283
emitErrorChunk(request, id, digest, reason, true, null);
3284
enqueueFlush(request);
3277
- // $FlowFixMe should be able to pass mixed
3285
+ // $FlowFixMe[incompatible-type] should be able to pass mixed
3286
reader.cancel(reason).then(noop, noop);
3287
}
3280
- // $FlowFixMe[incompatible-call]
3288
+ // $FlowFixMe[incompatible-type]
3289
reader.read().then(progress).catch(error);
3290
return '$B' + id.toString(16);
3291
}
@@ -3315,7 +3323,7 @@ function serializeBlob(request: Request, blob: Blob): string {
3323
}
3324
// TODO: Emit the chunk early and refer to it later by dedupe.
3325
model.push(entry.value);
3318
- // $FlowFixMe[incompatible-call]
3326
+ // $FlowFixMe[incompatible-type]
3327
return reader.read().then(progress).catch(error);
3328
}
3329
function error(reason: mixed) {
@@ -3325,7 +3333,8 @@ function serializeBlob(request: Request, blob: Blob): string {
3333
request.cacheController.signal.removeEventListener('abort', abortBlob);
3334
erroredTask(request, newTask, reason);
3335
enqueueFlush(request);
3328
- // $FlowFixMe should be able to pass mixed
3336
+ // $FlowFixMe[incompatible-type] should be able to pass mixed
3337
+ // $FlowFixMe[incompatible-use]
3338
reader.cancel(reason).then(error, error);
3339
}
3340
function abortBlob() {
@@ -3344,13 +3353,13 @@ function serializeBlob(request: Request, blob: Blob): string {
3353
erroredTask(request, newTask, reason);
3354
enqueueFlush(request);
3355
}
3347
- // $FlowFixMe should be able to pass mixed
3356
+ // $FlowFixMe[incompatible-use] should be able to pass mixed
3357
reader.cancel(reason).then(error, error);
3358
}
3359
3360
request.cacheController.signal.addEventListener('abort', abortBlob);
3361
3353
- // $FlowFixMe[incompatible-call]
3362
+ // $FlowFixMe[incompatible-type]
3363
reader.read().then(progress).catch(error);
3364
3365
return '$B' + newTask.id.toString(16);
@@ -3418,6 +3427,7 @@ function renderModel(
3427
getSuspendedThenable()
3428
: thrownValue;
3429
3430
+ // $FlowFixMe[invalid-compare]
3431
if (typeof x === 'object' && x !== null) {
3432
// $FlowFixMe[method-unbinding]
3433
if (typeof x.then === 'function') {
@@ -3945,7 +3955,7 @@ function renderModelDestructive(
3955
}
3956
}
3957
3948
- // $FlowFixMe[incompatible-return]
3958
+ // $FlowFixMe[incompatible-type]
3959
return value;
3960
}
3961
@@ -3966,6 +3976,7 @@ function renderModelDestructive(
3976
return serializeDateFromDateJSON(value);
3977
}
3978
}
3979
+ // $FlowFixMe[invalid-compare]
3980
if (value.length >= 1024 && byteLengthOfChunk !== null) {
3981
// For large strings, we encode them outside the JSON payload so that we
3982
// don't have to double encode and double parse the strings. This can also
@@ -4110,6 +4121,7 @@ function logRecoverableError(
4121
try {
4122
const onError = request.onError;
4123
if (__DEV__ && task !== null) {
4124
+ // $FlowFixMe[constant-condition]
4125
if (supportsRequestStorage) {
4126
errorDigest = requestStorage.run(
4127
undefined,
@@ -4122,6 +4134,7 @@ function logRecoverableError(
4134
} else {
4135
errorDigest = callWithDebugContextInDEV(request, task, onError, error);
4136
}
4137
+ // $FlowFixMe[constant-condition]
4138
} else if (supportsRequestStorage) {
4139
// Exit the request context while running callbacks.
4140
errorDigest = requestStorage.run(undefined, onError, error);
@@ -4740,6 +4753,7 @@ function emitTextChunk(
4753
text: string,
4754
debug: boolean,
4755
): void {
4756
+ // $FlowFixMe[invalid-compare]
4757
if (byteLengthOfChunk === null) {
4758
// eslint-disable-next-line react-internal/prod-error-codes
4759
throw new Error(
@@ -5155,7 +5169,7 @@ function renderDebugModel(
5169
return instanceDescription;
5170
}
5171
5158
- // $FlowFixMe[incompatible-return]
5172
+ // $FlowFixMe[incompatible-type]
5173
return value;
5174
}
5175
@@ -5307,6 +5321,7 @@ function serializeDebugModel(
5321
debugNoOutline = model;
5322
try {
5323
// $FlowFixMe[incompatible-cast] stringify can return null
5324
+ // $FlowFixMe[incompatible-type]
5325
return (stringify(model, replacer): string);
5326
} catch (x) {
5327
// $FlowFixMe[incompatible-cast] stringify can return null
@@ -5370,10 +5385,10 @@ function emitOutlinedDebugModelChunk(
5385
}
5386
let json: string;
5387
try {
5373
- // $FlowFixMe[incompatible-cast] stringify can return null
5388
+ // $FlowFixMe[incompatible-type] stringify can return null
5389
json = (stringify(model, replacer): string);
5390
} catch (x) {
5376
- // $FlowFixMe[incompatible-cast] stringify can return null
5391
+ // $FlowFixMe[incompatible-type] stringify can return null
5392
json = (stringify(
5393
'Unknown Value: React could not send it from the server.\n' + x.message,
5394
): string);
@@ -5724,6 +5739,7 @@ function emitChunk(
5739
const id = task.id;
5740
// For certain types we have special types, we typically outlined them but
5741
// we can emit them directly for this row instead of through an indirection.
5742
+ // $FlowFixMe[invalid-compare]
5743
if (typeof value === 'string' && byteLengthOfChunk !== null) {
5744
if (enableTaint) {
5745
const tainted = TaintRegistryValues.get(value);
@@ -5942,6 +5958,7 @@ function retryTask(request: Request, task: Task): void {
5958
// later, once we deprecate the old API in favor of `use`.
5959
getSuspendedThenable()
5960
: thrownValue;
5961
+ // $FlowFixMe[invalid-compare]
5962
if (typeof x === 'object' && x !== null) {
5963
// $FlowFixMe[method-unbinding]
5964
if (typeof x.then === 'function') {
@@ -6282,6 +6299,7 @@ function flushCompletedChunks(request: Request): void {
6299
6300
export function startWork(request: Request): void {
6301
request.flushScheduled = request.destination !== null;
6302
+ // $FlowFixMe[constant-condition]
6303
if (supportsRequestStorage) {
6304
scheduleMicrotask(() => {
6305
requestStorage.run(request, performWork, request);
packages/react-server/src/ReactFlightServerConfigDebugNode.js
+1
-1
@@ -237,7 +237,7 @@ export function initAsyncDebugInfo(): void {
237
// If we begin before we resolve, that means that this is actually already resolved but
238
// the promiseResolve hook is called at the end of the execution. So we track the time
239
// in the before call instead.
240
- // $FlowFixMe
240
+ // $FlowFixMe[incompatible-type]
241
lastRanAwait = resolvePromiseOrAwaitNode(node, performance.now());
242
break;
243
}
packages/react-server/src/ReactServerConsoleConfigBrowser.js
+1
-1
@@ -36,7 +36,7 @@ export function unbadgeConsole(
36
case 'table': {
37
// These methods cannot be colorized because they don't take a formatting string.
38
// So we wouldn't have added any badge in the first place.
39
- // $FlowFixMe
39
+ // $FlowFixMe[incompatible-type]
40
return null;
41
}
42
case 'assert': {
packages/react-server/src/ReactServerConsoleConfigPlain.js
+1
-1
@@ -27,7 +27,7 @@ export function unbadgeConsole(
27
case 'table': {
28
// These methods cannot be colorized because they don't take a formatting string.
29
// So we wouldn't have added any badge in the first place.
30
- // $FlowFixMe
30
+ // $FlowFixMe[incompatible-type]
31
return null;
32
}
33
case 'assert': {
packages/react-server/src/ReactServerConsoleConfigServer.js
+1
-1
@@ -35,7 +35,7 @@ export function unbadgeConsole(
35
case 'table': {
36
// These methods cannot be colorized because they don't take a formatting string.
37
// So we wouldn't have added any badge in the first place.
38
- // $FlowFixMe
38
+ // $FlowFixMe[incompatible-type]
39
return null;
40
}
41
case 'assert': {
packages/react-server/src/ReactServerStreamConfigBrowser.js
+2
-2
@@ -178,7 +178,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number {
178
export function closeWithError(destination: Destination, error: mixed): void {
179
// $FlowFixMe[method-unbinding]
180
if (typeof destination.error === 'function') {
181
- // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
181
+ // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.
182
destination.error(error);
183
} else {
184
// Earlier implementations doesn't support this method. In that environment you're
@@ -196,7 +196,7 @@ export {createFastHashJS as createFastHash} from 'react-server/src/createFastHas
196
export function readAsDataURL(blob: Blob): Promise<string> {
197
return new Promise((resolve, reject) => {
198
const reader = new FileReader();
199
- // $FlowFixMe[incompatible-call]: We always expect a string result with readAsDataURL.
199
+ // $FlowFixMe[incompatible-type]: We always expect a string result with readAsDataURL.
200
reader.onloadend = () => resolve(reader.result);
201
reader.onerror = reject;
202
reader.readAsDataURL(blob);
packages/react-server/src/ReactServerStreamConfigBun.js
+4
-4
@@ -55,7 +55,7 @@ export function writeChunk(
55
return;
56
}
57
58
- // $FlowFixMe[incompatible-call]: write() is compatible with both types in Bun
58
+ // $FlowFixMe[incompatible-type]: write() is compatible with both types in Bun
59
destination.write(chunk);
60
}
61
@@ -63,7 +63,7 @@ export function writeChunkAndReturn(
63
destination: Destination,
64
chunk: PrecomputedChunk | Chunk | BinaryChunk,
65
): boolean {
66
- // $FlowFixMe[incompatible-call]: write() is compatible with both types in Bun
66
+ // $FlowFixMe[incompatible-type]: write() is compatible with both types in Bun
67
return !!destination.write(chunk);
68
}
69
@@ -100,13 +100,13 @@ export function closeWithError(destination: Destination, error: mixed): void {
100
// $FlowFixMe[incompatible-use]
101
// $FlowFixMe[method-unbinding]
102
if (typeof destination.error === 'function') {
103
- // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
103
+ // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.
104
destination.error(error);
105
106
// $FlowFixMe[incompatible-use]
107
// $FlowFixMe[method-unbinding]
108
} else if (typeof destination.destroy === 'function') {
109
- // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
109
+ // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.
110
destination.destroy(error);
111
112
// $FlowFixMe[incompatible-use]
packages/react-server/src/ReactServerStreamConfigEdge.js
+1
-1
@@ -165,7 +165,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number {
165
export function closeWithError(destination: Destination, error: mixed): void {
166
// $FlowFixMe[method-unbinding]
167
if (typeof destination.error === 'function') {
168
- // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
168
+ // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.
169
destination.error(error);
170
} else {
171
// Earlier implementations doesn't support this method. In that environment you're
packages/react-server/src/ReactServerStreamConfigNode.js
+1
-1
@@ -231,7 +231,7 @@ export function byteLengthOfBinaryChunk(chunk: BinaryChunk): number {
231
}
232
233
export function closeWithError(destination: Destination, error: mixed): void {
234
- // $FlowFixMe[incompatible-call]: This is an Error object or the destination accepts other types.
234
+ // $FlowFixMe[incompatible-type]: This is an Error object or the destination accepts other types.
235
destination.destroy(error);
236
}
237
packages/react-server/src/ReactSharedInternalsServer.js
+2
-1
@@ -12,7 +12,8 @@ import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer';
12
import * as React from 'react';
13
14
const ReactSharedInternalsServer: SharedStateServer =
15
- // $FlowFixMe: It's defined in the one we resolve to.
15
+ // $FlowFixMe[incompatible-type]: It's defined in the one we resolve to.
16
+ // $FlowFixMe[missing-export]
17
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
18
19
if (!ReactSharedInternalsServer) {
packages/react-server/src/flight/ReactFlightCurrentOwner.js
+1
@@ -22,6 +22,7 @@ export function setCurrentOwner(componentInfo: null | ReactComponentInfo) {
22
23
export function resolveOwner(): null | ReactComponentInfo {
24
if (currentOwner) return currentOwner;
25
+ // $FlowFixMe[constant-condition]
26
if (supportsComponentStorage) {
27
const owner = componentStorage.getStore();
28
if (owner) return owner;
packages/react-test-renderer/src/ReactTestRenderer.js
+5
-1
@@ -67,6 +67,7 @@ import type {WorkTag} from 'react-reconciler/src/ReactWorkTags';
67
const defaultOnDefaultTransitionIndicator: () => void | (() => void) = noop;
68
69
// $FlowFixMe[prop-missing]: This is only in the development export.
70
+// $FlowFixMe[missing-export]
71
const act = React.act;
72
73
// TODO: Remove from public bundle
@@ -179,7 +180,7 @@ function flatten(arr) {
180
// $FlowFixMe[incompatible-use]
181
n.i += 1;
182
if (isArray(el)) {
182
- // $FlowFixMe[incompatible-call]
183
+ // $FlowFixMe[incompatible-type]
184
stack.push(n);
185
stack.push({i: 0, array: el});
186
break;
@@ -494,6 +495,7 @@ function create(
495
global.IS_REACT_NATIVE_TEST_ENVIRONMENT !== true;
496
let isConcurrent = isConcurrentOnly;
497
let isStrictMode = false;
498
+ // $FlowFixMe[invalid-compare]
499
if (typeof options === 'object' && options !== null) {
500
if (typeof options.createNodeMock === 'function') {
501
// $FlowFixMe[incompatible-type] found when upgrading Flow
@@ -529,6 +531,7 @@ function create(
531
throw new Error('something went wrong');
532
}
533
534
+ // $FlowFixMe[incompatible-type]
535
updateContainer(element, root, null, null);
536
537
const entry = {
@@ -580,6 +583,7 @@ function create(
583
if (root == null || root.current == null) {
584
return;
585
}
586
+ // $FlowFixMe[incompatible-type]
587
updateContainer(newElement, root, null, null);
588
},
589
unmount() {
packages/react/index.development.js
+5
-3
@@ -12,11 +12,13 @@ export type ElementType = React$ElementType;
12
export type Element<+C> = React$Element<C>;
13
export type Key = React$Key;
14
export type Node = React$Node;
15
-export type Context<T> = React$Context<T>;
15
+// eslint-disable-next-line no-undef
16
+export type Context<T> = React.Context<T>;
17
export type Portal = React$Portal;
17
-export type ElementProps<C> = React$ElementProps<C>;
18
+export type ElementProps<C> = React$ElementConfig<C>;
19
export type ElementConfig<C> = React$ElementConfig<C>;
19
-export type ElementRef<C> = React$ElementRef<C>;
20
+// eslint-disable-next-line no-undef
21
+export type ElementRef<C> = React.ElementRef<C>;
22
export type ChildrenArray<+T> = $ReadOnlyArray<ChildrenArray<T>> | T;
23
24
// Export all exports so that they're available in tests.
packages/react/index.js
+7
-4
@@ -13,12 +13,15 @@ export type Element<+C> = React$Element<C>;
13
export type MixedElement = React$Element<ElementType>;
14
export type Key = React$Key;
15
export type Node = React$Node;
16
-export type Context<T> = React$Context<T>;
16
+// eslint-disable-next-line no-undef
17
+export type Context<T> = React.Context<T>;
18
export type Portal = React$Portal;
18
-export type RefSetter<-I> = React$RefSetter<I>;
19
-export type ElementProps<C> = React$ElementProps<C>;
19
+// eslint-disable-next-line no-undef
20
+export type RefSetter<-I> = React.RefSetter<I>;
21
+export type ElementProps<C> = React$ElementConfig<C>;
22
export type ElementConfig<C> = React$ElementConfig<C>;
21
-export type ElementRef<C> = React$ElementRef<C>;
23
+// eslint-disable-next-line no-undef
24
+export type ElementRef<C> = React.ElementRef<C>;
25
export type ChildrenArray<+T> = $ReadOnlyArray<ChildrenArray<T>> | T;
26
27
export {
packages/react/src/ReactAct.js
+1
@@ -102,6 +102,7 @@ export function act<T>(callback: () => T | Thenable<T>): Thenable<T> {
102
}
103
104
if (
105
+ // $FlowFixMe[invalid-compare]
106
result !== null &&
107
typeof result === 'object' &&
108
// $FlowFixMe[method-unbinding]
packages/react/src/ReactCacheClient.js
+1
-1
@@ -27,7 +27,7 @@ function noopCache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
27
// preserved, the length of the new function is 0, etc. That way apps can't
28
// accidentally depend on those details.
29
return function () {
30
- // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
30
+ // $FlowFixMe[incompatible-type]: We don't want to use rest arguments since we transpile the code.
31
return fn.apply(null, arguments);
32
};
33
}
packages/react/src/ReactCacheImpl.js
+3
-2
@@ -57,7 +57,7 @@ export function cache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
57
const dispatcher = ReactSharedInternals.A;
58
if (!dispatcher) {
59
// If there is no dispatcher, then we treat this as not being cached.
60
- // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
60
+ // $FlowFixMe[incompatible-type]: We don't want to use rest arguments since we transpile the code.
61
return fn.apply(null, arguments);
62
}
63
const fnMap: WeakMap<any, CacheNode<T>> = dispatcher.getCacheForType(
@@ -75,6 +75,7 @@ export function cache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
75
const arg = arguments[i];
76
if (
77
typeof arg === 'function' ||
78
+ // $FlowFixMe[invalid-compare]
79
(typeof arg === 'object' && arg !== null)
80
) {
81
// Objects go into a WeakMap
@@ -111,7 +112,7 @@ export function cache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
112
throw cacheNode.v;
113
}
114
try {
114
- // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
115
+ // $FlowFixMe[incompatible-type]: We don't want to use rest arguments since we transpile the code.
116
const result = fn.apply(null, arguments);
117
const terminatedNode: TerminatedCacheNode<T> = (cacheNode: any);
118
terminatedNode.s = TERMINATED;
packages/react/src/ReactChildren.js
+1
-1
@@ -369,7 +369,7 @@ function mapChildren(
369
context: mixed,
370
): ?Array<React$Node> {
371
if (children == null) {
372
- // $FlowFixMe limitation refining abstract types in Flow
372
+ // $FlowFixMe[incompatible-type] limitation refining abstract types in Flow
373
return children;
374
}
375
const result: Array<React$Node> = [];
packages/react/src/ReactLazy.js
+9
-5
@@ -112,9 +112,11 @@ function lazyInitializer<T>(payload: Payload<T>): T {
112
const debugValue =
113
moduleObject == null ? undefined : moduleObject.default;
114
resolveDebugValue(debugValue);
115
- // $FlowFixMe
115
+ // $FlowFixMe[incompatible-use]
116
+ // $FlowFixMe[prop-missing]
117
ioInfo.value.status = 'fulfilled';
117
- // $FlowFixMe
118
+ // $FlowFixMe[incompatible-use]
119
+ // $FlowFixMe[prop-missing]
120
ioInfo.value.value = debugValue;
121
}
122
}
@@ -145,12 +147,14 @@ function lazyInitializer<T>(payload: Payload<T>): T {
147
// $FlowFixMe[cannot-write]
148
ioInfo.end = performance.now();
149
// Hide unhandled rejections.
148
- // $FlowFixMe
150
+ // $FlowFixMe[incompatible-use]
151
ioInfo.value.then(noop, noop);
152
rejectDebugValue(error);
151
- // $FlowFixMe
153
+ // $FlowFixMe[incompatible-use]
154
+ // $FlowFixMe[prop-missing]
155
ioInfo.value.status = 'rejected';
153
- // $FlowFixMe
156
+ // $FlowFixMe[incompatible-use]
157
+ // $FlowFixMe[prop-missing]
158
ioInfo.value.reason = error;
159
}
160
}
packages/react/src/ReactStartTransition.js
+3
@@ -80,6 +80,7 @@ export function startTransition(
80
}
81
if (
82
typeof returnValue === 'object' &&
83
+ // $FlowFixMe[invalid-compare]
84
returnValue !== null &&
85
typeof returnValue.then === 'function'
86
) {
@@ -140,6 +141,7 @@ export function startGestureTransition(
141
if (enableViewTransition) {
142
currentTransition.types = null;
143
}
144
+ // $FlowFixMe[constant-condition]
145
if (enableGestureTransition) {
146
currentTransition.gesture = provider;
147
}
@@ -158,6 +160,7 @@ export function startGestureTransition(
160
if (__DEV__) {
161
if (
162
typeof returnValue === 'object' &&
163
+ // $FlowFixMe[invalid-compare]
164
returnValue !== null &&
165
typeof returnValue.then === 'function'
166
) {
packages/react/src/ReactTaint.js
+3
@@ -63,6 +63,7 @@ export function taintUniqueValue(
63
// eslint-disable-next-line react-internal/safe-string-coercion
64
message = '' + (message || defaultMessage);
65
if (
66
+ // $FlowFixMe[invalid-compare]
67
lifetime === null ||
68
(typeof lifetime !== 'object' && typeof lifetime !== 'function')
69
) {
@@ -86,6 +87,7 @@ export function taintUniqueValue(
87
TaintRegistryByteLengths.add(value.byteLength);
88
entryValue = binaryToComparableString(value);
89
} else {
90
+ // $FlowFixMe[invalid-compare]
91
const kind = value === null ? 'null' : typeof value;
92
if (kind === 'object' || kind === 'function') {
93
throw new Error(
@@ -127,6 +129,7 @@ export function taintObjectReference(
129
);
130
}
131
if (
132
+ // $FlowFixMe[invalid-compare]
133
object === null ||
134
(typeof object !== 'object' && typeof object !== 'function')
135
) {
packages/scheduler/src/SchedulerMinHeap.js
+1
-1
@@ -33,7 +33,7 @@ export function pop<T: Node>(heap: Heap<T>): T | null {
33
if (last !== first) {
34
// $FlowFixMe[incompatible-type]
35
heap[0] = last;
36
- // $FlowFixMe[incompatible-call]
36
+ // $FlowFixMe[incompatible-type]
37
siftDown(heap, last, 0);
38
}
39
return first;
packages/scheduler/src/SchedulerProfiling.js
+9
-1
@@ -47,7 +47,7 @@ function logEvent(entries: Array<number | PriorityLevel>) {
47
return;
48
}
49
const newEventLog = new Int32Array(eventLogSize * 4);
50
- // $FlowFixMe[incompatible-call] found when upgrading Flow
50
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
51
newEventLog.set(eventLog);
52
eventLogBuffer = newEventLog.buffer;
53
eventLog = newEventLog;
@@ -80,6 +80,7 @@ export function markTaskStart(
80
},
81
ms: number,
82
) {
83
+ // $FlowFixMe[constant-condition]
84
if (enableProfiling) {
85
if (eventLog !== null) {
86
// performance.now returns a float, representing milliseconds. When the
@@ -98,6 +99,7 @@ export function markTaskCompleted(
99
},
100
ms: number,
101
) {
102
+ // $FlowFixMe[constant-condition]
103
if (enableProfiling) {
104
if (eventLog !== null) {
105
logEvent([TaskCompleteEvent, ms * 1000, task.id]);
@@ -113,6 +115,7 @@ export function markTaskCanceled(
115
},
116
ms: number,
117
) {
118
+ // $FlowFixMe[constant-condition]
119
if (enableProfiling) {
120
if (eventLog !== null) {
121
logEvent([TaskCancelEvent, ms * 1000, task.id]);
@@ -128,6 +131,7 @@ export function markTaskErrored(
131
},
132
ms: number,
133
) {
134
+ // $FlowFixMe[constant-condition]
135
if (enableProfiling) {
136
if (eventLog !== null) {
137
logEvent([TaskErrorEvent, ms * 1000, task.id]);
@@ -143,6 +147,7 @@ export function markTaskRun(
147
},
148
ms: number,
149
) {
150
+ // $FlowFixMe[constant-condition]
151
if (enableProfiling) {
152
runIdCounter++;
153
@@ -153,6 +158,7 @@ export function markTaskRun(
158
}
159
160
export function markTaskYield(task: {id: number, ...}, ms: number) {
161
+ // $FlowFixMe[constant-condition]
162
if (enableProfiling) {
163
if (eventLog !== null) {
164
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]);
@@ -161,6 +167,7 @@ export function markTaskYield(task: {id: number, ...}, ms: number) {
167
}
168
169
export function markSchedulerSuspended(ms: number) {
170
+ // $FlowFixMe[constant-condition]
171
if (enableProfiling) {
172
mainThreadIdCounter++;
173
@@ -171,6 +178,7 @@ export function markSchedulerSuspended(ms: number) {
178
}
179
180
export function markSchedulerUnsuspended(ms: number) {
181
+ // $FlowFixMe[constant-condition]
182
if (enableProfiling) {
183
if (eventLog !== null) {
184
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]);
packages/scheduler/src/forks/Scheduler.js
+19
-4
@@ -112,6 +112,7 @@ function advanceTimers(currentTime: number) {
112
pop(timerQueue);
113
timer.sortIndex = timer.expirationTime;
114
push(taskQueue, timer);
115
+ // $FlowFixMe[constant-condition]
116
if (enableProfiling) {
117
markTaskStart(timer, currentTime);
118
timer.isQueued = true;
@@ -142,6 +143,7 @@ function handleTimeout(currentTime: number) {
143
}
144
145
function flushWork(initialTime: number) {
146
+ // $FlowFixMe[constant-condition]
147
if (enableProfiling) {
148
markSchedulerUnsuspended(initialTime);
149
}
@@ -157,6 +159,7 @@ function flushWork(initialTime: number) {
159
isPerformingWork = true;
160
const previousPriorityLevel = currentPriorityLevel;
161
try {
162
+ // $FlowFixMe[constant-condition]
163
if (enableProfiling) {
164
try {
165
return workLoop(initialTime);
@@ -164,6 +167,7 @@ function flushWork(initialTime: number) {
167
if (currentTask !== null) {
168
const currentTime = getCurrentTime();
169
// $FlowFixMe[incompatible-call] found when upgrading Flow
170
+ // $FlowFixMe[incompatible-type]
171
markTaskErrored(currentTask, currentTime);
172
// $FlowFixMe[incompatible-use] found when upgrading Flow
173
currentTask.isQueued = false;
@@ -178,6 +182,7 @@ function flushWork(initialTime: number) {
182
currentTask = null;
183
currentPriorityLevel = previousPriorityLevel;
184
isPerformingWork = false;
185
+ // $FlowFixMe[constant-condition]
186
if (enableProfiling) {
187
const currentTime = getCurrentTime();
188
markSchedulerSuspended(currentTime);
@@ -205,8 +210,9 @@ function workLoop(initialTime: number) {
210
currentPriorityLevel = currentTask.priorityLevel;
211
// $FlowFixMe[incompatible-use] found when upgrading Flow
212
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
213
+ // $FlowFixMe[constant-condition]
214
if (enableProfiling) {
209
- // $FlowFixMe[incompatible-call] found when upgrading Flow
215
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
216
markTaskRun(currentTask, currentTime);
217
}
218
const continuationCallback = callback(didUserCallbackTimeout);
@@ -216,15 +222,17 @@ function workLoop(initialTime: number) {
222
// regardless of how much time is left in the current time slice.
223
// $FlowFixMe[incompatible-use] found when upgrading Flow
224
currentTask.callback = continuationCallback;
225
+ // $FlowFixMe[constant-condition]
226
if (enableProfiling) {
220
- // $FlowFixMe[incompatible-call] found when upgrading Flow
227
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
228
markTaskYield(currentTask, currentTime);
229
}
230
advanceTimers(currentTime);
231
return true;
232
} else {
233
+ // $FlowFixMe[constant-condition]
234
if (enableProfiling) {
227
- // $FlowFixMe[incompatible-call] found when upgrading Flow
235
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
236
markTaskCompleted(currentTask, currentTime);
237
// $FlowFixMe[incompatible-use] found when upgrading Flow
238
currentTask.isQueued = false;
@@ -309,7 +317,7 @@ function unstable_next<T>(eventHandler: () => T): T {
317
318
function unstable_wrapCallback<T: (...Array<mixed>) => mixed>(callback: T): T {
319
var parentPriorityLevel = currentPriorityLevel;
312
- // $FlowFixMe[incompatible-return]
320
+ // $FlowFixMe[incompatible-type]
321
// $FlowFixMe[missing-this-annot]
322
return function () {
323
// This is a fork of runWithPriority, inlined for performance.
@@ -332,6 +340,7 @@ function unstable_scheduleCallback(
340
var currentTime = getCurrentTime();
341
342
var startTime;
343
+ // $FlowFixMe[invalid-compare]
344
if (typeof options === 'object' && options !== null) {
345
var delay = options.delay;
346
if (typeof delay === 'number' && delay > 0) {
@@ -378,6 +387,7 @@ function unstable_scheduleCallback(
387
expirationTime,
388
sortIndex: -1,
389
};
390
+ // $FlowFixMe[constant-condition]
391
if (enableProfiling) {
392
newTask.isQueued = false;
393
}
@@ -400,6 +410,7 @@ function unstable_scheduleCallback(
410
} else {
411
newTask.sortIndex = expirationTime;
412
push(taskQueue, newTask);
413
+ // $FlowFixMe[constant-condition]
414
if (enableProfiling) {
415
markTaskStart(newTask, currentTime);
416
newTask.isQueued = true;
@@ -416,6 +427,7 @@ function unstable_scheduleCallback(
427
}
428
429
function unstable_cancelCallback(task: Task) {
430
+ // $FlowFixMe[constant-condition]
431
if (enableProfiling) {
432
if (task.isQueued) {
433
const currentTime = getCurrentTime();
@@ -460,6 +472,7 @@ function shouldYieldToHost(): boolean {
472
}
473
474
function requestPaint() {
475
+ // $FlowFixMe[constant-condition]
476
if (enableRequestPaint) {
477
needsPaint = true;
478
}
@@ -483,6 +496,7 @@ function forceFrameRate(fps: number) {
496
}
497
498
const performWorkUntilDeadline = () => {
499
+ // $FlowFixMe[constant-condition]
500
if (enableRequestPaint) {
501
needsPaint = false;
502
}
@@ -590,6 +604,7 @@ export {
604
export const unstable_Profiling: {
605
startLoggingProfilingEvents(): void,
606
stopLoggingProfilingEvents(): ArrayBuffer | null,
607
+ // $FlowFixMe[constant-condition]
608
} | null = enableProfiling
609
? {
610
startLoggingProfilingEvents,
packages/scheduler/src/forks/SchedulerMock.js
+18
@@ -112,6 +112,7 @@ function advanceTimers(currentTime: number) {
112
pop(timerQueue);
113
timer.sortIndex = timer.expirationTime;
114
push(taskQueue, timer);
115
+ // $FlowFixMe[constant-condition]
116
if (enableProfiling) {
117
markTaskStart(timer, currentTime);
118
timer.isQueued = true;
@@ -142,6 +143,7 @@ function handleTimeout(currentTime: number) {
143
}
144
145
function flushWork(hasTimeRemaining: boolean, initialTime: number) {
146
+ // $FlowFixMe[constant-condition]
147
if (enableProfiling) {
148
markSchedulerUnsuspended(initialTime);
149
}
@@ -157,6 +159,7 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) {
159
isPerformingWork = true;
160
const previousPriorityLevel = currentPriorityLevel;
161
try {
162
+ // $FlowFixMe[constant-condition]
163
if (enableProfiling) {
164
try {
165
return workLoop(hasTimeRemaining, initialTime);
@@ -164,6 +167,7 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) {
167
if (currentTask !== null) {
168
const currentTime = getCurrentTime();
169
// $FlowFixMe[incompatible-call] found when upgrading Flow
170
+ // $FlowFixMe[incompatible-type]
171
markTaskErrored(currentTask, currentTime);
172
// $FlowFixMe[incompatible-use] found when upgrading Flow
173
currentTask.isQueued = false;
@@ -178,6 +182,7 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) {
182
currentTask = null;
183
currentPriorityLevel = previousPriorityLevel;
184
isPerformingWork = false;
185
+ // $FlowFixMe[constant-condition]
186
if (enableProfiling) {
187
const currentTime = getCurrentTime();
188
markSchedulerSuspended(currentTime);
@@ -206,8 +211,10 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean {
211
currentPriorityLevel = currentTask.priorityLevel;
212
// $FlowFixMe[incompatible-use] found when upgrading Flow
213
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
214
+ // $FlowFixMe[constant-condition]
215
if (enableProfiling) {
216
// $FlowFixMe[incompatible-call] found when upgrading Flow
217
+ // $FlowFixMe[incompatible-type]
218
markTaskRun(currentTask, currentTime);
219
}
220
const continuationCallback = callback(didUserCallbackTimeout);
@@ -217,8 +224,10 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean {
224
// regardless of how much time is left in the current time slice.
225
// $FlowFixMe[incompatible-use] found when upgrading Flow
226
currentTask.callback = continuationCallback;
227
+ // $FlowFixMe[constant-condition]
228
if (enableProfiling) {
229
// $FlowFixMe[incompatible-call] found when upgrading Flow
230
+ // $FlowFixMe[incompatible-type]
231
markTaskYield(currentTask, currentTime);
232
}
233
advanceTimers(currentTime);
@@ -232,8 +241,10 @@ function workLoop(hasTimeRemaining: boolean, initialTime: number): boolean {
241
// `toFlushAndYield` and `toFlushAndYieldThrough` testing helpers .
242
}
243
} else {
244
+ // $FlowFixMe[constant-condition]
245
if (enableProfiling) {
246
// $FlowFixMe[incompatible-call] found when upgrading Flow
247
+ // $FlowFixMe[incompatible-type]
248
markTaskCompleted(currentTask, currentTime);
249
// $FlowFixMe[incompatible-use] found when upgrading Flow
250
currentTask.isQueued = false;
@@ -314,6 +325,7 @@ function unstable_wrapCallback<T: (...Array<mixed>) => mixed>(callback: T): T {
325
var parentPriorityLevel = currentPriorityLevel;
326
// $FlowFixMe[incompatible-return]
327
// $FlowFixMe[missing-this-annot]
328
+ // $FlowFixMe[incompatible-type]
329
return function () {
330
// This is a fork of runWithPriority, inlined for performance.
331
var previousPriorityLevel = currentPriorityLevel;
@@ -335,6 +347,7 @@ function unstable_scheduleCallback(
347
var currentTime = getCurrentTime();
348
349
var startTime;
350
+ // $FlowFixMe[invalid-compare]
351
if (typeof options === 'object' && options !== null) {
352
var delay = options.delay;
353
if (typeof delay === 'number' && delay > 0) {
@@ -376,6 +389,7 @@ function unstable_scheduleCallback(
389
expirationTime,
390
sortIndex: -1,
391
};
392
+ // $FlowFixMe[constant-condition]
393
if (enableProfiling) {
394
newTask.isQueued = false;
395
}
@@ -398,6 +412,7 @@ function unstable_scheduleCallback(
412
} else {
413
newTask.sortIndex = expirationTime;
414
push(taskQueue, newTask);
415
+ // $FlowFixMe[constant-condition]
416
if (enableProfiling) {
417
markTaskStart(newTask, currentTime);
418
newTask.isQueued = true;
@@ -414,6 +429,7 @@ function unstable_scheduleCallback(
429
}
430
431
function unstable_cancelCallback(task: Task) {
432
+ // $FlowFixMe[constant-condition]
433
if (enableProfiling) {
434
if (task.isQueued) {
435
const currentTime = getCurrentTime();
@@ -569,6 +585,7 @@ function unstable_flushAllWithoutAsserting(): boolean {
585
do {
586
hasMoreWork = cb(true, currentMockTime);
587
} while (hasMoreWork);
588
+ // $FlowFixMe[constant-condition]
589
if (!hasMoreWork) {
590
scheduledCallback = null;
591
}
@@ -672,6 +689,7 @@ export {
689
export const unstable_Profiling: {
690
startLoggingProfilingEvents(): void,
691
stopLoggingProfilingEvents(): ArrayBuffer | null,
692
+ // $FlowFixMe[constant-condition]
693
} | null = enableProfiling
694
? {
695
startLoggingProfilingEvents,
packages/scheduler/src/forks/SchedulerPostTask.js
+1
@@ -96,6 +96,7 @@ export function unstable_scheduleCallback<T>(
96
97
const controller = new TaskController({priority: postTaskPriority});
98
const postTaskOptions = {
99
+ // $FlowFixMe[invalid-compare]
100
delay: typeof options === 'object' && options !== null ? options.delay : 0,
101
signal: controller.signal,
102
};
packages/shared/CheckStringCoercion.js
+3
-3
@@ -17,7 +17,7 @@
17
* of the `value` object).
18
*/
19
20
-// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
20
+// $FlowFixMe[incompatible-type] only called in DEV, so void return is not possible.
21
function typeName(value: mixed): string {
22
if (__DEV__) {
23
// toStringTag is needed for namespaced types like Temporal.Instant
@@ -26,12 +26,12 @@ function typeName(value: mixed): string {
26
(hasToStringTag && (value: any)[Symbol.toStringTag]) ||
27
(value: any).constructor.name ||
28
'Object';
29
- // $FlowFixMe[incompatible-return]
29
+ // $FlowFixMe[incompatible-type]
30
return type;
31
}
32
}
33
34
-// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
34
+// $FlowFixMe[incompatible-type] only called in DEV, so void return is not possible.
35
function willCoercionThrow(value: mixed): boolean {
36
if (__DEV__) {
37
try {
scripts/flow/environment.js
+1
-1
@@ -85,7 +85,7 @@ declare class ScrollTimeline extends AnimationTimeline {
85
// $FlowFixMe[libdef-override]
86
declare opaque type React$Element<
87
+ElementType: React$ElementType,
88
- +P = React$ElementProps<ElementType>,
88
+ +P = React$ElementConfig<ElementType>,
89
>: {
90
+type: ElementType,
91
+props: P,
yarn.lock
+20
-20
@@ -9247,17 +9247,17 @@ flatted@^3.2.9:
9247
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
9248
integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==
9249
9250
-flow-bin@^0.279.0:
9251
- version "0.279.0"
9252
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.279.0.tgz#06e502a51d735083d715ef769f43bdcb0fc2bb61"
9253
- integrity sha512-Xf0T82atOcEf5auHvJfUF+wWIxieBuUJZBu2hlAizdhAzwqSJic74ZLaL6N5SsE0SY9PxPf3Z/lBU7iRpRa9Lw==
9250
+flow-bin@^0.307.1:
9251
+ version "0.307.1"
9252
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.307.1.tgz#6ca6ec271a67b8fc23ab6194c26f143d1ddb6a9a"
9253
+ integrity sha512-0AglecFYaFu5ooF1IJmm4SBUZO7sopMU0jTr/Bburm/XxkJUtql+MDpwqKBFe1DTd2I/3kBzqOIFgwsZ8gS7tw==
9254
9255
-flow-remove-types@^2.279.0:
9256
- version "2.279.0"
9257
- resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.279.0.tgz#3a3388d9158eba0f82c40d80d31d9640b883a3f5"
9258
- integrity sha512-bPFloMR/A2b/r/sIsf7Ix0LaMicCJNjwhXc4xEEQVzJCIz5u7C7XDaEOXOiqveKlCYK7DcBNn6R01Cbbc9gsYA==
9255
+flow-remove-types@^2.307.1:
9256
+ version "2.307.1"
9257
+ resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.307.1.tgz#d5a011d47aefdfdbccbd9d8ef3b84a1fd39160cd"
9258
+ integrity sha512-PdOUe0ijQQYN8aKADulTCLNL7l0Rdkmodo7/aXTr97m18uUTrGDxCAhE0kYx6JiA0EG9X/QmJUbzdoUcgNGvag==
9259
dependencies:
9260
- hermes-parser "0.29.1"
9260
+ hermes-parser "0.34.0"
9261
pirates "^3.0.2"
9262
vlq "^0.2.1"
9263
@@ -10139,22 +10139,15 @@ hermes-estree@0.25.1:
10139
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.25.1.tgz#6aeec17d1983b4eabf69721f3aa3eb705b17f480"
10140
integrity sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==
10141
10142
-hermes-estree@0.29.1:
10143
- version "0.29.1"
10144
- resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.29.1.tgz#043c7db076e0e8ef8c5f6ed23828d1ba463ebcc5"
10145
- integrity sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ==
10146
-
10142
hermes-estree@0.32.0:
10143
version "0.32.0"
10144
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.32.0.tgz#bb7da6613ab8e67e334a1854ea1e209f487d307b"
10145
integrity sha512-KWn3BqnlDOl97Xe1Yviur6NbgIZ+IP+UVSpshlZWkq+EtoHg6/cwiDj/osP9PCEgFE15KBm1O55JRwbMEm5ejQ==
10146
10152
-hermes-parser@0.29.1:
10153
- version "0.29.1"
10154
- resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.29.1.tgz#436b24bcd7bb1e71f92a04c396ccc0716c288d56"
10155
- integrity sha512-xBHWmUtRC5e/UL0tI7Ivt2riA/YBq9+SiYFU7C1oBa/j2jYGlIF9043oak1F47ihuDIxQ5nbsKueYJDRY02UgA==
10156
- dependencies:
10157
- hermes-estree "0.29.1"
10147
+hermes-estree@0.34.0:
10148
+ version "0.34.0"
10149
+ resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.34.0.tgz#a6e1aa55d0ef06136158991869b97166ce62d328"
10150
+ integrity sha512-6qLylexjmuKa/YYhMiNn/3VejBsdzwmYUGmNpc693/pJzymmbufhkRW/2K6GqFgu0ApRWoqF0NbM6u82jFcOXA==
10151
10152
hermes-parser@0.32.0, hermes-parser@^0.32.0:
10153
version "0.32.0"
@@ -10163,6 +10156,13 @@ hermes-parser@0.32.0, hermes-parser@^0.32.0:
10156
dependencies:
10157
hermes-estree "0.32.0"
10158
10159
+hermes-parser@0.34.0:
10160
+ version "0.34.0"
10161
+ resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.34.0.tgz#f6050c7b1a5e978af551be9faf19bc7d7c050a82"
10162
+ integrity sha512-tcgan5UNZvu3WwmR3jDAlmwEAR2CMv8cwQVMe5j0NrLQkstf0l3ULbYPuTZWbXxbPa0PyZPiq5LYEcFVmhM9LQ==
10163
+ dependencies:
10164
+ hermes-estree "0.34.0"
10165
+
10166
hermes-parser@^0.25.1:
10167
version "0.25.1"
10168
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.25.1.tgz#5be0e487b2090886c62bd8a11724cd766d5f54d1"