tooltip icon indicating copy to clipboard operation
tooltip copied to clipboard

Incorrect typing for trigger prop -- should be ActionType | ActionType[]

Open devuxer opened this issue 4 years ago • 1 comments

According to rc-trigger > src > index.tsx, the action prop should allow an ActionType or an ActionType[]:

export interface TriggerProps {
  children: React.ReactElement;
  action?: ActionType | ActionType[];

However, the trigger prop of rc-tooltip, which gets passed to the action prop of rc-trigger, only allows a single ActionType (not an array). Here is the relevant code from rc-tooltip > src > Tooltip.tsx:

export interface TooltipProps extends Pick<TriggerProps, 'onPopupAlign' | 'builtinPlacements'> {
  trigger?: ActionType;

// ...


  return (
    <Trigger
      popupClassName={overlayClassName}
      prefixCls={prefixCls}
      popup={getPopupElement}
      action={trigger}

(Note: I came across this problem via Ant Design's Tooltip component, which depends on rc-tooltip.)

devuxer avatar Mar 09 '20 05:03 devuxer

👍

KatiRasanen avatar Mar 27 '20 07:03 KatiRasanen