I recently found a way to set default props on react components, like this:
type Props = { children: any, color?: keyof typeof textColors,};const GTitle: React.FC<Props> = ({ children, color }) => (<Title color={textColors[color]}> {children}</Title>);GTitle.defaultProps = { color: 'primary',};
the problem is that even if I define that there is a default property, the typescript keeps accusing the possibility of having an undefined value,as in the example below: