import * as React from 'react'; import Button, { ButtonProps } from '@mui/material/Button'; import { Link as ReactRouterLink, LinkProps } from 'react-router-dom'; import { expectType } from '@mui/types'; const log = console.log; const TestOverride = React.forwardRef((props, ref) => (
)); function FakeIcon() { return
Icon
; } const buttonTest = () => (
{/* By default the underlying component is a button element */} {/* If an href is provided, an anchor is used */} {/* If a component prop is specified, use that: */} component="div" ref={(elem) => { expectType(elem); }} onClick={(e) => { expectType, typeof e>(e); log(e); }} > Div { // Can't have an onClick handler if the overriding component doesn't specify one: // @ts-expect-error component={TestOverride} onClick={log}> TestOverride }
); const ReactRouterLinkTest = () => { function ButtonLink(props: ButtonProps) { return ); };