DevClad-Inc / devclad

Unnecessary type assertion of an expression JS-0349
Anti-pattern
Major
a year agoa year old
This assertion is unnecessary since it does not change the type of the expression
 30		isLoading,
 31		isSuccess,
 32	} = useQuery({
 33		...meetingQuery(token, uid as string), 34	});
 35
 36	const callPeer = async () => {
This assertion is unnecessary since it does not change the type of the expression
75
76		if (Cookies.get(key) === undefined && Cookies.get('refresh')) {
77			// refresh token is being called here because the token got expired on the client
78			await refreshToken(qc as QueryClient);79		}
80		return Cookies.get(key) as TState;
81	}
This assertion is unnecessary since it does not change the type of the expression
65	} else {
66		// use non-httpOnly cookies in dev env directly from Cookies lib
67		if (checkTokenType(value) && !del) {
68			Cookies.set(key, value as string);69			return value as TState;
70		}
71		if (del) {
This assertion is unnecessary since it does not change the type of the expression
106	const messagesWindowRef = React.useRef() as React.MutableRefObject<HTMLDivElement>;
107
108	const qc = useQueryClient();
109	const state = qc.getQueryState(['profile', loggedInUserUserName as string]);110
111	const fetchMessages = React.useCallback(
112		({ channelVal, lastMessageID, ltOrGt }: FetchMessages) => {
This assertion is unnecessary since it does not change the type of the expression
100	const [noOfMessages, setNoOfMessages] = React.useState(10); // 6 is what fits in h-[60vh] and leaves room for infinite scroll
101	const { connected, toggleConnection } = useStreamContext();
102	const [showScrollDown, setShowScrollDown] = React.useState(false);
103	const profileData = useProfile(loggedInUserUserName as string) as Profile;104
105	const channelRef = React.useRef() as React.MutableRefObject<Channel<DefaultGenerics>>;
106	const messagesWindowRef = React.useRef() as React.MutableRefObject<HTMLDivElement>;