fix: typescript error

This commit is contained in:
Tristan Yang
2022-08-15 10:05:03 +08:00
parent 8f44059f52
commit aada865873
2 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export interface ChatSession {
unread?: number;
}
type Props = {
tempSession: ChatSession;
tempSession?: ChatSession;
};
const SessionList: FC<Props> = ({ tempSession }) => {
const [deleteId, setDeleteId] = useState<number>();
+7 -2
View File
@@ -29,8 +29,13 @@ export default function ChatPage() {
};
const tmpSession =
sessionUids.findIndex((i) => i == user_id) > -1
? null
: { key: `user_${user_id}`, mid: null, unreads: 0, id: user_id, type: "user" };
? undefined
: {
key: `user_${user_id}`,
unreads: 0,
id: +user_id,
type: "user" as "user" | "channel"
};
// console.log("temp uid", tmpUid);
const placeholderVisible = channel_id == 0 && user_id == 0;
return (