From d6415f6361ad1dd075b91732524e22253d83d6af Mon Sep 17 00:00:00 2001 From: Panos Vekris Date: Mon, 21 Oct 2024 19:26:02 -0700 Subject: [PATCH] pre-suppress errors before enabling experimental.object_freeze_fix Summary: X-link: https://github.com/facebook/react-native/pull/47141 D64152004 fixed a soundness hole in Flow's checking of frozen object types (e.g. try-Flow https://fburl.com/rmct2mf6). This diff suppresses Flow errors that appear when this fix is enabled (`experimental.object_freeze_fix` flag is set). For most of these cases the result of `Object.freeze()` is assigned to some variable typed as a mutable type. The variable is then passed to a context where its fields can be written to. Thus changing the annotation type to a readonly version would only cause more errors downstream. So, instead, these assignments are suppressed so that the choice of using Object.freeze can be revisited. Changelog: [internal] Reviewed By: SamChou19815 Differential Revision: D64699992 fbshipit-source-id: 48e4376d4ed3dbda21d32cabe512e6457384994f --- packages/metro/src/index.flow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/metro/src/index.flow.js b/packages/metro/src/index.flow.js index 7a701dda75..59bde2c211 100644 --- a/packages/metro/src/index.flow.js +++ b/packages/metro/src/index.flow.js @@ -377,6 +377,7 @@ exports.runBuild = async ( onComplete, onProgress, minify = true, + // $FlowFixMe[incompatible-variance] frozen objects are readonly output = outputBundle, out, platform = 'web',