From 5c5484c6b590ee55e6f1fee9d6e6eeb64d3a4017 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Fri, 11 Apr 2025 11:08:38 +0100 Subject: [PATCH] Types fix --- src/components/views/avatars/RoomAvatar.tsx | 13 ++++--------- .../components/views/avatars/RoomAvatar-test.tsx | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/views/avatars/RoomAvatar.tsx b/src/components/views/avatars/RoomAvatar.tsx index 4d07b6adb3..9ecef35635 100644 --- a/src/components/views/avatars/RoomAvatar.tsx +++ b/src/components/views/avatars/RoomAvatar.tsx @@ -22,11 +22,13 @@ import { MediaPreviewValue } from "../../../@types/media_preview"; import { useRoomAvatar } from "../../../hooks/room/useRoomAvatar"; import { useSettingValue } from "../../../hooks/useSettings"; -interface IProps extends Omit, "name" | "idName" | "url" | "onClick"> { +interface IProps extends Omit, "name" | "idName" | "url" | "onClick" | "size"> { // Room may be left unset here, but if it is, // oobData.avatarUrl should be set (else there // would be nowhere to get the avatar from) room?: Room; + // Optional here. + size?: ComponentProps["size"]; oobData?: IOOBData & { roomId?: string; }; @@ -47,14 +49,7 @@ export function idNameForRoom(room: Room): string { return room.roomId; } -export const RoomAvatar: React.FC = ({ - room, - viewAvatarOnClick, - onClick, - className, - oobData, - ...otherProps -}) => { +const RoomAvatar: React.FC = ({ room, viewAvatarOnClick, onClick, className, oobData, ...otherProps }) => { const size = otherProps.size ?? "36px"; const roomName = room?.name ?? oobData?.name ?? "?"; diff --git a/test/unit-tests/components/views/avatars/RoomAvatar-test.tsx b/test/unit-tests/components/views/avatars/RoomAvatar-test.tsx index cf3f71d473..80ffe0d7e5 100644 --- a/test/unit-tests/components/views/avatars/RoomAvatar-test.tsx +++ b/test/unit-tests/components/views/avatars/RoomAvatar-test.tsx @@ -22,7 +22,7 @@ import { MediaPreviewValue } from "../../../../../src/@types/media_preview"; describe("RoomAvatar", () => { let client: MatrixClient; - let showAvatarsSetting: MediaPreviewValue = MediaPreviewValue.On; + let showAvatarsSetting: MediaPreviewValue.On | MediaPreviewValue.Off = MediaPreviewValue.On; filterConsole( // unrelated for this test