Skip to content

Commit

Permalink
pre-suppress errors before enabling experimental.object_freeze_fix
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/react-native#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
  • Loading branch information
panagosg7 authored and facebook-github-bot committed Oct 22, 2024
1 parent add4c76 commit d6415f6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/metro/src/index.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ exports.runBuild = async (
onComplete,
onProgress,
minify = true,
// $FlowFixMe[incompatible-variance] frozen objects are readonly
output = outputBundle,
out,
platform = 'web',
Expand Down

0 comments on commit d6415f6

Please sign in to comment.