From 1fd5298483ec7ac3b58a6699bf728ea4302cda60 Mon Sep 17 00:00:00 2001 From: Panos Vekris Date: Thu, 22 Oct 2026 10:01:11 -0700 Subject: [PATCH] Upgrade Flow to 0.337.0 (#59326) Summary: X-link: https://github.com/facebook/relay/pull/5432 Upgrade Flow to 0.337.0 across Metro, React Native, and Relay. Flow 0.337 no longer special-cases `invariant`, so give `invariant` an `asserts` signature in the Metro and Relay Flow configs, matching React Native. Add targeted suppressions for the remaining new Flow 0.337 errors. Pull Request resolved: https://github.com/react/react-native/pull/59326 X-link: https://github.com/react/metro/pull/2086 [changelog](https://github.com/facebook/flow/blob/main/Changelog.md) Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D126755886 --- .flowconfig | 5 +---- flow-typed/npm/rxjs_v6.x.x.js | 1 + package.json | 2 +- .../src/private/animated/__tests__/AnimatedNative-test.js | 1 + yarn.lock | 8 ++++---- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.flowconfig b/.flowconfig index aff40b161f8d..22d54b035acf 100644 --- a/.flowconfig +++ b/.flowconfig @@ -53,9 +53,6 @@ experimental.multi_platform=true experimental.multi_platform.extensions=.ios experimental.multi_platform.extensions=.android -experimental.assertion_functions=true -experimental.disable_invariant_special_casing=true - munge_underscores=true module.name_mapper='^react-native$' -> '/packages/react-native/index.js' @@ -100,4 +97,4 @@ untyped-import untyped-type-import [version] -^0.336.0 +^0.337.0 diff --git a/flow-typed/npm/rxjs_v6.x.x.js b/flow-typed/npm/rxjs_v6.x.x.js index 4a5dbbd319b7..5653b05c25c5 100644 --- a/flow-typed/npm/rxjs_v6.x.x.js +++ b/flow-typed/npm/rxjs_v6.x.x.js @@ -297,6 +297,7 @@ declare class rxjs$Subject hasError: boolean; thrownError: any; constructor(): void; + // $FlowFixMe[incompatible-type] Flow 0.337 static create: Function; lift(operator: rxjs$Operator): rxjs$Observable; next(value?: T): void; diff --git a/package.json b/package.json index e4feea525408..0c43364ce1f9 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "eslint-plugin-relay": "^1.8.3", "fb-dotslash": "0.5.8", "flow-api-translator": "0.336.0", - "flow-bin": "^0.336.0", + "flow-bin": "^0.337.0", "flow-eslint": "0.336.0", "flow-parser": "0.336.0", "flow-transform": "0.336.0", diff --git a/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js b/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js index 81ec870e4871..f6b315d43915 100644 --- a/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js +++ b/packages/react-native/src/private/animated/__tests__/AnimatedNative-test.js @@ -97,6 +97,7 @@ describe('Native Animated', () => { await create(); expect(ref.current).not.toBeNull(); + // $FlowFixMe[incompatible-type] Flow 0.337 jest.spyOn(ref.current, 'setNativeProps'); opacity.setValue(0.5); diff --git a/yarn.lock b/yarn.lock index 1bf0a61a9090..559a0bd783b6 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.336.0: - version "0.336.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.336.0.tgz#ac946f9cdf134b83ab4f7a98a0de34324f6b94f4" - integrity sha512-I5sPg/GISpXH4W14eGWgiIsrDKY0uvvvXjlEDOI2t0pguEwbMgpnaYzMMMBoHZcYYtNJIF/0eGsbPnN7uP2zOQ== +flow-bin@^0.337.0: + version "0.337.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.337.0.tgz#419252403924033308160351e95f723bcf42597c" + integrity sha512-rpr+WvY30RdXPNHbioErMM8tLKUOKJ8/neXPpsDYRBp9z7WDkl4bpTBUMZiqh9ozfdcDWEACBTXwIl94h/ZA0A== flow-enums-runtime@^0.0.6: version "0.0.6"