-
Notifications
You must be signed in to change notification settings - Fork 0
/
repro.tsx
21 lines (18 loc) · 1.27 KB
/
repro.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable react-refresh/only-export-components */
import Button from "@mui/material/Button";
import type { UrlObject } from "url";
// Like next/link component
const Link = (_: { href: string | UrlObject }) => null;
const X1 = <Button href=""></Button>;
const href = {} as UrlObject;
const X2 = <Button component={Link} href={href}></Button>; // Occurs type error
/*
No overload matches this call.
Overload 1 of 3, '(props: { href: string; } & ButtonOwnProps & Omit<ButtonBaseOwnProps, "classes"> & CommonProps & Omit<Omit<DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & { ...; }, "className" | ... 24 more ... | "variant">): Element', gave the following error.
Type 'UrlObject' is not assignable to type 'string'.
Overload 2 of 3, '(props: { component: (_: { href: string | UrlObject; }) => null; } & ButtonOwnProps & Omit<ButtonBaseOwnProps, "classes"> & CommonProps & Omit<...>): Element | null', gave the following error.
Type 'UrlObject' is not assignable to type 'string'.
Overload 3 of 3, '(props: DefaultComponentProps<ExtendButtonBaseTypeMap<ButtonTypeMap<{}, "button">>>): Element | null', gave the following error.
Type 'UrlObject' is not assignable to type 'string'.
*/