【发布时间】:2019-04-21 21:23:44
【问题描述】:
我正在使用material-ui v3.5.1
我想让 ListItem 像这样使用 Link 组件:
<ListItem component={Link} to="/some/path">
<ListItemText primary="Text" />
</ListItem>
但是 Typescript 用一个冗长的错误消息向我打招呼(“组件”这个词在 VSCode 中突出显示),在底部它说:
The type "typeof Link" cannot be assigned to the type "ComponentClass<ListItemProps, any>"
Property 'to' is missing in type 'ListItemProps' but required in type 'Readonly'. [2322]
有没有一种解决方法可以让这些东西与 Typescript 一起使用?
谢谢!
【问题讨论】:
标签: reactjs typescript material-ui