Skip to content

Commit 74ecfeb

Browse files
committed
Update TypeScript docs to include moduleResolution: bundler
1 parent 0d93eab commit 74ecfeb

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Diff for: versioned_docs/version-7.x/typescript.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import TabItem from '@theme/TabItem';
99

1010
React Navigation can be configured to type-check screens and their params, as well as various other APIs using TypeScript. This provides better intelliSense and type safety when working with React Navigation.
1111

12-
:::note
13-
14-
React Navigation is designed to work with [`strict`](https://www.typescriptlang.org/tsconfig/#strict) mode in TypeScript. If you are not using `strict` mode, some things might not work as expected.
12+
For React Navigation to work correctly with TypeScript, make sure you have the following configuration in your `tsconfig.json` under `compilerOptions`:
1513

16-
:::
14+
- `strict: true` or `strictNullChecks: true` - IntelliSense and type inference may not work correctly without strict mode.
15+
- `moduleResolution: "bundler"` - This is necessary to resolve the types correctly and match [Metro](https://metrobundler.dev/) and other bundler's behavior.
1716

1817
<Tabs groupId="config" queryString="config">
1918
<TabItem value="static" label="Static" default>

Diff for: versioned_docs/version-7.x/upgrading-from-6.x.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ All the packages in React Navigation now use ESM exports. While it shouldn't aff
573573

574574
- If you are importing internal files from the packages, they might now be restricted by your bundler and it won't be possible to import them directly. You should use the public API instead.
575575
- If you're patching the packages using `patch-package`, `yarn patch` etc., you'll need to patch the built files under `lib/` folders instead of the source files under `src/` as the source files are no longer exported.
576-
- If you're using TypeScript with the `module` or `moduleResolution` option, it maybe necessary to set `moduleResolution` to `Bundler` to match [Metro's resolution behavior](https://reactnative.dev/blog/2023/06/21/package-exports-support#enabling-package-exports-beta).
576+
- If you're using TypeScript with the `module` or `moduleResolution` option, it maybe necessary to set `moduleResolution` to `bundler` to match [Metro's resolution behavior](https://reactnative.dev/blog/2023/06/21/package-exports-support#enabling-package-exports-beta).
577577
- If you're using Webpack for bundling code using React Navigation, it maybe necessary to set [`resolve.fullySpecified`](https://webpack.js.org/configuration/module/#resolvefullyspecified) to `false` for bundling to work.
578578

579579
## New features

0 commit comments

Comments
 (0)