我做了这个组件
import * as Styled from './styles';
export type HeadingProps = {
children: React.ReactNode | string;
colorDark: boolean;
};
export const Heading = ({ children, colorDark }: HeadingProps) => {
return <Styled.Wrapper colorDark={colorDark}>{children}</Styled.Wrapper>;
};
但属性colorDark给出错误
The type '{ children: ReactNode; colorDark: boolean; }' cannot be assigned to type 'IntrinsicAttributes &
有人知道我怎么解决这个问题吗?
1条答案
按热度按时间5kgi1eie1#
它的一个div导出常量Wrapper = styled.h1 ``;
显然,您缺少 styled 组件的类型。