Skip to content

How can I extend both types 'ButtonHTMLAttributes<HTMLButtonElement> and VariantProps ? #20

Answered by jrgarciadev
fiqryq asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @fiqryq you could try to do this:

type ButtonVariantProps = VariantProps<typeof styles>;
type NativeProps = React.ButtonHTMLAttributes<HTMLButtonElement>;

interface ButtonProps
  extends Omit<NativeProps, keyof ButtonVariantProps>,
    ButtonVariantProps {}

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@fiqryq
Comment options

Answer selected by jrgarciadev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants