import * as React from 'react'; import Button, { ButtonProps } from '@material-ui/core/Button'; import { Link as ReactRouterLink, LinkProps } from 'react-router-dom'; import { expectType } from '@material-ui/types'; const log = console.log; const TestOverride = React.forwardRef((props, ref) => (
)); const FakeIcon = () =>
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 = () => { const ButtonLink = (props: ButtonProps) => ( ); };