Skip to content

Commit d803f51

Browse files
authored
Upgrade to Flow 0.219.0 (#27542)
This upgrade made the `React$Element` type opaque, which is good for product code where accessing props of elements is code smell, but React needs to use that internally. I overrode the type to restore it.
1 parent 3a1967b commit d803f51

File tree

5 files changed

+50
-37
lines changed

5 files changed

+50
-37
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@
6464
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
6565
"fbjs-scripts": "^3.0.1",
6666
"filesize": "^6.0.1",
67-
"flow-bin": "^0.217.0",
68-
"flow-remove-types": "^2.217.0",
67+
"flow-bin": "^0.219.0",
68+
"flow-remove-types": "^2.219.0",
6969
"glob": "^7.1.6",
7070
"glob-stream": "^6.1.0",
7171
"google-closure-compiler": "^20230206.0.0",
7272
"gzip-size": "^5.1.1",
73-
"hermes-eslint": "^0.15.1",
74-
"hermes-parser": "^0.15.1",
73+
"hermes-eslint": "^0.17.0",
74+
"hermes-parser": "^0.17.0",
7575
"jest": "^29.4.2",
7676
"jest-cli": "^29.4.2",
7777
"jest-diff": "^29.4.2",

packages/react-server/src/ReactFizzServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,7 @@ function renderNodeDestructiveImpl(
21502150
if (typeof node === 'object' && node !== null) {
21512151
switch ((node: any).$$typeof) {
21522152
case REACT_ELEMENT_TYPE: {
2153-
const element: React$Element<any> = (node: any);
2153+
const element: any = node;
21542154
const type = element.type;
21552155
const key = element.key;
21562156
const props = element.props;

scripts/flow/config/flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ munge_underscores=false
3636
%REACT_RENDERER_FLOW_OPTIONS%
3737

3838
[version]
39-
^0.217.0
39+
^0.219.0

scripts/flow/environment.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ declare module 'create-react-class' {
3030
declare var exports: React$CreateClass;
3131
}
3232

33+
// Flow hides the props of React$Element, this overrides it to unhide
34+
// them for React internals.
35+
// prettier-ignore
36+
declare opaque type React$Element<
37+
+ElementType: React$ElementType,
38+
+P = React$ElementProps<ElementType>,
39+
>: {
40+
+type: ElementType,
41+
+props: P,
42+
+key: React$Key | null,
43+
+ref: any,
44+
};
45+
3346
declare var trustedTypes: {
3447
isHTML: (value: any) => boolean,
3548
isScript: (value: any) => boolean,

yarn.lock

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7866,22 +7866,22 @@ flatted@^3.1.0:
78667866
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
78677867
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
78687868

7869-
flow-bin@^0.217.0:
7870-
version "0.217.0"
7871-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.217.0.tgz#c255b4d8d815520d396416c2f712ab849d61f467"
7872-
integrity sha512-AbbDE6QUpR+jpY9ejNROAk0P5D/2PxJzjU4D5vfmMwtS+QjjPjzfZGuatEJIn2k4PTZ2agbncaCtyHGO0AvG7A==
7873-
7874-
flow-parser@^0.217.0:
7875-
version "0.217.0"
7876-
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.217.0.tgz#0e6bed214151fa3240dc9fd83ac8a9e050e523c5"
7877-
integrity sha512-hEa5n0dta1RcaDwJDWbnyelw07PK7+Vx0f9kDht28JOt2hXgKdKGaT3wM45euWV2DxOXtzDSTaUgGSD/FPvC2Q==
7878-
7879-
flow-remove-types@^2.217.0:
7880-
version "2.217.0"
7881-
resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.217.0.tgz#b09084445b2cd929330638d7b8f1aacaa288c43a"
7882-
integrity sha512-4NbzbbseCAnPERMhPt7cwlRjynXda/fatzHCWCRBsnGO43oqSG5PqzZKEBJXngCJuVS8M5YQrw3ad3psPTEfCQ==
7883-
dependencies:
7884-
flow-parser "^0.217.0"
7869+
flow-bin@^0.219.0:
7870+
version "0.219.0"
7871+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.219.0.tgz#193ae6551e4eccad7435b2ec0cfa455a40f38889"
7872+
integrity sha512-nX1hLdYI+mRaO5hG4acjwMni9K3KqQzt3v0pDPHKGu1lEvxEPbL3GxruFbaq8dhKR3Ntk13ptsf2krYubZ1nCw==
7873+
7874+
flow-parser@^0.219.0:
7875+
version "0.219.0"
7876+
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.219.0.tgz#c8021c080d67a16eea9ee1d1e31c40d1a22bb2fb"
7877+
integrity sha512-f1RKw+2QW4HCwCQ7qw8fTrlWmQnPIHmWDYbrMhXSSAuDbQbncY63I3Y/vwgimChGF2PT4qtXusu04R3wtCh4hw==
7878+
7879+
flow-remove-types@^2.219.0:
7880+
version "2.219.0"
7881+
resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.219.0.tgz#f349f7785e8c718b256bb8ecb1696d68675e2e86"
7882+
integrity sha512-wbY4WG+jve9pY0GsG8r5R+Wdo0PQ/HyQi/Gr8p8QIQxNyfYrRtCWICQ1kcGw60+1ufm+yKBw8bIUTv+4LYLjtA==
7883+
dependencies:
7884+
flow-parser "^0.219.0"
78857885
pirates "^3.0.2"
78867886
vlq "^0.2.1"
78877887

@@ -8611,26 +8611,26 @@ has@^1.0.1, has@^1.0.3:
86118611
dependencies:
86128612
function-bind "^1.1.1"
86138613

8614-
hermes-eslint@^0.15.1:
8615-
version "0.15.1"
8616-
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.15.1.tgz#c5919a6fdbd151febc3d5ed8ff17e5433913528c"
8617-
integrity sha512-ArfT3oASsYOkCa29GOw34GR+kpHXqrhhYgXDadK3daJBejrMPbGlUbBTzTlGBuz1CGLxxdC5lwwv3OegPJzfDA==
8614+
hermes-eslint@^0.17.0:
8615+
version "0.17.0"
8616+
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.17.0.tgz#c1bbf5e2fbf04b94539d02773421a7899b438479"
8617+
integrity sha512-SecdcgQyl3ubjl7guk6jNt5BoWtHBPXu7VqfAsZUEM0r0s897/QS5FjHFIXBMGSeqQnfun+QGBGoCQjx8NRWxg==
86188618
dependencies:
86198619
esrecurse "^4.3.0"
8620-
hermes-estree "0.15.1"
8621-
hermes-parser "0.15.1"
8620+
hermes-estree "0.17.0"
8621+
hermes-parser "0.17.0"
86228622

8623-
hermes-estree@0.15.1:
8624-
version "0.15.1"
8625-
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.15.1.tgz#d06d4ddf87e91857b0130a083a9d7696d7aec61f"
8626-
integrity sha512-XrQH+GATG/8DYbzlrVs6Vf/EDxLhYEHXvzt/Xve4b/NXXpsNLDN8bdBEKp5z0XeOMoL1XMEexxIIf1a5bH6kYA==
8623+
hermes-estree@0.17.0:
8624+
version "0.17.0"
8625+
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.17.0.tgz#4b1b0d8131826178f0af79a317ceaca3723e9012"
8626+
integrity sha512-bW9+bMZqnro+0+l6dUqTJW0VaNUvs4HRHh/J7VotTGnMmhBFRIcJz6ZxrRE7xIXmK7S5bJE9qrEooSiig4N70g==
86278627

8628-
hermes-parser@0.15.1, hermes-parser@^0.15.1:
8629-
version "0.15.1"
8630-
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.15.1.tgz#f02587be85228b22841d50f6839ae42a308e5100"
8631-
integrity sha512-38Re105dr4UZ0/EPRApWxtIOWWynQpdOYWO+7nFO8ADd2mXdaHKMCFAxIjkqACa1GLrAtrXqqaJdUYHi/QUbkA==
8628+
hermes-parser@0.17.0, hermes-parser@^0.17.0:
8629+
version "0.17.0"
8630+
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.17.0.tgz#722bb8079b9081a0de4902b770d5d45dbeb380bd"
8631+
integrity sha512-2fmppmZheY1UU071EMKAzXfuUCiDXF3fmzKLuN1XmE3+njIFs3CAeKP88+FtNBUpS6pEMJv6lPXCaJGqGsrURQ==
86328632
dependencies:
8633-
hermes-estree "0.15.1"
8633+
hermes-estree "0.17.0"
86348634

86358635
homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1:
86368636
version "1.0.3"

0 commit comments

Comments
 (0)