How can I type a styled-component element that has a static property?
(如何键入具有静态属性的样式化组件元素?)
interface IMyList {
Item: ThemedStyledFunction<"li", any>;
}
const MyList: IMyList = styled.ul`
padding: 0;
margin: 0;
`;
MyList.Item = styled.li`
display: block;
padding-left: 16px;
color: rebeccapurple;
`;
The above throws me Property 'Item' is missing in type 'String & StyledComponentBase<"ul", any, {}, never>' but required in type 'IMyList'.ts(2741)
for "MyList" and Property 'attrs' is missing in type 'String & StyledComponentBase<"li", any, {}, never>' but required in type 'ThemedStyledFunction<"li", any, {}, never>'.ts(2741)
for "MyList.Item".
(上面让我感到Property 'Item' is missing in type 'String & StyledComponentBase<"ul", any, {}, never>' but required in type 'IMyList'.ts(2741)
对于“ Property 'Item' is missing in type 'String & StyledComponentBase<"ul", any, {}, never>' but required in type 'IMyList'.ts(2741)
”和Property 'attrs' is missing in type 'String & StyledComponentBase<"li", any, {}, never>' but required in type 'ThemedStyledFunction<"li", any, {}, never>'.ts(2741)
为“ MyList.Item”缺少”。)
ask by darksoulsong translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…