From 142b6172a94ea178ed8d0fd9ffb03a64c4dd9676 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Fri, 19 Jun 2026 06:20:42 -0700 Subject: [PATCH] Hide src/ directory from TypeScript (#57277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- packages/react-native/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/package.json b/packages/react-native/package.json index ce52edc09e9..ec26182439f 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -49,7 +49,7 @@ }, "./scripts/*": "./scripts/*", "./src/*": { - "react-native-strict-api": null, + "types": null, "default": "./src/*.js" }, "./types/*.d.ts": {