Skip to content

Commit 2a052d1

Browse files
huntiefacebook-github-bot
authored andcommitted
Hide src/ directory from TypeScript (react#57277)
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
1 parent 5bdecc6 commit 2a052d1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"./scripts/*": "./scripts/*",
5151
"./src/*": {
52-
"react-native-strict-api": null,
52+
"types": null,
5353
"default": "./src/*.js"
5454
},
5555
"./types/*.d.ts": {

0 commit comments

Comments
 (0)