refactor: more TS code

This commit is contained in:
Tristan Yang
2022-07-29 22:59:22 +08:00
parent 6bb7af46a0
commit 33c24baecb
52 changed files with 232 additions and 273 deletions
+2 -2
View File
@@ -17,8 +17,8 @@ import { getUnreadCount } from "../utils";
import { useAppSelector } from "../../../app/store";
interface IProps {
id: number;
setFiles: () => void;
toggleRemoveConfirm: () => void;
setFiles: (files: File[]) => void;
toggleRemoveConfirm: (id: number) => void;
}
const NavItem: FC<IProps> = ({ id, setFiles, toggleRemoveConfirm }) => {
const { pathname } = useLocation();
+3 -3
View File
@@ -3,13 +3,13 @@ import DeleteConfirmModal from "../../settingChannel/DeleteConfirmModal";
import NavItem from "./NavItem";
import { useAppSelector } from "../../../app/store";
export default function ChannelList({ setDropFiles }) {
const [currId, setCurrId] = useState(null);
export default function ChannelList({ setDropFiles }: { setDropFiles: (files: File[]) => void }) {
const [currId, setCurrId] = useState<number>();
const { channelIds } = useAppSelector((store) => {
return { channelIds: store.channels.ids };
});
const setRemoveChannel = (cid = undefined) => {
const setRemoveChannel = (cid?: number) => {
setCurrId(cid);
};