【发布时间】:2019-11-23 08:17:18
【问题描述】:
我已经为我的样式化组件定义了子组件,并且正在尝试为其提供类型定义 - TSC 抱怨在类型“StyledComponentClass”上不存在“属性”PrimaryText。同样对于“SubText”。
export const Tab = styled(NavLink)`
border: 1px solid rgba(0, 119, 204, 0.5);
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.08), 0 2px 15px 0 rgba(0, 0, 0, 0.08);
box-sizing: border-box;
height: 60px;
min-width: 125px;
padding: 10px 15px;
cursor: pointer;
`;
Tab.PrimaryText = styled(Box)`
height: 22px;
color: #3d464d;
font-size: 16px;
font-weight: 600;
line-height: 22px;
`;
Tab.SubText = styled(Box)`
height: 15px;
color: #525d66;
font-size: 11px;
line-height: 15px;
`;
如何指定类型?看了很多遍。几乎没有任何参考。
【问题讨论】:
标签: reactjs typescript styled-components