Enable assertion functions in React Native GitHub (#59090)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59090

Enable `experimental.assertion_functions` and `experimental.disable_invariant_special_casing` in `react-native-github/.github.flowconfig`.

Add local libdefs for `invariant` and `invariant/invariant` returning `asserts condition`, and ignore `node_modules/invariant/**` so the package's own types cannot override them.

Changelog: [Internal]

___

landed-with-radar-review

Differential Revision: D125271821

fbshipit-source-id: 23672b08893644b38fa00dc378eb72c435912604
This commit is contained in:
Panos Vekris authored and meta-codesync[bot] committed 2026-10-14 15:09:19 -07:00
1 parent 6671827cda
commit 7f5df1da2d
2 files changed
+27

No files matched your search

+4
View File
@@ -16,6 +16,7 @@ packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModul
**/*.windows.js
**/node_modules/resolve/test/resolver/malformed_package_json/package.json
**/node_modules/invariant/**
; Checked-in build output
packages/debugger-frontend/dist/**
@@ -52,6 +53,9 @@ 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$' -> '<PROJECT_ROOT>/packages/react-native/index.js'
+23
View File
@@ -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<unknown>
) => asserts condition;
}
declare module 'invariant/invariant' {
import typeof Invariant from 'invariant';
declare module.exports: Invariant;
}