Hide src/ directory from TypeScript (#57277)#57277
Closed
huntie wants to merge 3 commits into
Closed
Conversation
|
@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109018821. |
f56cc90 to
2a052d1
Compare
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 18, 2026
Summary: **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. Differential Revision: D109018821
Summary: `interface.js` was a legacy, Flow-only entry point whose sole content was a bare `declare var __DEV__: boolean;` global, registered as a Flow `[libs]` file. Relocate into `flow/globals.js`, allowing us to drop this from the package `"files"` (and `"exports"`) list. Changelog: [Internal] Differential Revision: D109018822
Summary: Simplify `"exports"` mapping on the `react-native` package by replacing the `"./*"` wildcard export with explicit listed subpaths (invert from blocklist to allowlist). These changes are **non-breaking** — the net accessible exports subpaths before/after are equivalent. Changelog: [Internal] Differential Revision: D109018823
Summary: **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. Differential Revision: D109018821
2a052d1 to
567f264
Compare
|
This pull request has been merged in 142b617. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
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."exports"map.Changes
Resolve to
nullfor the"types"package exports condition — this hides from TypeScript suggestions/auto-import.// $TSIgnoreon these imports.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.Differential Revision: D109018821