-->
当前位置:首页 > articles > 正文内容

React、打字脚本和材料UI 4的编译问题

Luz10个月前 (04-10)articles666

Compilation issue with React, Typescript and Material-UI 4

  • PlexQ 问题:
    • 突然,我的整个建筑倒塌了,无法建造。几天前,我用一个新的create-react应用程序重新设置了这个项目,有一段时间还行,然后是昨天——类似的问题出现了一个不同的错误:
    • Failed to compile.TS2322: Type '{ children: Element; xsDown: true; }' is not assignable to type 'IntrinsicAttributes & HiddenProps'.  Property 'children' does not exist on type 'IntrinsicAttributes & HiddenProps'.    208 |                     {studentName(x)} &lt;{x.student}&gt;    209 |                 </Box>  > 210 |                 {!locked && <Hidden xsDown={true}><Box><RemoveButton deleteClickHandler={deleteClickHandler} x={x}/></Box></Hidden>}        |                              ^^^^^^    211 |                 {locked &&    212 |                 <Box>    213 |                     <Tooltip title="Locked"><Lock/></Tooltip>error Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    • 我已经去掉了我在一个小地方使用的一些库,我怀疑它们会导致类型声明冲突,但是,我仍然遇到这个问题,在这一点上,我完全卡住了。
    • 包裹json不是很复杂:
    •   "name": "****Redacted****",  "version": "1.2.0",  "private": true,  "dependencies": {    "@date-io/date-fns": "^1.3.13",    "@fortawesome/fontawesome-common-types": "^6.1.1",    "@fortawesome/fontawesome-svg-core": "^6.1.1",    "@fortawesome/free-brands-svg-icons": "^6.1.1",    "@fortawesome/free-solid-svg-icons": "^6.1.1",    "@fortawesome/react-fontawesome": "^0.1.18",    "@material-table/core": "^4.3.39",    "@material-ui/core": "^4.12.3",    "@material-ui/icons": "^4.11.3",    "@sentry/react": "^6.19.6",    "@sentry/tracing": "^6.19.6",    "@stripe/react-stripe-js": "^1.7.0",    "@stripe/stripe-js": "^1.26.0",    "@testing-library/jest-dom": "^5.14.1",    "@testing-library/react": "^12.0.0",    "@testing-library/user-event": "^13.2.1",    "@types/dateformat": "^5.0.0",    "@types/jest": "^27.0.1",    "@types/react": "^18.0.0",    "@types/react-dom": "^18.0.0",    "@types/react-router-dom": "^5.3.3",    "amazon-cognito-identity-js": "^5.2.8",    "amazon-cognito-identity-js-typescript": "^1.22.0",    "axios": "^0.26.1",    "dateformat": "^4.6.3",    "immutability-helper": "^3.1.1",    "react": "^18.0.0",    "react-dnd": "^14.0.5",    "react-dnd-html5-backend": "14.1.0",    "react-dnd-touch-backend": "14.1.0",    "react-dom": "^18.0.0",    "react-router": "^6.3.0",    "react-router-dom": "^6.3.0",    "react-scripts": "5.0.0",    "sass": "^1.49.11",    "typescript": "^4.6.3",    "web-vitals": "^2.1.0"  },  "scripts": {    "start": "GENERATE_SOURCEMAP=false react-scripts start",    "build": "react-scripts build",    "test": "react-scripts test",    "eject": "react-scripts eject"  },  "eslintConfig": {    "extends": [      "react-app",      "react-app/jest"    ]  },  "browserslist": {    "production": [      ">0.2%",      "not dead",      "not op_mini all"    ],    "development": [      "last 1 chrome version",      "last 1 firefox version",      "last 1 safari version"    ]  },  "devDependencies": {}}
  • 回答:

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。