2

截图类型说明自己,首先这是我的路由文件出现问题,您可以看到未使用的导入路径和组件未找到。Typescript 2类型与react-router,找不到名称路径,组件

enter image description here

这里是我的package.json与类型的依赖,并在node_modules文件夹中的@types。

enter image description here

最后,我CONFIGS

enter image description here enter image description here

我不能得到哪里出了问题就在这里,任何人有相似的地方?

请注意,我已经能够使用<Router history={browserHistory} routes={routes} />,并且在应用程序中反应并且还原对象没有问题。

+0

我在使用typescript,react-router时遇到了类似的问题。不得不求助于DefinitlyTyped版本 - https://github.com/DefinitelyTyped/DefinitelyTyped/tree/60e56c268fa43cee750cd410275f6d32dd4cf478/react-router – Rabi

回答

2

您的路径文件具有.ts扩展名,但如果它包含JSX则应该是.tsx。

相关问题