File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { Context } from './context-menu-provider';
44import { appendContextMenuContent } from './context-menu-content' ;
55import type { ContextMenuItem } from './types' ;
66
7- export type ContextMenuMethods = {
7+ export type ContextMenuMethods < T extends ContextMenuItem > = {
88 /**
99 * Close the context menu.
1010 */
@@ -13,10 +13,12 @@ export type ContextMenuMethods = {
1313 * Register the menu items for the context menu.
1414 * @returns a callback ref to be passed onto the element responsible for triggering the menu.
1515 */
16- registerItems : ( items : ContextMenuItem [ ] ) => RefCallback < HTMLElement > ;
16+ registerItems : ( items : T [ ] ) => RefCallback < HTMLElement > ;
1717} ;
1818
19- export function useContextMenu ( ) : ContextMenuMethods {
19+ export function useContextMenu <
20+ T extends ContextMenuItem = ContextMenuItem
21+ > ( ) : ContextMenuMethods < T > {
2022 const context = useContext ( Context ) ;
2123 const previous = useRef < null | [ HTMLElement , ( event : MouseEvent ) => void ] > (
2224 null
You can’t perform that action at this time.
0 commit comments