Skip to content

Commit

Permalink
chore: ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris committed Nov 26, 2024
1 parent f934f58 commit 62944f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 11 additions & 3 deletions packages/ui-avatar/src/components/UserAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ import { memo } from 'react';
import type { BaseAvatarProps } from './BaseAvatar';
import BaseAvatar from './BaseAvatar';

type UserAvatarProps = Omit<BaseAvatarProps, 'url' | 'title'> & {
type UsernameProp = {
username: string;
userId?: string;
userId?: never;
};

type UserIdProp = {
userId: string;
username?: never;
};

type UserAvatarProps = Omit<BaseAvatarProps, 'url' | 'title'> & {
etag?: string;
url?: string;
title?: string;
};
} & (UsernameProp | UserIdProp);

const UserAvatar = ({ username, userId, etag, ...rest }: UserAvatarProps) => {
const getUserAvatarPath = useUserAvatarPath();
Expand Down
3 changes: 1 addition & 2 deletions packages/ui-contexts/src/AvatarUrlContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const dummy = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcS

export type AvatarUrlContextValue = {
getUserPathAvatar: {
(username: string, etag?: string): string;
(params: { userId: string; etag?: string }): string;
(params: { username: string; etag?: string }): string;
(params: { username?: string; etag?: string }): string;
};
getRoomPathAvatar: (...args: any) => string;
};
Expand Down

0 comments on commit 62944f2

Please sign in to comment.