我使用了一个自定义的Icon组件,如下所示: <Icon onClick={() => {}} /> 然而,TypeScript给Icon加了下划线,并给出了以下消息,我不太明白: Property'onClick' does not exist on type 'IntrinsicAttributes & Pick<Pick<Props, "className" | "name">
使用typescript并希望使用样式化组件为Material UI组件设置样式。但是显示Type '{ children: string; }' is missing the following properties的StyledComponent会出现类型错误 background: blue;有人
我正在构建一个组件库,我需要其中的一些组件有一个可定制的标记名。例如,有时看起来像<button>的东西实际上是<a>。所以我希望能够像这样使用按钮组件: <Button onClick={onClick}>Click me!</Button> 下面是不带TypeScript的实现: function Button({ as = "button&qu
我试图在一个带有样式的组件中调用一个prop,但是它给了我一个错误: [ts] Property 'color' does not exist on type 'ThemeProps<any>'.下面是这个问题的代码: const ButtonContainer = styled.button` padding: ${theme.s2};: boolean }) Typescr