diff --git a/apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoActions.tsx b/apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoActions.tsx index 929c1d9c7570c..082e5c867306d 100644 --- a/apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoActions.tsx +++ b/apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoActions.tsx @@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next'; import { UserInfoAction } from '../../../../components/UserInfo'; import { useMemberExists } from '../../../hooks/useMemberExists'; +import type { UserInfoAction as UserInfoActionType } from '../../hooks/useUserInfoActions'; import { useUserInfoActions } from '../../hooks/useUserInfoActions'; type UserInfoActionsProps = { @@ -58,10 +59,9 @@ const UserInfoActions = ({ user, rid, isInvited, backToList }: UserInfoActionsPr ); }, [menuOptions, t]); - // TODO: sanitize Action type to avoid any const actions = useMemo(() => { - const mapAction = ([key, { content, title, icon, onClick }]: any): ReactElement => ( - + const mapAction = ([key, action]: [string, UserInfoActionType]): ReactElement => ( + ); return [...actionsDefinition.map(mapAction), menu].filter(Boolean); diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/index.ts b/apps/meteor/client/views/room/hooks/useUserInfoActions/index.ts index 44ce5ef6c2da5..931c3ee9dd51a 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/index.ts +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/index.ts @@ -1 +1,2 @@ export { useUserInfoActions } from './useUserInfoActions'; +export type { UserInfoAction, UserMenuAction } from './useUserInfoActions'; diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts b/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts index f9baa1f736680..ca0c8b753ddbd 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/useUserInfoActions.ts @@ -44,7 +44,7 @@ type UserInfoActionWithContent = { export type UserInfoAction = UserInfoActionWithContent | UserInfoActionWithOnlyIcon; -type UserMenuAction = { +export type UserMenuAction = { id: string; title: string; items: GenericMenuItemProps[]; @@ -66,7 +66,7 @@ export const useUserInfoActions = ({ size = 2, isMember, isInvited, -}: UserInfoActionsParams): { actions: [string, UserInfoAction][]; menuActions: any | undefined } => { +}: UserInfoActionsParams): { actions: [string, UserInfoAction][]; menuActions: UserMenuAction | undefined } => { const addUser = useAddUserAction(user, rid, reload); const blockUser = useBlockUserAction(user, rid); const changeLeader = useChangeLeaderAction(user, rid);