我收到类型错误:无法读取未定义的属性(读取“fontSize”)
这里是当前的style.tsx代码:
从'@fortawesome/react-fontawesome'导入{FontAwesomeIcon} 从“styled-components”导入样式 从 'twin.macro' 导入 tw
export const StyledIcon = styled(FontAwesomeIcon)
${tw
text-icon-md pl-2.5} ${({ theme }) => [theme.text?.fontSize.md, theme.text?.color.link]}
export const StyledSection = styled.div
${tw
mb-8 space-y-4}
export const StyledHeading = styled.div
${tw
flex items-center space-x-4 cursor-pointer}
===
我想加上“?”。到 theme.text?.fontSize.md, theme.text?.color.link 会解决这个问题,但没有运气。希望有人能看一看。
谢谢!