Skip to content

Commit 3075524

Browse files
committed
[flow] enable enforce_local_inference_annotations (#25921)
This setting is an incremental path to the next Flow version enforcing type annotations on most functions (except some inline callbacks). Used ``` node_modules/.bin/flow codemod annotate-functions-and-classes --write . ``` to add a majority of the types with some hand cleanup when for large inferred objects that should just be `Fiber` or weird constructs including `any`. Suppressed the remaining issues. Builds on #25918 DiffTrain build for [0b4f443](0b4f443) [View git log for this commit](https://github.com/facebook/react/commits/0b4f443020af386f2b48c47c074cb504ed672dc8)
1 parent 3131770 commit 3075524

39 files changed

+227
-126
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0b974418c9a56f6c560298560265dcf4b65784bc
1+
0b4f443020af386f2b48c47c074cb504ed672dc8
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0b974418c9a56f6c560298560265dcf4b65784bc
1+
0b4f443020af386f2b48c47c074cb504ed672dc8

compiled/facebook-www/React-dev.classic.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-classic-0b974418c-20230106";
30+
var ReactVersion = "18.3.0-www-classic-0b4f44302-20230109";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,
@@ -1311,7 +1311,7 @@ function countChildren(children) {
13111311

13121312
function forEachChildren(children, forEachFunc, forEachContext) {
13131313
mapChildren(
1314-
children,
1314+
children, // $FlowFixMe[missing-this-annot]
13151315
function() {
13161316
forEachFunc.apply(this, arguments); // Don't return anything.
13171317
},
@@ -1582,6 +1582,7 @@ function lazy(ctor) {
15821582
get: function() {
15831583
return defaultProps;
15841584
},
1585+
// $FlowFixMe[missing-local-annot]
15851586
set: function(newDefaultProps) {
15861587
error(
15871588
"React.lazy(...): It is not supported to assign `defaultProps` to " +
@@ -1602,6 +1603,7 @@ function lazy(ctor) {
16021603
get: function() {
16031604
return propTypes;
16041605
},
1606+
// $FlowFixMe[missing-local-annot]
16051607
set: function(newPropTypes) {
16061608
error(
16071609
"React.lazy(...): It is not supported to assign `propTypes` to " +

compiled/facebook-www/React-dev.modern.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-modern-0b974418c-20230106";
30+
var ReactVersion = "18.3.0-www-modern-0b4f44302-20230109";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,
@@ -1311,7 +1311,7 @@ function countChildren(children) {
13111311

13121312
function forEachChildren(children, forEachFunc, forEachContext) {
13131313
mapChildren(
1314-
children,
1314+
children, // $FlowFixMe[missing-this-annot]
13151315
function() {
13161316
forEachFunc.apply(this, arguments); // Don't return anything.
13171317
},
@@ -1582,6 +1582,7 @@ function lazy(ctor) {
15821582
get: function() {
15831583
return defaultProps;
15841584
},
1585+
// $FlowFixMe[missing-local-annot]
15851586
set: function(newDefaultProps) {
15861587
error(
15871588
"React.lazy(...): It is not supported to assign `defaultProps` to " +
@@ -1602,6 +1603,7 @@ function lazy(ctor) {
16021603
get: function() {
16031604
return propTypes;
16041605
},
1606+
// $FlowFixMe[missing-local-annot]
16051607
set: function(newPropTypes) {
16061608
error(
16071609
"React.lazy(...): It is not supported to assign `propTypes` to " +

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,4 +643,4 @@ exports.useSyncExternalStore = function(
643643
);
644644
};
645645
exports.useTransition = useTransition;
646-
exports.version = "18.3.0-www-classic-0b974418c-20230106";
646+
exports.version = "18.3.0-www-classic-0b4f44302-20230109";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,4 @@ exports.useSyncExternalStore = function(
635635
);
636636
};
637637
exports.useTransition = useTransition;
638-
exports.version = "18.3.0-www-modern-0b974418c-20230106";
638+
exports.version = "18.3.0-www-modern-0b4f44302-20230109";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ exports.useSyncExternalStore = function(
654654
);
655655
};
656656
exports.useTransition = useTransition;
657-
exports.version = "18.3.0-www-classic-0b974418c-20230106";
657+
exports.version = "18.3.0-www-classic-0b4f44302-20230109";
658658

659659
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
660660
if (

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ exports.useSyncExternalStore = function(
646646
);
647647
};
648648
exports.useTransition = useTransition;
649-
exports.version = "18.3.0-www-modern-0b974418c-20230106";
649+
exports.version = "18.3.0-www-modern-0b4f44302-20230109";
650650

651651
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
652652
if (

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

72-
var ReactVersion = "18.3.0-www-classic-0b974418c-20230106";
72+
var ReactVersion = "18.3.0-www-classic-0b4f44302-20230109";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -10963,6 +10963,7 @@ function applyDerivedStateFromProps(
1096310963

1096410964
var classComponentUpdater = {
1096510965
isMounted: isMounted,
10966+
// $FlowFixMe[missing-local-annot]
1096610967
enqueueSetState: function(inst, payload, callback) {
1096710968
var fiber = get(inst);
1096810969
var eventTime = requestEventTime();
@@ -11034,6 +11035,7 @@ var classComponentUpdater = {
1103411035
markStateUpdateScheduled(fiber, lane);
1103511036
}
1103611037
},
11038+
// $FlowFixMe[missing-local-annot]
1103711039
enqueueForceUpdate: function(inst, callback) {
1103811040
var fiber = get(inst);
1103911041
var eventTime = requestEventTime();
@@ -12176,6 +12178,7 @@ function createClassErrorUpdate(fiber, errorInfo, lane) {
1217612178
var inst = fiber.stateNode;
1217712179

1217812180
if (inst !== null && typeof inst.componentDidCatch === "function") {
12181+
// $FlowFixMe[missing-this-annot]
1217912182
update.callback = function callback() {
1218012183
{
1218112184
markFailedErrorBoundaryForHotReloading(fiber);
@@ -16971,7 +16974,7 @@ function readContext(context) {
1697116974

1697216975
var AbortControllerLocal =
1697316976
typeof AbortController !== "undefined"
16974-
? AbortController
16977+
? AbortController // $FlowFixMe[missing-this-annot]
1697516978
: function AbortControllerShim() {
1697616979
var listeners = [];
1697716980
var signal = (this.signal = {
@@ -24054,8 +24057,7 @@ function markRootSuspended$1(root, suspendedLanes) {
2405424057
suspendedLanes = removeLanes(
2405524058
suspendedLanes,
2405624059
workInProgressRootInterleavedUpdatedLanes
24057-
); // $FlowFixMe[incompatible-call] found when upgrading Flow
24058-
24060+
);
2405924061
markRootSuspended(root, suspendedLanes);
2406024062
} // This is the entry point for synchronous tasks that don't go
2406124063
// through Scheduler
@@ -24453,6 +24455,7 @@ function renderDidSuspendDelayIfPossible() {
2445324455
// pinged or updated while we were rendering.
2445424456
// TODO: Consider unwinding immediately, using the
2445524457
// SuspendedOnHydration mechanism.
24458+
// $FlowFixMe[incompatible-call] need null check workInProgressRoot
2445624459
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
2445724460
}
2445824461
}
@@ -26212,7 +26215,7 @@ function restorePendingUpdaters(root, lanes) {
2621226215
}
2621326216
}
2621426217
}
26215-
var fakeActCallbackNode = {};
26218+
var fakeActCallbackNode = {}; // $FlowFixMe[missing-local-annot]
2621626219

2621726220
function scheduleCallback$2(priorityLevel, callback) {
2621826221
{
@@ -27479,7 +27482,7 @@ function assignFiberPropertiesInDEV(target, source) {
2747927482
}
2748027483

2748127484
function FiberRootNode(
27482-
containerInfo,
27485+
containerInfo, // $FlowFixMe[missing-local-annot]
2748327486
tag,
2748427487
hydrate,
2748527488
identifierPrefix,

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

72-
var ReactVersion = "18.3.0-www-modern-0b974418c-20230106";
72+
var ReactVersion = "18.3.0-www-modern-0b4f44302-20230109";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -10723,6 +10723,7 @@ function applyDerivedStateFromProps(
1072310723

1072410724
var classComponentUpdater = {
1072510725
isMounted: isMounted,
10726+
// $FlowFixMe[missing-local-annot]
1072610727
enqueueSetState: function(inst, payload, callback) {
1072710728
var fiber = get(inst);
1072810729
var eventTime = requestEventTime();
@@ -10794,6 +10795,7 @@ var classComponentUpdater = {
1079410795
markStateUpdateScheduled(fiber, lane);
1079510796
}
1079610797
},
10798+
// $FlowFixMe[missing-local-annot]
1079710799
enqueueForceUpdate: function(inst, callback) {
1079810800
var fiber = get(inst);
1079910801
var eventTime = requestEventTime();
@@ -11904,6 +11906,7 @@ function createClassErrorUpdate(fiber, errorInfo, lane) {
1190411906
var inst = fiber.stateNode;
1190511907

1190611908
if (inst !== null && typeof inst.componentDidCatch === "function") {
11909+
// $FlowFixMe[missing-this-annot]
1190711910
update.callback = function callback() {
1190811911
{
1190911912
markFailedErrorBoundaryForHotReloading(fiber);
@@ -16679,7 +16682,7 @@ function readContext(context) {
1667916682

1668016683
var AbortControllerLocal =
1668116684
typeof AbortController !== "undefined"
16682-
? AbortController
16685+
? AbortController // $FlowFixMe[missing-this-annot]
1668316686
: function AbortControllerShim() {
1668416687
var listeners = [];
1668516688
var signal = (this.signal = {
@@ -23743,8 +23746,7 @@ function markRootSuspended$1(root, suspendedLanes) {
2374323746
suspendedLanes = removeLanes(
2374423747
suspendedLanes,
2374523748
workInProgressRootInterleavedUpdatedLanes
23746-
); // $FlowFixMe[incompatible-call] found when upgrading Flow
23747-
23749+
);
2374823750
markRootSuspended(root, suspendedLanes);
2374923751
} // This is the entry point for synchronous tasks that don't go
2375023752
// through Scheduler
@@ -24142,6 +24144,7 @@ function renderDidSuspendDelayIfPossible() {
2414224144
// pinged or updated while we were rendering.
2414324145
// TODO: Consider unwinding immediately, using the
2414424146
// SuspendedOnHydration mechanism.
24147+
// $FlowFixMe[incompatible-call] need null check workInProgressRoot
2414524148
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
2414624149
}
2414724150
}
@@ -25901,7 +25904,7 @@ function restorePendingUpdaters(root, lanes) {
2590125904
}
2590225905
}
2590325906
}
25904-
var fakeActCallbackNode = {};
25907+
var fakeActCallbackNode = {}; // $FlowFixMe[missing-local-annot]
2590525908

2590625909
function scheduleCallback$2(priorityLevel, callback) {
2590725910
{
@@ -27168,7 +27171,7 @@ function assignFiberPropertiesInDEV(target, source) {
2716827171
}
2716927172

2717027173
function FiberRootNode(
27171-
containerInfo,
27174+
containerInfo, // $FlowFixMe[missing-local-annot]
2717227175
tag,
2717327176
hydrate,
2717427177
identifierPrefix,

compiled/facebook-www/ReactART-prod.classic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9804,7 +9804,7 @@ var slice = Array.prototype.slice,
98049804
return null;
98059805
},
98069806
bundleType: 0,
9807-
version: "18.3.0-www-classic-0b974418c-20230106",
9807+
version: "18.3.0-www-classic-0b4f44302-20230109",
98089808
rendererPackageName: "react-art"
98099809
};
98109810
var internals$jscomp$inline_1319 = {
@@ -9835,7 +9835,7 @@ var internals$jscomp$inline_1319 = {
98359835
scheduleRoot: null,
98369836
setRefreshHandler: null,
98379837
getCurrentFiber: null,
9838-
reconcilerVersion: "18.3.0-next-0b974418c-20230106"
9838+
reconcilerVersion: "18.3.0-next-0b4f44302-20230109"
98399839
};
98409840
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
98419841
var hook$jscomp$inline_1320 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled/facebook-www/ReactART-prod.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9471,7 +9471,7 @@ var slice = Array.prototype.slice,
94719471
return null;
94729472
},
94739473
bundleType: 0,
9474-
version: "18.3.0-www-modern-0b974418c-20230106",
9474+
version: "18.3.0-www-modern-0b4f44302-20230109",
94759475
rendererPackageName: "react-art"
94769476
};
94779477
var internals$jscomp$inline_1310 = {
@@ -9502,7 +9502,7 @@ var internals$jscomp$inline_1310 = {
95029502
scheduleRoot: null,
95039503
setRefreshHandler: null,
95049504
getCurrentFiber: null,
9505-
reconcilerVersion: "18.3.0-next-0b974418c-20230106"
9505+
reconcilerVersion: "18.3.0-next-0b4f44302-20230109"
95069506
};
95079507
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95089508
var hook$jscomp$inline_1311 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

0 commit comments

Comments
 (0)