From 5370347f54719f318a4e032aba6cbf2269e7c3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateo=20Guzm=C3=A1n?= Date: Tue, 17 Dec 2024 06:08:43 -0800 Subject: [PATCH] Upgrading `typescript-config` module version to `esnext` (#48230) Summary: Fixes https://github.com/facebook/react-native/issues/45810 Upgrading `typescript-config` module version from `es2015` to `esnext`, in order to support dynamic imports. ## Changelog: [GENERAL] [CHANGED] - Upgrading `typescript-config` module version to `esnext` Pull Request resolved: https://github.com/facebook/react-native/pull/48230 Test Plan: Create a new React Native project: ```bash npx react-native-community/cli@latest init AwesomeProject ``` Copy the changes in the reproducer from the linked issue and add a lazy import: ```tsx const LazyAssetExample = React.lazy(() => import('./components/AssetExample')); ``` See the error when running `yarn tsc`: image --- To fix the error, apply the following patch: ```patch diff --git a/node_modules/react-native/typescript-config/tsconfig.json b/node_modules/react-native/typescript-config/tsconfig.json index d5e1bce..51f54c1 100644 --- a/node_modules/react-native/typescript-config/tsconfig.json +++ b/node_modules/react-native/typescript-config/tsconfig.json @@ -3,7 +3,7 @@ "display": "React Native", "compilerOptions": { "target": "esnext", - "module": "es2015", + "module": "esnext", "types": ["react-native", "jest"], "lib": [ "es2019", ``` Verify it is fix by running `yarn tsc` again Reviewed By: cipolleschi Differential Revision: D67334277 Pulled By: NickGerleman fbshipit-source-id: d26525023ff6fcfff651d1e4cee48ab2854b8d83 --- packages/typescript-config/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-config/tsconfig.json b/packages/typescript-config/tsconfig.json index d5e1bce7990fe0..51f54c117fecb7 100644 --- a/packages/typescript-config/tsconfig.json +++ b/packages/typescript-config/tsconfig.json @@ -3,7 +3,7 @@ "display": "React Native", "compilerOptions": { "target": "esnext", - "module": "es2015", + "module": "esnext", "types": ["react-native", "jest"], "lib": [ "es2019",