Props typing
A simple, readable way to type React props is to define a Props type nearby and use it in the component signature: props: Props.
...
type ButtonVariant = "primary" | "secondary";
interface ButtonProps extends ComponentProps<"button"> {
children: ReactNode;
variant?: ButtonVariant;
...
}
const Button = ({ variant = "primary", children, ...props }: ButtonProps) => (
...