import React from 'react'; import Button, { ButtonProps } from 'share-we-go-ui/Button'; import { Link as ReactRouterLink, LinkProps } from 'react-router-dom'; const log = console.log; const TestOverride = React.forwardRef((props, ref) => (
)); 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 => { elem; // $ExpectType HTMLDivElement | null }} onClick={e => { e; // $ExpectType MouseEvent log(e); }} > Div { // Can't have an onClick handler if the overriding component doesn't specify one: // $ExpectError component={TestOverride} onClick={log}> TestOverride }
); const ReactRouterLinkTest = () => { const ButtonLink = (props: ButtonProps) => ( ); };