From cd4016614b73a7abdb6856ae0a58202c10dff135 Mon Sep 17 00:00:00 2001 From: George Zahariev Date: Thu, 12 Nov 2026 04:05:05 -0800 Subject: [PATCH] Upgrade Flow to 0.340.0 (#59961) Summary: X-link: https://github.com/meta/relay/pull/5447 Pull Request resolved: https://github.com/react/react-native/pull/59961 X-link: https://github.com/react/metro/pull/2222 Upgrade the Flow typechecker to 0.340.0 in React Native, Metro, and Relay. Update version constraints and dependency lockfiles, keep the shared Node.js declarations synchronized, and preserve compatibility with the new checker. Runtime behavior and public API signatures are unchanged. [changelog](https://github.com/facebook/flow/blob/main/Changelog.md) Changelog: [Internal] @public Reviewed By: javache Differential Revision: D131463913 --- .flowconfig | 2 +- flow-typed/environment/node.js | 12 +++++------- package.json | 2 +- .../react-native/Libraries/ReactNative/UIManager.js | 1 + .../Libraries/Utilities/FeatureDetection.js | 1 + yarn.lock | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.flowconfig b/.flowconfig index 383f91137f54..2b273f8cbbb4 100644 --- a/.flowconfig +++ b/.flowconfig @@ -97,4 +97,4 @@ untyped-import untyped-type-import [version] -^0.338.0 +^0.340.0 diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index e1bd0da5fd44..633238bf8f06 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -3747,6 +3747,7 @@ type duplexStreamOptions = writableStreamOptions & writableHighWaterMark?: number, ... }; +// prettier-ignore declare class stream$Duplex extends stream$Readable mixins stream$Writable { // This is an unusual class at runtime, per the docs it "prototypally extends from Readable, // and then parasitically from Writable." Its static methods have incompatible signatures @@ -3755,13 +3756,10 @@ declare class stream$Duplex extends stream$Readable mixins stream$Writable { // $FlowFixMe[incompatible-exact] See above // $FlowFixMe[incompatible-type] See above - static fromWeb( - pair: Readonly<{ - readable: ReadableStream, - writable: WritableStream, - }>, - options?: duplexStreamOptions, - ): this; + static fromWeb(pair: Readonly<{ + readable: ReadableStream, + writable: WritableStream, + }>, options?: duplexStreamOptions): this; // $FlowFixMe[incompatible-type] See above static toWeb(streamDuplex: stream$Duplex): { diff --git a/package.json b/package.json index d3a3a82cb0dc..1a3d1a77c884 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "eslint-plugin-relay": "^1.8.3", "fb-dotslash": "0.5.8", "flow-api-translator": "0.336.0", - "flow-bin": "^0.338.0", + "flow-bin": "^0.340.0", "flow-eslint": "0.336.0", "flow-parser": "0.336.0", "flow-transform": "0.336.0", diff --git a/packages/react-native/Libraries/ReactNative/UIManager.js b/packages/react-native/Libraries/ReactNative/UIManager.js index 89b64ea3916e..82da82a4e00a 100644 --- a/packages/react-native/Libraries/ReactNative/UIManager.js +++ b/packages/react-native/Libraries/ReactNative/UIManager.js @@ -254,6 +254,7 @@ const UIManagerOverrides = { // $FlowFixMe[incompatible-type] Flow cannot infer properties from descriptors. const UIManager: UIManagerJSInterface = Object.create( Object.getPrototypeOf(UIManagerImpl), + // $FlowFixMe[cannot-spread-interface] { ...Object.getOwnPropertyDescriptors( // $FlowFixMe[class-object-subtyping] UIManagerImpl is a runtime object. diff --git a/packages/react-native/Libraries/Utilities/FeatureDetection.js b/packages/react-native/Libraries/Utilities/FeatureDetection.js index 3429a76f04ab..6dafbff0bd10 100644 --- a/packages/react-native/Libraries/Utilities/FeatureDetection.js +++ b/packages/react-native/Libraries/Utilities/FeatureDetection.js @@ -30,5 +30,6 @@ export function hasNativeConstructor( expectedName: string, ): boolean { const con = Object.getPrototypeOf(o).constructor; + // $FlowFixMe[incompatible-type] return con.name === expectedName && isNativeFunction(con); } diff --git a/yarn.lock b/yarn.lock index c10cda8b8734..e10440d14d52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4855,10 +4855,10 @@ flow-api-translator@0.336.0: flow-transform "0.336.0" typescript "5.3.2" -flow-bin@^0.338.0: - version "0.338.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.338.0.tgz#6c0ca72133b54d89681f13c0b742c1b6b01a51cd" - integrity sha512-Ksy1gAdQd8l3//HvNrL8J5A6h3yxSMqvKStokgRKXCXEqsq8apKY0yyupGrO3nYEimd2/xjlJBd2wFuBKpMzwA== +flow-bin@^0.340.0: + version "0.340.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.340.0.tgz#f3edbe6f235c9bc9ff735e5cae1dc8b0a96d55f7" + integrity sha512-XourZh2487go6B2RTIssruf5iH1rVATg7IdE8CGfMbey/93RJR5HTsqQEgVK33lmGhew8fTRLZmeSEyMVubMpw== flow-enums-runtime@^0.0.6: version "0.0.6"