// This file is for type testing only // only use the type import type { default as ButtonType } from './index' import type styledType from 'styled-components' declare const Button: typeof ButtonType declare const styled: typeof styledType const Custom = ({ custom }: { custom: string }) => <>{custom} const CustomGeneric = ({ custom }: { custom: C }) => ( <>{custom} ) const StyledButton = styled(Button)`` const StyledButtonAsButton = styled(Button<'button'>)`` const StyledButtonA = styled(Button<'a'>)`` const StyledButtonCustom = styled(Button)`` const StyledButtonCustomAsButton = styled( Button, )`` as typeof Button const StyledButtonCustomGeneric = styled(Button)`` const StyledButtonCustomGenericFoo = styled( Button>, )`` // for type test only // eslint-disable-next-line @typescript-eslint/no-unused-vars function Tests() { return ( <> {/* OK */} component="a" href="#" /> > component={CustomGeneric} custom="bar" /> } custom="foo" /> {/* NG */} {/* @ts-expect-error Property 'href' does not exist on type */} {/* @ts-expect-error Property 'href' does not exist on type */} {/* @ts-expect-error Property 'component' is missing */} {/* @ts-expect-error Property 'disabled' does not exist on type */} {/* @ts-expect-error Type '"button"' is not assignable to type '"a"' */} {/* @ts-expect-error Property 'component' is missing */} {/* @ts-expect-error Type 'string' is not assignable */} {/* @ts-expect-error Property 'custom' does not exist on type */} {/* @ts-expect-error Type 'href' is not assignable */} href="#" /> } custom="foo" /> {/* @ts-expect-error '""' is not assignable to type '"foo"' */} ) }