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

@ -7,7 +7,7 @@
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.0.0",
"@types/node": "^14.14.35",
"@types/react-dom": "^16.9.8",
"@types/react-select": "^3.0.14",
"@types/styled-components": "^5.1.1",

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}
/>

View file

@ -148,7 +148,7 @@ export const useFetcher = () => {
const callback = useCallback(() => {
(inProduction ? fetchProduction : fetchDevelopment).then(
([appData, bookmarkData, searchData, themeData, imprintData]: any) => {
([appData, bookmarkData, searchData, themeData, imprintData]: [IAppDataProps, IBookmarkDataProps, ISearchProviderDataProps, IThemeDataProps, IImprintDataProps]) => {
(appData.error) ? setAppData(appData) : setAppData({ ...appData, error: false });
(bookmarkData.error) ? setBookmarkData(bookmarkData) : setBookmarkData({ ...bookmarkData, error: false });
(searchData.error) ? setSearchProviderData(searchData) : setSearchProviderData({ ...searchData, error: false });

View file

@ -1700,10 +1700,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.21.tgz#d934aacc22424fe9622ebf6857370c052eae464e"
integrity sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A==
"@types/node@^12.0.0":
version "12.19.14"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.14.tgz#59e5029a3c2aea34f68b717955381692fd47cafb"
integrity sha512-2U9uLN46+7dv9PiS8VQJcHhuoOjiDPZOLAt0WuA1EanEknIMae+2QbMhayF7cgGqjvRVIfNpt+6jLPczJZFiRw==
"@types/node@^14.14.35":
version "14.14.35"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.35.tgz#42c953a4e2b18ab931f72477e7012172f4ffa313"
integrity sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag==
"@types/parse-json@^4.0.0":
version "4.0.0"