Types fix

This commit is contained in:
Half-Shot
2025-04-11 11:08:38 +01:00
parent 31253a401c
commit 5c5484c6b5
2 changed files with 5 additions and 10 deletions

View File

@@ -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<ComponentProps<typeof BaseAvatar>, "name" | "idName" | "url" | "onClick"> {
interface IProps extends Omit<ComponentProps<typeof BaseAvatar>, "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<typeof BaseAvatar>["size"];
oobData?: IOOBData & {
roomId?: string;
};
@@ -47,14 +49,7 @@ export function idNameForRoom(room: Room): string {
return room.roomId;
}
export const RoomAvatar: React.FC<IProps> = ({
room,
viewAvatarOnClick,
onClick,
className,
oobData,
...otherProps
}) => {
const RoomAvatar: React.FC<IProps> = ({ room, viewAvatarOnClick, onClick, className, oobData, ...otherProps }) => {
const size = otherProps.size ?? "36px";
const roomName = room?.name ?? oobData?.name ?? "?";

View File

@@ -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