`tsc` 持续跟踪 `node_modules`。谁能帮我解决这个问题吗?

问题描述 投票:0回答:1

我正在使用世博会。这是我的

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"
}

如您所见,它延伸了

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"]
}

tsc
持续追踪
node_modules
。为什么?我找不到任何解决方案。

$ 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.

请注意,

tsc
是一个纯命令,在
package.json
中没有任何自定义。

typescript react-native expo tsc
1个回答
0
投票

这是因为图书馆

react-native-gifted-charts
。我已经向该库指出了问题:

https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/625

临时解决方法是这样的:

https://gist.github.com/araphiel/b3d13ade7f9fe69e99c3d053196557d2

© www.soinside.com 2019 - 2024. All rights reserved.