Skip to content

Commit c2d9ac1

Browse files
committed
fix: use React.RefCallback
1 parent f3869ea commit c2d9ac1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/compass-context-menu/src/use-context-menu.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export type ContextMenuMethods<T extends ContextMenuItem> = {
1212
* Register the menu items for the context menu.
1313
* @returns a callback ref to be passed onto the element responsible for triggering the menu.
1414
*/
15-
registerItems: (items: T[]) => (trigger: HTMLElement | null) => void;
15+
registerItems: (items: T[]) => React.RefCallback<HTMLElement>;
1616
};
1717

1818
export function useContextMenu<T extends ContextMenuItem>({
@@ -33,7 +33,9 @@ export function useContextMenu<T extends ContextMenuItem>({
3333
throw new Error('useContextMenu called outside of the provider');
3434
}
3535

36-
const register = (content: React.ComponentType) => {
36+
const register = (
37+
content: React.ComponentType
38+
): React.RefCallback<HTMLElement> => {
3739
function listener(event: MouseEvent) {
3840
appendContextMenuContent(event, content);
3941
}

0 commit comments

Comments
 (0)