From f63c9311e5f4cb81ac8b1370ae94425b0caf7a62 Mon Sep 17 00:00:00 2001 From: Alex Johansson Date: Thu, 2 Sep 2021 12:02:45 +0200 Subject: [PATCH] use `JSX.IntrinsicElements` for pass-through props (#545) --- components/ui/Button.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/components/ui/Button.tsx b/components/ui/Button.tsx index 72607b6a..73ff565d 100644 --- a/components/ui/Button.tsx +++ b/components/ui/Button.tsx @@ -2,20 +2,18 @@ import classNames from "@lib/classNames"; import Link, { LinkProps } from "next/link"; import React from "react"; -type HTMLAnchorProps = React.AnchorHTMLAttributes; -type HTMLButtonProps = React.ButtonHTMLAttributes; - -type SVGComponent = React.FunctionComponent>; - export type ButtonProps = { color?: "primary" | "secondary" | "minimal"; size?: "base" | "sm" | "lg" | "fab"; loading?: boolean; disabled?: boolean; onClick?: (event: React.MouseEvent) => void; - StartIcon?: SVGComponent; - EndIcon?: SVGComponent; -} & ((Omit & { href: LinkProps["href"] }) | (HTMLButtonProps & { href?: never })); + StartIcon?: JSX.IntrinsicElements["svg"]; + EndIcon?: JSX.IntrinsicElements["svg"]; +} & ( + | (Omit & { href: LinkProps["href"] }) + | (JSX.IntrinsicElements["button"] & { href?: never }) +); export const Button = function Button(props: ButtonProps) { const {