Skip to content

Commit ae98316

Browse files
committed
[flow] make Flow suppressions explicit on the error (#26487)
Added an explicit type to all $FlowFixMe suppressions to reduce over-suppressions of new errors that might be caused on the same lines. Also removes suppressions that aren't used (e.g. in a `@noflow` file as they're purely misleading) Test Plan: yarn flow-ci DiffTrain build for commit afea1d0.
1 parent 7f1afb7 commit ae98316

15 files changed

+125
-125
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,7 +2177,7 @@ function setCurrentlyValidatingElement(element) {
21772177

21782178
function checkPropTypes(typeSpecs, values, location, componentName, element) {
21792179
{
2180-
// $FlowFixMe This is okay but Flow doesn't know it.
2180+
// $FlowFixMe[incompatible-use] This is okay but Flow doesn't know it.
21812181
var has = Function.call.bind(hasOwnProperty);
21822182

21832183
for (var typeSpecName in typeSpecs) {
@@ -4114,19 +4114,19 @@ var ReactStrictModeWarnings = {
41144114
* problem. (Instead of a confusing exception thrown inside the implementation
41154115
* of the `value` object).
41164116
*/
4117-
// $FlowFixMe only called in DEV, so void return is not possible.
4117+
// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
41184118
function typeName(value) {
41194119
{
41204120
// toStringTag is needed for namespaced types like Temporal.Instant
41214121
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
41224122
var type =
41234123
(hasToStringTag && value[Symbol.toStringTag]) ||
41244124
value.constructor.name ||
4125-
"Object"; // $FlowFixMe
4125+
"Object"; // $FlowFixMe[incompatible-return]
41264126

41274127
return type;
41284128
}
4129-
} // $FlowFixMe only called in DEV, so void return is not possible.
4129+
} // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
41304130

41314131
function willCoercionThrow(value) {
41324132
{
@@ -4385,7 +4385,7 @@ var warnForMissingKey = function (child, returnFiber) {};
43854385
"React Component in warnForMissingKey should have a _store. " +
43864386
"This error is likely caused by a bug in React. Please file an issue."
43874387
);
4388-
} // $FlowFixMe unable to narrow type from mixed to writable object
4388+
} // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object
43894389

43904390
child._store.validated = true;
43914391
var componentName = getComponentNameFromFiber(returnFiber) || "Component";
@@ -5301,7 +5301,7 @@ function createChildReconciler(shouldTrackSideEffects) {
53015301
// We don't support rendering Generators because it's a mutation.
53025302
// See https://github.com/facebook/react/issues/12995
53035303
if (
5304-
typeof Symbol === "function" && // $FlowFixMe Flow doesn't know about toStringTag
5304+
typeof Symbol === "function" && // $FlowFixMe[prop-missing] Flow doesn't know about toStringTag
53055305
newChildrenIterable[Symbol.toStringTag] === "Generator"
53065306
) {
53075307
if (!didWarnAboutGenerators) {
@@ -6759,7 +6759,7 @@ function use(usable) {
67596759
}
67606760

67616761
function basicStateReducer(state, action) {
6762-
// $FlowFixMe: Flow doesn't like mixed types
6762+
// $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
67636763
return typeof action === "function" ? action(state) : action;
67646764
}
67656765

@@ -7219,7 +7219,7 @@ function mountState(initialState) {
72197219
var hook = mountWorkInProgressHook();
72207220

72217221
if (typeof initialState === "function") {
7222-
// $FlowFixMe: Flow doesn't like mixed types
7222+
// $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
72237223
initialState = initialState();
72247224
}
72257225

@@ -14871,7 +14871,7 @@ function completeDehydratedSuspenseBoundary(
1487114871
var primaryChildFragment = workInProgress.child;
1487214872

1487314873
if (primaryChildFragment !== null) {
14874-
// $FlowFixMe Flow doesn't support type casting in combination with the -= operator
14874+
// $FlowFixMe[unsafe-arithmetic] Flow doesn't support type casting in combination with the -= operator
1487514875
workInProgress.treeBaseDuration -=
1487614876
primaryChildFragment.treeBaseDuration;
1487714877
}
@@ -14902,7 +14902,7 @@ function completeDehydratedSuspenseBoundary(
1490214902
var _primaryChildFragment = workInProgress.child;
1490314903

1490414904
if (_primaryChildFragment !== null) {
14905-
// $FlowFixMe Flow doesn't support type casting in combination with the -= operator
14905+
// $FlowFixMe[unsafe-arithmetic] Flow doesn't support type casting in combination with the -= operator
1490614906
workInProgress.treeBaseDuration -=
1490714907
_primaryChildFragment.treeBaseDuration;
1490814908
}
@@ -15234,7 +15234,7 @@ function completeWork(current, workInProgress, renderLanes) {
1523415234
var primaryChildFragment = workInProgress.child;
1523515235

1523615236
if (primaryChildFragment !== null) {
15237-
// $FlowFixMe Flow doesn't support type casting in combination with the -= operator
15237+
// $FlowFixMe[unsafe-arithmetic] Flow doesn't support type casting in combination with the -= operator
1523815238
workInProgress.treeBaseDuration -=
1523915239
primaryChildFragment.treeBaseDuration;
1524015240
}
@@ -16162,7 +16162,7 @@ function safelyDetachRef(current, nearestMountedAncestor) {
1616216162
}
1616316163
}
1616416164
} else {
16165-
// $FlowFixMe unable to narrow type to RefObject
16165+
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
1616616166
ref.current = null;
1616716167
}
1616816168
}
@@ -17076,7 +17076,7 @@ function commitAttachRef(finishedWork) {
1707617076
getComponentNameFromFiber(finishedWork)
1707717077
);
1707817078
}
17079-
} // $FlowFixMe unable to narrow type to the non-function case
17079+
} // $FlowFixMe[incompatible-use] unable to narrow type to the non-function case
1708017080

1708117081
ref.current = instanceToUse;
1708217082
}
@@ -19487,7 +19487,7 @@ function isLegacyActEnvironment(fiber) {
1948719487
var isReactActEnvironmentGlobal = // $FlowFixMe[cannot-resolve-name] Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
1948819488
typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" // $FlowFixMe[cannot-resolve-name]
1948919489
? IS_REACT_ACT_ENVIRONMENT
19490-
: undefined; // $FlowFixMe - Flow doesn't know about jest
19490+
: undefined; // $FlowFixMe[cannot-resolve-name] - Flow doesn't know about jest
1949119491

1949219492
var jestIsDefined = typeof jest !== "undefined";
1949319493
return jestIsDefined && isReactActEnvironmentGlobal !== false;
@@ -20649,7 +20649,7 @@ function prepareFreshStack(root, lanes) {
2064920649
if (timeoutHandle !== noTimeout) {
2065020650
// The root previous suspended and scheduled a timeout to commit a fallback
2065120651
// state. Now that we have additional work, cancel the timeout.
20652-
root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
20652+
root.timeoutHandle = noTimeout; // $FlowFixMe[incompatible-call] Complains noTimeout is not a TimeoutID, despite the check above
2065320653

2065420654
cancelTimeout(timeoutHandle);
2065520655
}
@@ -23149,7 +23149,7 @@ function FiberNode(tag, pendingProps, key, mode) {
2314923149
// compatible.
2315023150

2315123151
function createFiber(tag, pendingProps, key, mode) {
23152-
// $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
23152+
// $FlowFixMe[invalid-constructor]: the shapes are exact here but Flow doesn't like constructors
2315323153
return new FiberNode(tag, pendingProps, key, mode);
2315423154
}
2315523155

@@ -23762,7 +23762,7 @@ function createFiberRoot(
2376223762
return root;
2376323763
}
2376423764

23765-
var ReactVersion = "18.3.0-next-768f965de-20230326";
23765+
var ReactVersion = "18.3.0-next-afea1d0c5-20230327";
2376623766

2376723767
// Might add PROFILE later.
2376823768

@@ -23932,7 +23932,7 @@ var setSuspenseHandler = null;
2393223932
}
2393323933

2393423934
return updated;
23935-
} // $FlowFixMe number or string is fine here
23935+
} // $FlowFixMe[incompatible-use] number or string is fine here
2393623936

2393723937
updated[key] = copyWithDeleteImpl(obj[key], path, index + 1);
2393823938
return updated;
@@ -23947,7 +23947,7 @@ var setSuspenseHandler = null;
2394723947
var updated = isArray(obj) ? obj.slice() : assign({}, obj);
2394823948

2394923949
if (index + 1 === oldPath.length) {
23950-
var newKey = newPath[index]; // $FlowFixMe number or string is fine here
23950+
var newKey = newPath[index]; // $FlowFixMe[incompatible-use] number or string is fine here
2395123951

2395223952
updated[newKey] = updated[oldKey];
2395323953

@@ -23957,9 +23957,9 @@ var setSuspenseHandler = null;
2395723957
delete updated[oldKey];
2395823958
}
2395923959
} else {
23960-
// $FlowFixMe number or string is fine here
23960+
// $FlowFixMe[incompatible-use] number or string is fine here
2396123961
updated[oldKey] = copyWithRenameImpl(
23962-
// $FlowFixMe number or string is fine here
23962+
// $FlowFixMe[incompatible-use] number or string is fine here
2396323963
obj[oldKey],
2396423964
oldPath,
2396523965
newPath,
@@ -23996,7 +23996,7 @@ var setSuspenseHandler = null;
2399623996
}
2399723997

2399823998
var key = path[index];
23999-
var updated = isArray(obj) ? obj.slice() : assign({}, obj); // $FlowFixMe number or string is fine here
23999+
var updated = isArray(obj) ? obj.slice() : assign({}, obj); // $FlowFixMe[incompatible-use] number or string is fine here
2400024000

2400124001
updated[key] = copyWithSetImpl(obj[key], path, index + 1, value);
2400224002
return updated;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8640,7 +8640,7 @@ var devToolsConfig$jscomp$inline_1007 = {
86408640
throw Error("TestRenderer does not support findFiberByHostInstance()");
86418641
},
86428642
bundleType: 0,
8643-
version: "18.3.0-next-768f965de-20230326",
8643+
version: "18.3.0-next-afea1d0c5-20230327",
86448644
rendererPackageName: "react-test-renderer"
86458645
};
86468646
var internals$jscomp$inline_1198 = {
@@ -8671,7 +8671,7 @@ var internals$jscomp$inline_1198 = {
86718671
scheduleRoot: null,
86728672
setRefreshHandler: null,
86738673
getCurrentFiber: null,
8674-
reconcilerVersion: "18.3.0-next-768f965de-20230326"
8674+
reconcilerVersion: "18.3.0-next-afea1d0c5-20230327"
86758675
};
86768676
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
86778677
var hook$jscomp$inline_1199 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9065,7 +9065,7 @@ var devToolsConfig$jscomp$inline_1050 = {
90659065
throw Error("TestRenderer does not support findFiberByHostInstance()");
90669066
},
90679067
bundleType: 0,
9068-
version: "18.3.0-next-768f965de-20230326",
9068+
version: "18.3.0-next-afea1d0c5-20230327",
90699069
rendererPackageName: "react-test-renderer"
90709070
};
90719071
var internals$jscomp$inline_1239 = {
@@ -9096,7 +9096,7 @@ var internals$jscomp$inline_1239 = {
90969096
scheduleRoot: null,
90979097
setRefreshHandler: null,
90989098
getCurrentFiber: null,
9099-
reconcilerVersion: "18.3.0-next-768f965de-20230326"
9099+
reconcilerVersion: "18.3.0-next-afea1d0c5-20230327"
91009100
};
91019101
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
91029102
var hook$jscomp$inline_1240 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ function setCurrentlyValidatingElement$1(element) {
393393

394394
function checkPropTypes(typeSpecs, values, location, componentName, element) {
395395
{
396-
// $FlowFixMe This is okay but Flow doesn't know it.
396+
// $FlowFixMe[incompatible-use] This is okay but Flow doesn't know it.
397397
var has = Function.call.bind(hasOwnProperty);
398398

399399
for (var typeSpecName in typeSpecs) {
@@ -487,19 +487,19 @@ function isArray(a) {
487487
* problem. (Instead of a confusing exception thrown inside the implementation
488488
* of the `value` object).
489489
*/
490-
// $FlowFixMe only called in DEV, so void return is not possible.
490+
// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
491491
function typeName(value) {
492492
{
493493
// toStringTag is needed for namespaced types like Temporal.Instant
494494
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
495495
var type =
496496
(hasToStringTag && value[Symbol.toStringTag]) ||
497497
value.constructor.name ||
498-
"Object"; // $FlowFixMe
498+
"Object"; // $FlowFixMe[incompatible-return]
499499

500500
return type;
501501
}
502-
} // $FlowFixMe only called in DEV, so void return is not possible.
502+
} // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
503503

504504
function willCoercionThrow(value) {
505505
{

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ function setCurrentlyValidatingElement$1(element) {
393393

394394
function checkPropTypes(typeSpecs, values, location, componentName, element) {
395395
{
396-
// $FlowFixMe This is okay but Flow doesn't know it.
396+
// $FlowFixMe[incompatible-use] This is okay but Flow doesn't know it.
397397
var has = Function.call.bind(hasOwnProperty);
398398

399399
for (var typeSpecName in typeSpecs) {
@@ -487,19 +487,19 @@ function isArray(a) {
487487
* problem. (Instead of a confusing exception thrown inside the implementation
488488
* of the `value` object).
489489
*/
490-
// $FlowFixMe only called in DEV, so void return is not possible.
490+
// $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
491491
function typeName(value) {
492492
{
493493
// toStringTag is needed for namespaced types like Temporal.Instant
494494
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
495495
var type =
496496
(hasToStringTag && value[Symbol.toStringTag]) ||
497497
value.constructor.name ||
498-
"Object"; // $FlowFixMe
498+
"Object"; // $FlowFixMe[incompatible-return]
499499

500500
return type;
501501
}
502-
} // $FlowFixMe only called in DEV, so void return is not possible.
502+
} // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
503503

504504
function willCoercionThrow(value) {
505505
{

0 commit comments

Comments
 (0)