diff --git a/packages/react-native/template/package.json b/packages/react-native/template/package.json index 32ab161c21b408..858aba4e8f1728 100644 --- a/packages/react-native/template/package.json +++ b/packages/react-native/template/package.json @@ -19,7 +19,7 @@ "@babel/runtime": "^7.12.5", "@react-native/eslint-config": "^0.73.0", "@react-native/metro-config": "^0.73.0", - "@tsconfig/react-native": "^3.0.0", + "@react-native/typescript-config": "^0.73.0", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", diff --git a/packages/react-native/template/tsconfig.json b/packages/react-native/template/tsconfig.json index 45a6c707223871..304ab4e2d83d02 100644 --- a/packages/react-native/template/tsconfig.json +++ b/packages/react-native/template/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "@tsconfig/react-native/tsconfig.json" + "extends": "@react-native/typescript-config/tsconfig.json" } diff --git a/packages/typescript-config/README.md b/packages/typescript-config/README.md new file mode 100644 index 00000000000000..baa6d6a1581724 --- /dev/null +++ b/packages/typescript-config/README.md @@ -0,0 +1,5 @@ +# @react-native/typescript-config + +This package provides the default `tsconfig.json` used by newly built React Native apps. + +This template is customized for specific versions of React Native, and should be updated in sync with the rest of your app. diff --git a/packages/typescript-config/package.json b/packages/typescript-config/package.json new file mode 100644 index 00000000000000..896de154d849f7 --- /dev/null +++ b/packages/typescript-config/package.json @@ -0,0 +1,15 @@ +{ + "name": "@react-native/typescript-config", + "version": "0.73.0", + "description": "Default TypeScript configuration for React Native apps", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/facebook/react-native.git", + "directory": "packages/typescript-config" + }, + "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/typescript-config#readme", + "keywords": ["typescript", "tsconfig", "react-native"], + "bugs": "https://github.com/facebook/react-native/issues", + "main": "tsconfig.json" +} diff --git a/packages/typescript-config/tsconfig.json b/packages/typescript-config/tsconfig.json new file mode 100644 index 00000000000000..06686519903f5d --- /dev/null +++ b/packages/typescript-config/tsconfig.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "React Native", + "compilerOptions": { + "target": "esnext", + "module": "commonjs", + "types": ["react-native", "jest"], + "lib": [ + "es2019", + "es2020.bigint", + "es2020.date", + "es2020.number", + "es2020.promise", + "es2020.string", + "es2020.symbol.wellknown", + "es2021.promise", + "es2021.string", + "es2021.weakref", + "es2022.array", + "es2022.object", + "es2022.string" + ], + "allowJs": true, + "jsx": "react-native", + "noEmit": true, + "isolatedModules": true, + "strict": true, + "moduleResolution": "nodenext", + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + // Causes issues with package.json "exports" + "forceConsistentCasingInFileNames": false + }, + "exclude": [ + "node_modules", + "babel.config.js", + "metro.config.js", + "jest.config.js" + ] + }