Using the Expo platform has been a great experience for me. Here is a snippet from my tsconfig.json
:
{
"compilerOptions": {
"paths": {
"@/*": [
"./src/*"
],
"@assets/*": [
"./assets/*"
]
},
"strict": true,
"strictFunctionTypes": false,
"noFallthroughCasesInSwitch": true
},
"include": [
"src",
".expo/types/**/*.ts",
"expo-env.d.ts"
],
"extends": "expo/tsconfig.base"
}
It's worth noting that this configuration extends expo/tsconfig.base
:
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Expo",
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"jsx": "react-native",
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ESNext"
},
"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
}
Despite this, I've encountered an issue where tsc
seems to be tracking node_modules
. I've searched for solutions but haven't found any yet.
$ yarn tsc
...
Errors Files
1 node_modules/react-native-gifted-charts/src/BarChart/Animated2DWithGradient.tsx:110
8 node_modules/react-native-gifted-charts/src/BarChart/index.tsx:19
3 node_modules/react-native-gifted-charts/src/BarChart/RenderBars.tsx:219
1 node_modules/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx:8
3 node_modules/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx:7
1 node_modules/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx:5
1 node_modules/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx:4
2 node_modules/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx:6
1 node_modules/react-native-gifted-charts/src/Components/BarSpecificComponents/barBackgroundPattern.tsx:4
1 node_modules/react-native-gifted-charts/src/Components/BarSpecificComponents/cap.tsx:5
1 node_modules/react-native-gifted-charts/src/Components/common/Pointer.tsx:4
1 node_modules/react-native-gifted-charts/src/Components/common/StripAndLabel.tsx:6
37 node_modules/react-native-gifted-charts/src/LineChart/index.tsx:411
16 node_modules/react-native-gifted-charts/src/LineChart/LineChartBicolor.tsx:193
2 node_modules/react-native-gifted-charts/src/PieChart/index.tsx:32
error Command failed with exit code 2.
Just to clarify, the tsc
command itself hasn't been customized in the package.json
.