Skip to content

Commit

Permalink
Use ExclusiveUnion for EuiListGroupItemProps.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Mar 20, 2019
1 parent 64f9e6f commit 4a648e2
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/components/list_group/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EuiButtonIconProps, EuiButtonPropsForButtonOrLink } from '@elastic/eui';
import { IconType } from '../icon';
import { CommonProps } from '../common';
import { CommonProps, ExclusiveUnion } from '../common';
import {
AnchorHTMLAttributes,
ButtonHTMLAttributes,
Expand Down Expand Up @@ -35,7 +35,7 @@ declare module '@elastic/eui' {
* @see './list_group_item.js'
*/

type EuiListGroupItemProps = {
type EuiListGroupItemPropsBasics = {
size?: 'xs' | 's' | 'm' | 'l';
label: ReactNode;
isActive?: boolean;
Expand All @@ -55,16 +55,15 @@ declare module '@elastic/eui' {
wrapText?: boolean;
};

type EuiListGroupItemExtendedProps = EuiListGroupItemProps & CommonProps & (
({
onClick: MouseEventHandler<HTMLButtonElement>;
} & ButtonHTMLAttributes<HTMLButtonElement>) |
({
href: string;
onClick: MouseEventHandler<HTMLAnchorElement>;
} & AnchorHTMLAttributes<HTMLAnchorElement>) |
type EuiListGroupItemProps = EuiListGroupItemPropsBasics &
CommonProps &
ExclusiveUnion<
ExclusiveUnion<
ButtonHTMLAttributes<HTMLButtonElement>,
AnchorHTMLAttributes<HTMLAnchorElement>
>,
HTMLAttributes<HTMLSpanElement>
);
>;

export const EuiListGroupItem: FunctionComponent<EuiListGroupItemExtendedProps>;
export const EuiListGroupItem: FunctionComponent<EuiListGroupItemProps>;
}

0 comments on commit 4a648e2

Please sign in to comment.