我对更新/管理/编辑任何webpack / cli工具或版本是完全陌生的,对于使用Yarn和Yarn Dist等也是全新的。...我最近开始了一个包含Typescript的项目,我们安装了第三方npm程序包,但不满意TS。此外,Typescript还对useState和setState大喊大叫。有人能指出我正确的方向吗?非常感谢您的帮助!
错误:
stdout: '$ tsc --declaration\n' +
"../../node_modules/react-avatar-editor/dist/index.d.ts(16,23): error TS2314: Generic type 'TouchEvent<T>' requires 1 type argument(s).\n" +
"../../node_modules/react-avatar-editor/dist/index.d.ts(16,42): error TS2314: Generic type 'MouseEvent<T>' requires 1 type argument(s).\n" +
"src/hooks/userProfileImage.ts(5,43): error TS2339: Property 'useState' does not exist on type 'typeof React'.\n" +
"src/hooks/userProfileImage.ts(6,11): error TS2339: Property 'useEffect' does not exist on type 'typeof React'.\n" +
'info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n',
stderr: '(node:20624) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n' +
'warning package.json: No license field\n' +
'error Command failed with exit code 2.\n',
package.json
{
"name": "rsv8-components",
"version": "0.3.11",
"main": "./dist/module.js",
"types": "./dist/module.d.ts",
"dependencies": {
"react-scroll-to": "^1.2.2",
"react-slick": "^0.23.1",
"slick-carousel": "^1.8.1",
"react-slick-deux": "https://github.com/aboorde/react-slick-deux#master",
"tslib": "^1.9.3",
"xcel-observer": "*"
},
"peerDependencies": {
"react": "^16.8.0",
"react-bootstrap": "0.32.1",
"react-dom": "^16.8.0",
"react-fontawesome": "^1.6.1",
"react-router-dom": "^4.2.2",
"react-toastify": "^4.1.0",
"styled-components": "^2.4.0",
"recompose": "^0.28.1",
"xcel-react-animations": "*",
"xcel-react-core": "*",
"xcel-redux-orm": "*",
"xcel-util": "*",
"xcel-asset-service": "*"
},
"scripts": {
"start": "react-scripts-ts start",
"build": "react-scripts-ts build",
"fix-me-test": "react-scripts-ts test --env=jsdom",
"eject": "react-scripts-ts eject",
"dist": "tsc --declaration",
"dist:watch": "tsc --declaration --watch",
"storybook": "start-storybook -p 6006 -c .storybook"
},
"devDependencies": {
"//": "peerDependencies",
"@storybook/addon-actions": "^4.0.0",
"@storybook/addon-knobs": "^4.0.0",
"@storybook/react": "^4.0.0",
"@types/jest": "^22.2.3",
"@types/node": "^8.9.1",
"@types/react": "^16.3.16",
"@types/react-dom": "^16.0.4",
"@types/react-router-dom": "^4.2.3",
"awesome-typescript-loader": "^3.4.1",
"enzyme-adapter-react-16": "^1.1.0",
"jest": "^23.6.0",
"jest-cli": "^23.4.1",
"jest-styled-components": "4.9.0",
"react": "^16.8.0",
"react-bootstrap": "0.32.1",
"react-dom": "^16.8.0",
"react-fontawesome": "^1.6.1",
"react-router-dom": "^4.2.2",
"react-scripts-ts": "^3.1.0",
"react-toastify": "^4.1.0",
"styled-components": "^2.4.0",
"recompose": "^0.28.1",
"ts-jest": "^22.4.2",
"ts-node": "^5.0.1",
"typescript": "^2.9.0",
"xcel-react-animations": "*",
"xcel-react-core": "*",
"xcel-redux-orm": "*",
"xcel-util": "*",
"xcel-asset-service": "*"
},
"jest": {
"coverageReporters": [
"lcov",
"cobertura",
"text-summary"
],
"testEnvironment": "jsdom",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"testMatch": [
"<rootDir>/src/**/*.test.(ts|tsx)"
],
"collectCoverageFrom": [
"<rootDir>/src/**/*.(ts|tsx)",
"!<rootDir>/src/**/*.test.(ts|tsx)"
],
"transform": {
"\\.(ts|tsx)$": "ts-jest"
}
}
}