简体   繁体   English

反应路由器打字稿错误

[英]react-router typescript error

Trying to initialize router with react and typescript but getting bunch of errors尝试使用 react 和 typescript 初始化路由器,但出现一堆错误

错误

I tried already install npm install @types/history But nothing changed Hope your help.我已经尝试安装npm install @types/history但没有任何改变希望你的帮助。 Thanks谢谢

My packge.json我的 package.json

"dependencies": {
"@types/lodash": "^4.14.50",
"@types/react": "^0.14.55",
"@types/react-dom": "^0.14.19",
"@types/redux-form": "^6.3.2",
"animate": "^1.0.0",
"animate.css": "^3.5.2",
"bootstrap": "^4.0.0-alpha.5",
"node-sass": "^4.1.1",
"postcss-smart-import": "^0.6.6",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-redux": "^5.0.2",
"react-router": "^3.0.1",
"redux": "^3.6.0",
"redux-form": "^6.4.3",
"typings": "^2.1.0"
},

 "devDependencies": {
    "@types/history": "^4.5.0",
    "@types/react-router": "^2.0.44",
    "awesome-typescript-loader": "^3.0.0-beta.17",
    "css-loader": "^0.26.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.9.0",
    "postcss-loader": "^1.2.1",
    "precss": "^1.4.0",
    "react-hot-loader": "^1.3.1",
    "redux-devtools": "^3.3.1",
    "resolve-url-loader": "^1.6.1",
    "sass-loader": "^4.1.1",
    "source-map-loader": "^0.1.5",
    "style-loader": "^0.13.1",
    "typescript": "^2.1.4",
    "webpack": "^1.14.0"
  }

Had the same issue for the time being I copied the contents of the DefinitelyTyped history v2暂时有同样的问题我复制了绝对类型历史 v2 的内容

https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/history/v2 https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/history/v2

Into my node_modues/@types/history folder进入我的 node_modues/@types/history 文件夹

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

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