Update Flow to 0.248 (#34248)
This update remove support for `%checks`. Thanks @SamChou19815 for finding a close replacement that works.
Jan Kassens committed
Aug 21, 2025 at 11:15 UTC
873f71129964350333503c039d9fa5784ea102d1
7 files changed
+40
-14
package.json
+3
-2
@@ -50,6 +50,7 @@
50
"@typescript-eslint/parser": "^6.21.0",
51
"abortcontroller-polyfill": "^1.7.5",
52
"art": "0.10.1",
53
+ "babel-plugin-syntax-hermes-parser": "^0.32.0",
54
"babel-plugin-syntax-trailing-function-commas": "^6.5.0",
55
"chalk": "^3.0.0",
56
"cli-table": "^0.3.1",
@@ -72,8 +73,8 @@
73
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
74
"fbjs-scripts": "^3.0.1",
75
"filesize": "^6.0.1",
75
- "flow-bin": "^0.247",
76
- "flow-remove-types": "^2.247",
76
+ "flow-bin": "^0.248",
77
+ "flow-remove-types": "^2.248",
78
"glob": "^7.1.6",
79
"glob-stream": "^6.1.0",
80
"google-closure-compiler": "^20230206.0.0",
packages/react-devtools-shared/babel.config.js
+1
@@ -34,6 +34,7 @@ module.exports = api => {
34
}
35
}
36
const plugins = [
37
+ ['babel-plugin-syntax-hermes-parser'],
38
['@babel/plugin-transform-flow-strip-types'],
39
['@babel/plugin-proposal-class-properties', {loose: false}],
40
];
packages/react-devtools-timeline/src/utils/flow.js
+5
-2
@@ -6,8 +6,11 @@
6
*
7
* @flow
8
*/
9
-import type {SchedulingEvent} from '../types';
9
+import type {ReactScheduleStateUpdateEvent, SchedulingEvent} from '../types';
10
11
-export function isStateUpdateEvent(event: SchedulingEvent): boolean %checks {
11
+export function isStateUpdateEvent(
12
+ event: SchedulingEvent,
13
+ // eslint-disable-next-line
14
+): event is ReactScheduleStateUpdateEvent {
15
return event.type === 'schedule-state-update';
16
}
packages/react-native-renderer/src/legacy-events/accumulate.js
+1
-2
@@ -31,8 +31,7 @@ function accumulate<T>(
31
// Both are not empty. Warning: Never call x.concat(y) when you are not
32
// certain that x is an Array (x could be a string with concat method).
33
if (isArray(current)) {
34
- /* $FlowFixMe[incompatible-return] if `current` is `T` and `T` an array,
35
- * `isArray` might refine to the array element type of `T` */
34
+ // $FlowFixMe[incompatible-use] `isArray` does not ensure array is mutable
35
return current.concat(next);
36
}
37
packages/react-native-renderer/src/legacy-events/accumulateInto.js
+2
-2
@@ -38,12 +38,12 @@ function accumulateInto<T>(
38
// certain that x is an Array (x could be a string with concat method).
39
if (isArray(current)) {
40
if (isArray(next)) {
41
- // $FlowFixMe[prop-missing] `isArray` does not ensure array is mutable
41
+ // $FlowFixMe[incompatible-use] `isArray` does not ensure array is mutable
42
// $FlowFixMe[method-unbinding]
43
current.push.apply(current, next);
44
return current;
45
}
46
- // $FlowFixMe[prop-missing] `isArray` does not ensure array is mutable
46
+ // $FlowFixMe[incompatible-use] `isArray` does not ensure array is mutable
47
current.push(next);
48
return current;
49
}
packages/shared/isArray.js
+4
-1
@@ -7,7 +7,10 @@
7
* @flow
8
*/
9
10
-declare function isArray(a: mixed): boolean %checks(Array.isArray(a));
10
+declare function isArray<T>(
11
+ v: T,
12
+ // eslint-disable-next-line
13
+): v is T extends $ReadOnlyArray<mixed> ? T : empty;
14
15
const isArrayImpl = Array.isArray;
16
yarn.lock
+24
-5
@@ -5351,6 +5351,13 @@ babel-plugin-polyfill-regenerator@^0.6.1:
5351
dependencies:
5352
"@babel/helper-define-polyfill-provider" "^0.6.3"
5353
5354
+babel-plugin-syntax-hermes-parser@^0.32.0:
5355
+ version "0.32.0"
5356
+ resolved "https://registry.yarnpkg.com/babel-plugin-syntax-hermes-parser/-/babel-plugin-syntax-hermes-parser-0.32.0.tgz#06f7452bf91adf6cafd7c98e7467404d4eb65cec"
5357
+ integrity sha512-m5HthL++AbyeEA2FcdwOLfVFvWYECOBObLHNqdR8ceY4TsEdn4LdX2oTvbB2QJSSElE2AWA/b2MXZ/PF/CqLZg==
5358
+ dependencies:
5359
+ hermes-parser "0.32.0"
5360
+
5361
babel-plugin-syntax-trailing-function-commas@^6.5.0:
5362
version "6.22.0"
5363
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3"
@@ -9101,12 +9108,12 @@ flatted@^3.2.9:
9108
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
9109
integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==
9110
9104
-flow-bin@^0.247:
9105
- version "0.247.1"
9106
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.247.1.tgz#8c8d08fcee11ca43cbb6059edb9933a29bdedc57"
9107
- integrity sha512-03wwQ5kPW4CYqhXvxTseMs2v6QuVwCtifVkON2UUyDg6Jp1+CaQpLAZK+sFNzQOExKp0Yvoug+fZOUb33ARwHQ==
9111
+flow-bin@^0.248:
9112
+ version "0.248.1"
9113
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.248.1.tgz#1d1e78ac8a1b8024dda5582b4832b605a00c16bd"
9114
+ integrity sha512-WnISMV7p4rRY2LIMGnryR7Pnml9wFs0bTdniI1Dj2dXIJigOGfV74FjhMG7BmZkuKztNxlTvK56zpuhpcne+sg==
9115
9109
-flow-remove-types@^2.247:
9116
+flow-remove-types@^2.248:
9117
version "2.279.0"
9118
resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.279.0.tgz#3a3388d9158eba0f82c40d80d31d9640b883a3f5"
9119
integrity sha512-bPFloMR/A2b/r/sIsf7Ix0LaMicCJNjwhXc4xEEQVzJCIz5u7C7XDaEOXOiqveKlCYK7DcBNn6R01Cbbc9gsYA==
@@ -9985,6 +9992,11 @@ hermes-estree@0.29.1:
9992
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.29.1.tgz#043c7db076e0e8ef8c5f6ed23828d1ba463ebcc5"
9993
integrity sha512-jl+x31n4/w+wEqm0I2r4CMimukLbLQEYpisys5oCre611CI5fc9TxhqkBBCJ1edDG4Kza0f7CgNz8xVMLZQOmQ==
9994
9995
+hermes-estree@0.32.0:
9996
+ version "0.32.0"
9997
+ resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.32.0.tgz#bb7da6613ab8e67e334a1854ea1e209f487d307b"
9998
+ integrity sha512-KWn3BqnlDOl97Xe1Yviur6NbgIZ+IP+UVSpshlZWkq+EtoHg6/cwiDj/osP9PCEgFE15KBm1O55JRwbMEm5ejQ==
9999
+
10000
hermes-parser@0.25.1, hermes-parser@^0.25.1:
10001
version "0.25.1"
10002
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.25.1.tgz#5be0e487b2090886c62bd8a11724cd766d5f54d1"
@@ -9999,6 +10011,13 @@ hermes-parser@0.29.1:
10011
dependencies:
10012
hermes-estree "0.29.1"
10013
10014
+hermes-parser@0.32.0:
10015
+ version "0.32.0"
10016
+ resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.32.0.tgz#7916984ef6fdce62e7415d354cf35392061cd303"
10017
+ integrity sha512-g4nBOWFpuiTqjR3LZdRxKUkij9iyveWeuks7INEsMX741f3r9xxrOe8TeQfUxtda0eXmiIFiMQzoeSQEno33Hw==
10018
+ dependencies:
10019
+ hermes-estree "0.32.0"
10020
+
10021
homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1:
10022
version "1.0.3"
10023
resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8"