Hide src/ directory from TypeScript (#57277)

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

**Motivation**

Incremental progress towards restricting React Native's internal JavaScript source code.

- `src/private/` was added relatively recently, with very little OSS code depending on it — we can action earlier.
- Helps to reduce the increasingly complicated state of our root `"exports"` map.

**Changes**

Resolve to `null` for the `"types"` package exports condition — this hides from TypeScript suggestions/auto-import.

- **Breaking**: TypeScript's language server will no longer be able to see these modules, and projects will need a `// $TSIgnore` on these imports.
- The ability to access these modules is unchanged: they remain present in the bundle and accessible by Metro.

Changelog:
[General][Breaking] - Deep imports to `'react-native/src/private/...'` have been restricted, and are no longer visible to TypeScript. These subpaths still exist, but do not have type coverage.

Reviewed By: rubennorte

Differential Revision: D109018821

fbshipit-source-id: bcf6abb1cce481021edee2305a875123694a8134
This commit is contained in:
Alex Hunt authored and meta-codesync[bot] committed 2026-06-19 06:20:42 -07:00
1 parent cd0d93ac2a
commit 142b6172a9
1 file changed
+1 -1
+1 -1
View File
@@ -49,7 +49,7 @@
},
"./scripts/*": "./scripts/*",
"./src/*": {
"react-native-strict-api": null,
"types": null,
"default": "./src/*.js"
},
"./types/*.d.ts": {