Skip to content

Commit d603592

Browse files
author
Tom Hutman
committed
get rid of redundant typing
1 parent 409b832 commit d603592

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/utils.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ReactMarkdown from 'react-markdown/with-html';
88

99
import type { UserResponse } from 'stream-chat';
1010

11-
import type { DefaultUserType, UnknownType } from '../types/types';
11+
import type { UnknownType } from '../types/types';
1212

1313
export const isOnlyEmojis = (text?: string) => {
1414
if (!text) return false;
@@ -107,11 +107,7 @@ const emojiMarkdownPlugin = () => {
107107
return transform;
108108
};
109109

110-
type MentionedUser<
111-
Us extends DefaultUserType<Us> = DefaultUserType
112-
> = UserResponse<Us>;
113-
114-
const mentionsMarkdownPlugin = (mentioned_users: MentionedUser[]) => () => {
110+
const mentionsMarkdownPlugin = (mentioned_users: UserResponse[]) => () => {
115111
const mentioned_usernames = mentioned_users
116112
.map((user) => user.name || user.id)
117113
.filter(Boolean)
@@ -142,15 +138,15 @@ const mentionsMarkdownPlugin = (mentioned_users: MentionedUser[]) => () => {
142138
return transform;
143139
};
144140

145-
type MentionProps = { mentioned_user: MentionedUser };
141+
type MentionProps = { mentioned_user: UserResponse };
146142

147143
const Mention: React.FC<MentionProps> = ({ children }) => (
148144
<span className='str-chat__message-mention'>{children}</span>
149145
);
150146

151147
export const renderText = (
152148
text?: string,
153-
mentioned_users?: MentionedUser[],
149+
mentioned_users?: UserResponse[],
154150
MentionComponent: React.ComponentType<MentionProps> = Mention,
155151
) => {
156152
// take the @ mentions and turn them into markdown?

0 commit comments

Comments
 (0)