diff --git a/src/components/badge/beta_badge/beta_badge.tsx b/src/components/badge/beta_badge/beta_badge.tsx index 7d0cb932f7a..58bcf2193af 100644 --- a/src/components/badge/beta_badge/beta_badge.tsx +++ b/src/components/badge/beta_badge/beta_badge.tsx @@ -76,16 +76,16 @@ type WithSpanProps = Omit< >; // `label` prop can be a `ReactNode` only if `title` or `tooltipContent` is provided -type LabelAsNode = ( - | { - title: string; - tooltipContent?: ReactNode; - } - | { - tooltipContent: ReactNode; - title?: string; - } -) & { +type LabelAsNode = ExclusiveUnion< + { + title: string; + tooltipContent?: ReactNode; + }, + { + tooltipContent: ReactNode; + title?: string; + } +> & { label: ReactNode; }; @@ -203,12 +203,11 @@ export const EuiBetaBadge: FunctionComponent = ({ let content; if (onClick || href) { - const spanTitle = title || label; content = ( )} {...(rest as HTMLAttributes)}> {icon || label} @@ -246,10 +245,7 @@ export const EuiBetaBadge: FunctionComponent = ({ ); } return ( - + {icon || label} );