Skip to content

Commit

Permalink
Add @react-native/typescript-config (facebook#37345)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#37345

This moves from `tsconfig/react-native`, a centralized repository of tsconfigs, to `react-native/typescript-config`, a package maintained as part of the RN monorepo.

We end up wanting to make changes where the versions are coupled, so this publishes them as part of the same repo, etc. It also means Meta engineers can more freely make changes to it with normal approval processes.

Differential Revision: D45721088

fbshipit-source-id: 033a229a3c22133542d1e3afa8afa10b98328674
  • Loading branch information
NickGerleman authored and facebook-github-bot committed May 10, 2023
1 parent 77be932 commit b45b807
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/react-native/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/template/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@tsconfig/react-native/tsconfig.json"
"extends": "@react-native/typescript-config/tsconfig.json"
}
5 changes: 5 additions & 0 deletions packages/typescript-config/README.md
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 15 additions & 0 deletions packages/typescript-config/package.json
Original file line number Diff line number Diff line change
@@ -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/tsconfig"
},
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/tsconfig#readme",
"keywords": ["typescript", "tsconfig", "react-native"],
"bugs": "https://github.com/facebook/react-native/issues",
"main": "tsconfig.json"
}
42 changes: 42 additions & 0 deletions packages/typescript-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

0 comments on commit b45b807

Please sign in to comment.