diff --git a/.flowconfig b/.flowconfig index 121a945c79..fb41bcb0b1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -7,6 +7,7 @@ packages/*/build/** # this transient dep bundles tests with their package, which flow attempts to parse # and crashes out as the test includes purposely malformed json **/node_modules/resolve/test/** +**/node_modules/invariant/** [options] emoji=true @@ -37,4 +38,4 @@ untyped-import untyped-type-import [version] -^0.336.0 +^0.337.0 diff --git a/flow-typed/npm/invariant_v2.x.x.js b/flow-typed/npm/invariant_v2.x.x.js new file mode 100644 index 0000000000..74cb0815af --- /dev/null +++ b/flow-typed/npm/invariant_v2.x.x.js @@ -0,0 +1,23 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +declare module 'invariant' { + declare module.exports: ( + condition: unknown, + format?: string, + ...args: Array + ) => asserts condition; +} + +declare module 'invariant/invariant' { + import typeof Invariant from 'invariant'; + + declare module.exports: Invariant; +} diff --git a/package.json b/package.json index d45f5cb23b..5832c4494b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "eslint-plugin-react": "^7.37.5", "eslint-plugin-relay": "^1.8.3", "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", "invariant": "^2.2.4", diff --git a/packages/metro-file-map/src/__tests__/addRoot-test.js b/packages/metro-file-map/src/__tests__/addRoot-test.js index 43b0789a59..1c9da13a62 100644 --- a/packages/metro-file-map/src/__tests__/addRoot-test.js +++ b/packages/metro-file-map/src/__tests__/addRoot-test.js @@ -392,6 +392,7 @@ describe('FileMap.addRoot', () => { await fileMap.build(); await fileMap.addRoot(EXTERNAL_DIR); const stopWatching = jest.spyOn( + // $FlowFixMe[incompatible-type] Flow 0.337 mockWatchers.get(EXTERNAL_DIR), 'stopWatching', ); diff --git a/yarn.lock b/yarn.lock index 9d917b3c28..efa336307d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3307,10 +3307,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"