fix(package): fix incorrect typings for context menu

This commit is contained in:
Luke
2022-09-16 16:06:04 +02:00
parent fe1820e07f
commit 7529e7436b

View File

@@ -1,12 +1,13 @@
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types'; import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
interface ContextMenuItem { interface ContextMenuItem {
title?: string;
menu?: string; menu?: string;
icon?: IconName | [IconPrefix, IconName]; icon?: IconName | [IconPrefix, IconName];
iconColor?: string; iconColor?: string;
onSelect?: () => void; onSelect?: (args: any) => void;
arrow?: boolean; arrow?: boolean;
description?: boolean; description?: string;
metadata?: string | { [key: string]: any } | string[]; metadata?: string | { [key: string]: any } | string[];
event?: string; event?: string;
serverEvent?: string; serverEvent?: string;
@@ -26,7 +27,7 @@ interface ContextMenuProps {
options: { [key: string]: ContextMenuItem } | ContextMenuArrayItem[]; options: { [key: string]: ContextMenuItem } | ContextMenuArrayItem[];
} }
type registerContext = (context: ContextMenuProps) => void; type registerContext = (context: ContextMenuProps | ContextMenuProps[]) => void;
export const registerContext: registerContext = (context) => exports.ox_lib.registerContext(context); export const registerContext: registerContext = (context) => exports.ox_lib.registerContext(context);
export const showContext = (id: string): void => exports.ox_lib.showContext(id); export const showContext = (id: string): void => exports.ox_lib.showContext(id);