Skip to content

Scheduling infrastructure for absolutely everyone.

use `JSX.IntrinsicElements` for pass-through props (#545)

Alex Johanssonf63c9311e5f4
diff --git a/components/ui/Button.tsx b/components/ui/Button.tsx
index 72607b6ad62..73ff565d534 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<HTMLAnchorElement>;
-type HTMLButtonProps = React.ButtonHTMLAttributes<HTMLButtonProps>;
-
-type SVGComponent = React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
-
export type ButtonProps = {
color?: "primary" | "secondary" | "minimal";
size?: "base" | "sm" | "lg" | "fab";
loading?: boolean;
disabled?: boolean;
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
- StartIcon?: SVGComponent;
- EndIcon?: SVGComponent;
-} & ((Omit<HTMLAnchorProps, "href"> & { href: LinkProps["href"] }) | (HTMLButtonProps & { href?: never }));
+ StartIcon?: JSX.IntrinsicElements["svg"];
+ EndIcon?: JSX.IntrinsicElements["svg"];
+} & (
+ | (Omit<JSX.IntrinsicElements["a"], "href"> & { href: LinkProps["href"] })
+ | (JSX.IntrinsicElements["button"] & { href?: never })
+);
export const Button = function Button(props: ButtonProps) {
const {