[英]TypeScript error in directory/node_modules/@antv/g6-core/lib/types/index.d.ts(24,37): Type expected. TS1110
After cloning the repo from GitHub and installing packages by running yarn install, when I'm run the project getting this error.从 GitHub 克隆 repo 并通过运行 yarn install 安装包后,当我运行项目时出现此错误。 I tried to update react script latest, doesn't work.
我试图更新最新的反应脚本,不起作用。 Also, tried to update typescript 4.1.2 doesn't work.
此外,尝试更新 typescript 4.1.2 不起作用。
This is my package.json这是我的 package.json
{
"name": "zis3-frontend",
"version": "4.6.41.3",
"created": "2022-03-15 20:23:03",
"private": true,
"dependencies": {
"@ant-design/charts": "^1.0.8",
"@ant-design/icons": "^4.1.0",
"@types/i18next": "^13.0.0",
"@types/react-highlight-words": "^0.16.1",
"@types/react-redux": "^7.1.8",
"@types/react-router": "^5.1.7",
"@types/react-router-dom": "^5.1.5",
"antd": "^4.10.2",
"antd-button-color": "^1.0.3",
"antd-mask-input": "^0.1.13",
"array-move": "^4.0.0",
"axios": "^0.19.2",
"fast-xml-parser": "^3.20.3",
"i18next": "17.0.1",
"i18next-browser-languagedetector": "^4.1.1",
"i18next-http-backend": "^1.0.8",
"moment": "^2.25.3",
"node-sass": "4.14.1",
"query-string": "^6.13.0",
"react": "^16.13.1",
"react-csv": "^2.2.2",
"react-dom": "^16.13.1",
"react-highlight-words": "^0.16.0",
"react-i18next": "10.11.0",
"react-icons": "^4.1.0",
"react-json-pretty": "^2.2.0",
"react-quill": "^1.3.5",
"react-redux": "^7.2.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.3",
"react-sortable-hoc": "^2.0.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"sweetalert2": "^11.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts --max_old_space_size=4096 build && REACT_APP_BUILD_VERSION=$(./ci/get_fe_version.py) && sed -i -- 's/%REACT_APP_BUILD_VERSION%/'$REACT_APP_BUILD_VERSION'/g' build/index.html && echo React Build Version = $REACT_APP_BUILD_VERSION",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"postcssSortingConfig": {
"properties-order": "alphabetical"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"prettier": "2.0.5",
"stylelint": "^13.3.3",
"stylelint-config-sass-guidelines": "^7.0.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-statement-max-nesting-depth": "^2.0.1",
"typescript": "^3.9.7"
}
}
TS Config TS 配置
{
"compilerOptions": {
"target": "es6",
"module": "esnext",
"jsx": "react",
"lib": ["dom", "dom.iterable", "scripthost", "es5", "es6"],
"baseUrl": "./src",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"outDir": "./dist",
"rootDir": "./src",
"removeComments": true,
"noEmitOnError": true,
"noImplicitAny": false,
"noLib": false,
"preserveConstEnums": true,
"declaration": false,
"suppressImplicitAnyIndexErrors": true,
"sourceMap": true
},
"filesGlob": ["./src/**/*.ts", "./src/**/*.tsx", "!./node_modules/**"],
"include": ["./src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"],
"rules": {
"quotemark": "single",
"autoFixOnSave": true
}
}
Eg.例如。 I did the following npm uninstall -D typescript (This uninstalled 3.9.7 version) npm i -D typescript@4.2.4
我做了以下 npm uninstall -D typescript (这个卸载的 3.9.7 版本) npm i -D typescript@4.2.4
This fixed the problem这解决了问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.