removed all occurences of "any"

This commit is contained in:
phntxx 2021-03-23 16:26:14 +01:00
parent 3f3722ee2b
commit 091280d4ad
7 changed files with 13 additions and 16 deletions

View file

@ -70,7 +70,7 @@ const StyledButton = styled.button`
interface IIconButtonProps {
icon: string;
onClick: any;
onClick: (e: React.FormEvent) => void;
}
/**

View file

@ -52,7 +52,7 @@ interface IModalProps {
* @param {IModalProps} props - The needed props for the modal
*/
const Modal = ({ element, icon, text, condition, title, onClose, children }: IModalProps) => {
const [modalHidden, setModalHidden] = useState(condition ?? true);
const [modalHidden, setModalHidden] = useState<boolean>(condition ?? true);
const closeModal = () => {
if (onClose) onClose();

View file

@ -56,9 +56,7 @@ const SearchBar = ({ providers }: ISearchBarProps) => {
let [input, setInput] = useState<string>("");
let [buttonsHidden, setButtonsHidden] = useState<boolean>(true);
useEffect(() => {
setButtonsHidden(input === "");
}, [input]);
useEffect(() => setButtonsHidden(input === ""), [input]);
const handleSearchQuery = (e: React.FormEvent) => {
var query: string = input || "";

View file

@ -1,7 +1,7 @@
import React, { useState } from "react";
import styled from "styled-components";
import Select, { Styles } from "react-select";
import Select, { Styles, ValueType } from "react-select";
import { ISearchProviderProps } from "./searchBar";
import selectedTheme, { setTheme, IThemeProps } from "../lib/theme";
@ -118,14 +118,13 @@ interface ISettingsProps {
providers: Array<ISearchProviderProps> | undefined;
}
/**
* Handles the settings-modal
* @param {Array<IThemeProps>} themes - the list of themes a user can select between
* @param {Array<ISearchProviderProps>} providers - the list of search providers
*/
const Settings = ({ themes, providers }: ISettingsProps) => {
const [newTheme, setNewTheme] = useState();
const [newTheme, setNewTheme] = useState<IThemeProps>();
if (themes && providers) {
return (
@ -137,8 +136,8 @@ const Settings = ({ themes, providers }: ISettingsProps) => {
<Select
options={themes}
defaultValue={selectedTheme}
onChange={(e: any) => {
setNewTheme(e);
onChange={(e: ValueType<IThemeProps, false>) => {
if (e !== null && e !== undefined) setNewTheme(e);
}}
styles={SelectorStyle}
/>