Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Commit

Permalink
Improve connectMenu type (#318)
Browse files Browse the repository at this point in the history
* Improve connectMenu type

Changed connectMenu type to specify that the function deals with React components, not just any

* Export ConnectMenuProps
  • Loading branch information
FraserWaters-GR authored Mar 10, 2020
1 parent ab5b8f9 commit 13e3271
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare module "react-contextmenu" {
collect?: {(data: any): any},
disable?: boolean,
holdToDisplay?: number,
renderTag?: React.ReactType,
renderTag?: React.ElementType,
mouseButton?: number,
disableIfShiftIsPressed?: boolean,
}
Expand All @@ -47,11 +47,20 @@ declare module "react-contextmenu" {
onClick?: {(event: React.TouchEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement>, data: Object, target: HTMLElement): void} | Function,
}

export interface ConnectMenuProps {
id: string;
trigger: any;
}

export const ContextMenu: React.ComponentClass<ContextMenuProps>;
export const ContextMenuTrigger: React.ComponentClass<ContextMenuTriggerProps>;
export const MenuItem: React.ComponentClass<MenuItemProps>;
export const SubMenu: React.ComponentClass<SubMenuProps>;
export function connectMenu(menuId: string): (menu: any) => any;
export function connectMenu<P>(
menuId: string
): (
Child: React.ComponentType<P & ConnectMenuProps>
) => React.ComponentType<P>;
export function showMenu(opts?: any, target?: HTMLElement): void;
export function hideMenu(opts?: any, target?: HTMLElement): void;
}
Expand Down

0 comments on commit 13e3271

Please sign in to comment.