react-component / react-component/tooltip

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

Open
#209 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
944
Forks
199
Avg merge
19h 1m
Merged PRs (30d)
3

Description

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.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Tooltip.tsx and compare its trigger prop with the ActionType | ActionType[] definition shown for rc-trigger in src/index.tsx. Confirm that the tooltip prop accepts both a single action and an array, and verify that the value is passed through to Trigger without type errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.