-
Notifications
You must be signed in to change notification settings - Fork 24.6k
Define "react-native-strict-api" type exports #50909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This pull request was exported from Phabricator. Differential Revision: D71969602 |
Summary: Enables and maps the `types_generated/` directory for `react-native` and `react-native/virtualized-lists` — exposing the new Strict TypeScript API entry points to React Native. **New `"exports"` conditions** - `"react-native-strict-api"` — The Strict TypeScript API opt in, exposing the `index.d.ts` entry point only. - `"react-native-strict-api-UNSAFE-ALLOW-SUBPATHS"` — Opts into the new from-source generated types, but allows accessing subpaths (unsafe). - We intend for this unsafe condition to be an escape hatch for Frameworks only (i.e. Expo). Note: In the case of `virtualized-lists`, we simply use the `"types"` condition — since this package did not expose any TypeScript API previously. NOTE: Should we need to roll back JS Stable API phase 1, **this is the single diff to revert**. Changelog: [General][Added] - Configure the "react-native-strict-api" opt in for our next-gen TypeScript API Differential Revision: D71969602
ed39e16
to
c80dcde
Compare
This pull request was exported from Phabricator. Differential Revision: D71969602 |
Summary: Pull Request resolved: facebook#50909 Enables and maps the `types_generated/` directory for `react-native` and `react-native/virtualized-lists` — exposing the new Strict TypeScript API entry points to React Native. **New `"exports"` conditions** - `"react-native-strict-api"` — The Strict TypeScript API opt in, exposing the `index.d.ts` entry point only. - `"react-native-strict-api-UNSAFE-ALLOW-SUBPATHS"` — Opts into the new from-source generated types, but allows accessing subpaths (unsafe). - We intend for this unsafe condition to be an escape hatch for Frameworks only (i.e. Expo). Note: In the case of `virtualized-lists`, we simply use the `"types"` condition — since this package did not expose any TypeScript API previously. NOTE: Should we need to roll back JS Stable API phase 1, **this is the single diff to revert**. Changelog: [General][Added] - Configure the "react-native-strict-api" opt in for our next-gen TypeScript API Differential Revision: D71969602
c80dcde
to
1d5f5af
Compare
Summary: NOTE: Resubmission of D71968187. Define `"exports"` field on the main `react-native` package. **Notes** Module resolution should be equivalent to the previous implicit `"main"` field (backwards compatible). - Exports all module subpaths to JavaScript (Flow) source files, with and without `.js` suffix (unchanged ✅) - These are restricted to the `flow/` and `Libraries/` subdirectories (ℹ️ this should be unchanged, matching any JS imports apps may have today) - Still includes 3P integration scripts such as `./jest-preset.js` and `./rn-get-polyfills.js` (unchanged ✅) - Exports `./package.json` (unchanged ✅) - TypeScript should: - fall back to the `"types"` field (unchanged ✅) - OR to `"."`,`"./*"` when Package Exports support is enabled via `compilerOptions`, and use the *adjacent `.d.ts` file* (unchanged ✅) Changelog: [General][Breaking] - The `react-native` package now defines package.json `"exports"`. - While these expose existing JavaScript and TypeScript modules, this change may affect deep imports of non-JS files via Node in third party tools. - Imports from `src/` and `src/private/` directories are disallowed. Differential Revision: D72228547
1d5f5af
to
4dd8963
Compare
Summary: Enables and maps the `types_generated/` directory for `react-native` and `react-native/virtualized-lists` — exposing the new Strict TypeScript API entry points to React Native. **New `"exports"` conditions** - `"react-native-strict-api"` — The Strict TypeScript API opt in, exposing the `index.d.ts` entry point only. - `"react-native-strict-api-UNSAFE-ALLOW-SUBPATHS"` — Opts into the new from-source generated types, but allows accessing subpaths (unsafe). - We intend for this unsafe condition to be an escape hatch for Frameworks only (i.e. Expo). Note: In the case of `virtualized-lists`, we simply use the `"types"` condition — since this package did not expose any TypeScript API previously. NOTE: Should we need to roll back JS Stable API phase 1, **this is the single diff to revert**. Changelog: [General][Added] - Configure the "react-native-strict-api" opt in for our next-gen TypeScript API Differential Revision: D71969602
Summary: Pull Request resolved: facebook#50909 Enables and maps the `types_generated/` directory for `react-native` and `react-native/virtualized-lists` — exposing the new Strict TypeScript API entry points to React Native. **New `"exports"` conditions** - `"react-native-strict-api"` — The Strict TypeScript API opt in, exposing the `index.d.ts` entry point only. - `"react-native-strict-api-UNSAFE-ALLOW-SUBPATHS"` — Opts into the new from-source generated types, but allows accessing subpaths (unsafe). - We intend for this unsafe condition to be an escape hatch for Frameworks only (i.e. Expo). Note: In the case of `virtualized-lists`, we simply use the `"types"` condition — since this package did not expose any TypeScript API previously. NOTE: Should we need to roll back JS Stable API phase 1, **this is the single diff to revert**. Changelog: [General][Added] - Configure the "react-native-strict-api" opt in for our next-gen TypeScript API Differential Revision: D71969602
This pull request was exported from Phabricator. Differential Revision: D71969602 |
4dd8963
to
c892fed
Compare
This pull request has been merged in 6ea24f7. |
This pull request was successfully merged by @huntie in 6ea24f7 When will my fix make it into a release? | How to file a pick request? |
Summary:
Enables and maps the
types_generated/
directory forreact-native
andreact-native/virtualized-lists
— exposing the new Strict TypeScript API entry points to React Native.New
"exports"
conditions"react-native-strict-api"
— The Strict TypeScript API opt in, exposing theindex.d.ts
entry point only."react-native-strict-api-UNSAFE-ALLOW-SUBPATHS"
— Opts into the new from-source generated types, but allows accessing subpaths (unsafe).Note: In the case of
virtualized-lists
, we simply use the"types"
condition — since this package did not expose any TypeScript API previously.NOTE: Should we need to roll back JS Stable API phase 1, this is the single diff to revert.
Changelog:
[General][Added] - Configure the "react-native-strict-api" opt in for our next-gen TypeScript API
Differential Revision: D71969602