Update Flow to 0.267 (#34272)
Changes to type inference require some more annotations.
Jan Kassens committed
Aug 22, 2025 at 15:53 UTC
06cfa99f3740c4b8c16c8d63d97b0f52d90eec43
13 files changed
+26
-26
package.json
+2
-2
@@ -74,8 +74,8 @@
74
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
75
"fbjs-scripts": "^3.0.1",
76
"filesize": "^6.0.1",
77
- "flow-bin": "^0.266",
78
- "flow-remove-types": "^2.266",
77
+ "flow-bin": "^0.267",
78
+ "flow-remove-types": "^2.267",
79
"flow-typed": "^4.1.1",
80
"glob": "^7.1.6",
81
"glob-stream": "^6.1.0",
packages/react-devtools-shared/src/backend/fiber/renderer.js
+2
-2
@@ -1317,9 +1317,9 @@ export function attach(
1317
if (componentLogsEntry === undefined) {
1318
componentLogsEntry = {
1319
errors: new Map(),
1320
- errorsCount: 0,
1320
+ errorsCount: 0 as number,
1321
warnings: new Map(),
1322
- warningsCount: 0,
1322
+ warningsCount: 0 as number,
1323
};
1324
fiberToComponentLogsMap.set(fiber, componentLogsEntry);
1325
}
packages/react-devtools-shared/src/backend/flight/renderer.js
+2
-2
@@ -118,9 +118,9 @@ export function attach(
118
if (componentLogsEntry === undefined) {
119
componentLogsEntry = {
120
errors: new Map(),
121
- errorsCount: 0,
121
+ errorsCount: 0 as number,
122
warnings: new Map(),
123
- warningsCount: 0,
123
+ warningsCount: 0 as number,
124
};
125
componentInfoToComponentLogsMap.set(componentInfo, componentLogsEntry);
126
}
packages/react-reconciler/src/ReactFiberApplyGesture.js
+4
-4
@@ -488,7 +488,7 @@ function recursivelyInsertNewFiber(
488
const viewTransitionState: ViewTransitionState = finishedWork.stateNode;
489
// TODO: If this was already cloned by a previous pass we can reuse those clones.
490
viewTransitionState.clones = null;
491
- let nextPhase;
491
+ let nextPhase: VisitPhase;
492
if (visitPhase === INSERT_EXIT) {
493
// This was an Enter of a ViewTransition. We now move onto inserting the inner
494
// HostComponents and finding inner pairs.
@@ -637,7 +637,7 @@ function recursivelyInsertClonesFromExistingTree(
637
// So we need it to be cleared before we do that.
638
// TODO: Use some other temporary state to track this.
639
child.flags &= ~Update;
640
- let nextPhase;
640
+ let nextPhase: VisitPhase;
641
if (visitPhase === CLONE_EXIT) {
642
// This was an Enter of a ViewTransition. We now move onto unhiding the inner
643
// HostComponents and finding inner pairs.
@@ -894,7 +894,7 @@ function insertDestinationClonesOfFiber(
894
// Only insert clones if this tree is going to be visible. No need to
895
// clone invisible content.
896
// TODO: If this is visible but detached it should still be cloned.
897
- let nextPhase;
897
+ let nextPhase: VisitPhase;
898
if (visitPhase === CLONE_UPDATE && (flags & Visibility) !== NoFlags) {
899
// This is the root of an appear. We need to trigger Enter transitions.
900
nextPhase = CLONE_EXIT;
@@ -922,7 +922,7 @@ function insertDestinationClonesOfFiber(
922
const viewTransitionState: ViewTransitionState = finishedWork.stateNode;
923
// TODO: If this was already cloned by a previous pass we can reuse those clones.
924
viewTransitionState.clones = null;
925
- let nextPhase;
925
+ let nextPhase: VisitPhase;
926
if (visitPhase === CLONE_EXIT) {
927
// This was an Enter of a ViewTransition. We now move onto unhiding the inner
928
// HostComponents and finding inner pairs.
packages/react-reconciler/src/ReactFiberCacheComponent.js
+1
-1
@@ -25,7 +25,7 @@ const AbortControllerLocal: typeof AbortController =
25
function AbortControllerShim() {
26
const listeners = [];
27
const signal = (this.signal = {
28
- aborted: false,
28
+ aborted: false as boolean,
29
addEventListener: (type, listener) => {
30
listeners.push(listener);
31
},
packages/react-reconciler/src/ReactFiberHooks.js
+2
-2
@@ -1208,7 +1208,7 @@ function useMemoCache(size: number): Array<mixed> {
1208
? currentMemoCache.data
1209
: // Clone the memo cache before each render (copy-on-write)
1210
currentMemoCache.data.map(array => array.slice()),
1211
- index: 0,
1211
+ index: 0 as number,
1212
};
1213
}
1214
}
@@ -1218,7 +1218,7 @@ function useMemoCache(size: number): Array<mixed> {
1218
if (memoCache == null) {
1219
memoCache = {
1220
data: [],
1221
- index: 0,
1221
+ index: 0 as number,
1222
};
1223
}
1224
if (updateQueue === null) {
packages/react-reconciler/src/ReactFiberWorkLoop.js
+3
-3
@@ -1060,7 +1060,7 @@ export function performWorkOnRoot(
1060
// even for regular pings.
1061
checkIfRootIsPrerendering(root, lanes);
1062
1063
- let exitStatus = shouldTimeSlice
1063
+ let exitStatus: RootExitStatus = shouldTimeSlice
1064
? renderRootConcurrent(root, lanes)
1065
: renderRootSync(root, lanes, true);
1066
@@ -1212,7 +1212,7 @@ function recoverFromConcurrentError(
1212
root: FiberRoot,
1213
originallyAttemptedLanes: Lanes,
1214
errorRetryLanes: Lanes,
1215
-) {
1215
+): RootExitStatus {
1216
// If an error occurred during hydration, discard server response and fall
1217
// back to client side render.
1218
@@ -2520,7 +2520,7 @@ function workLoopSync() {
2520
}
2521
}
2522
2523
-function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
2523
+function renderRootConcurrent(root: FiberRoot, lanes: Lanes): RootExitStatus {
2524
const prevExecutionContext = executionContext;
2525
executionContext |= RenderContext;
2526
const prevDispatcher = pushDispatcher(root.containerInfo);
packages/react-server/src/ReactFlightReplyServer.js
+1
-1
@@ -556,7 +556,7 @@ function createModelResolver<T>(
556
}
557
} else {
558
blocked = initializingChunkBlockedModel = {
559
- deps: cyclic ? 0 : 1,
559
+ deps: (cyclic ? 0 : 1) as number,
560
value: (null: any),
561
};
562
}
packages/scheduler/src/forks/Scheduler.js
+1
-1
@@ -283,7 +283,7 @@ function unstable_runWithPriority<T>(
283
}
284
285
function unstable_next<T>(eventHandler: () => T): T {
286
- var priorityLevel;
286
+ var priorityLevel: PriorityLevel;
287
switch (currentPriorityLevel) {
288
case ImmediatePriority:
289
case UserBlockingPriority:
packages/scheduler/src/forks/SchedulerMock.js
+1
-1
@@ -286,7 +286,7 @@ function unstable_runWithPriority<T>(
286
}
287
288
function unstable_next<T>(eventHandler: () => T): T {
289
- var priorityLevel;
289
+ var priorityLevel: PriorityLevel;
290
switch (currentPriorityLevel) {
291
case ImmediatePriority:
292
case UserBlockingPriority:
packages/scheduler/src/forks/SchedulerPostTask.js
+1
-1
@@ -196,7 +196,7 @@ export function unstable_getCurrentPriorityLevel(): PriorityLevel {
196
}
197
198
export function unstable_next<T>(callback: () => T): T {
199
- let priorityLevel;
199
+ let priorityLevel: PriorityLevel;
200
switch (currentPriorityLevel_DEPRECATED) {
201
case ImmediatePriority:
202
case UserBlockingPriority:
packages/shared/ReactPerformanceTrackProperties.js
+1
-1
@@ -19,7 +19,7 @@ const COMPLEX_ARRAY = 1;
19
const PRIMITIVE_ARRAY = 2; // Primitive values only
20
const ENTRIES_ARRAY = 3; // Tuple arrays of string and value (like Headers, Map, etc)
21
function getArrayKind(array: Object): 0 | 1 | 2 | 3 {
22
- let kind = EMPTY_ARRAY;
22
+ let kind: 0 | 1 | 2 | 3 = EMPTY_ARRAY;
23
for (let i = 0; i < array.length; i++) {
24
const value = array[i];
25
if (typeof value === 'object' && value !== null) {
yarn.lock
+5
-5
@@ -9298,12 +9298,12 @@ flatted@^3.2.9:
9298
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
9299
integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==
9300
9301
-flow-bin@^0.266:
9302
- version "0.266.1"
9303
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.266.1.tgz#8939be6fbd681c4ef8dc4873b22f4b79be76cb0a"
9304
- integrity sha512-c1lg1E8SDcuPSkrOeH0JTcNKMZOzXvqX2DuuXJ0amZec15uyuIi8QlGTO3OzYssMT/kwFdo5vviJqSUI/BNFbw==
9301
+flow-bin@^0.267:
9302
+ version "0.267.0"
9303
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.267.0.tgz#a191375df35c768f1afaebfd0e25b06c8ab82a04"
9304
+ integrity sha512-NsBcxdAqQauzgOaDf960M+eEnjcFS6FeMs93dEpkvQflwMlP4SRMdKQR8p5WzJJh07CXq9iQnxn+JjLN6kaLUw==
9305
9306
-flow-remove-types@^2.266:
9306
+flow-remove-types@^2.267:
9307
version "2.279.0"
9308
resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.279.0.tgz#3a3388d9158eba0f82c40d80d31d9640b883a3f5"
9309
integrity sha512-bPFloMR/A2b/r/sIsf7Ix0LaMicCJNjwhXc4xEEQVzJCIz5u7C7XDaEOXOiqveKlCYK7DcBNn6R01Cbbc9gsYA==