简体   繁体   English

新克隆的 typescript react-native 项目充满了错误

[英]Newly cloned typescript react-native project riddled with errors

I just cloned a TypeScript React-Native project at work and it is riddled with a variety of errors on my machine for some reason, the contractor who made the app isn't sure why.我刚刚在工作中克隆了一个 TypeScript React-Native 项目,由于某种原因,它在我的机器上充满了各种错误,制作该应用程序的承包商不确定原因。 Here's a few examples of the errors.以下是一些错误示例。

import BackButton from "../assets/images/backbutton.png"; - Cannot find module or its corresponding type declarations. ts(2307)

const Title = ({ children }) => - Binding element 'children' implicitly has an 'any' type. ts(7031)

Here's my tsconfig.json:这是我的 tsconfig.json:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "jsx": "react-native",
    "lib": [
      "dom",
      "esnext"
    ],
    "moduleResolution": "node",
    "noEmit": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "strict": true
  },
  "extends": "expo/tsconfig.base" - File 'expo/tsconfig.base' not found.enter code here
}

As you can see it seems like it some sort of configuration problem in regards to typescript.如您所见,这似乎是关于打字稿的某种配置问题。 Any suggestions are appreciated.任何建议表示赞赏。

必须使用require而不是 import 导入图像。

const backBtnImg = require('../assets/images/backbutton.png');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM