Enable @typescript-eslint/explicit-function-return-type in /src (#9788)

* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier

* Enable `@typescript-eslint/explicit-function-return-type` in /src

* Fix types

* tsc strict fixes

* Delint

* Fix test

* Fix bad merge
This commit is contained in:
Michael Telatynski 2023-01-12 13:25:14 +00:00 committed by GitHub
parent 7a36ba0fde
commit 030b7e90bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
683 changed files with 3459 additions and 3013 deletions

View file

@ -22,11 +22,17 @@ import { useEffect, useRef, useState } from "react";
* @param {boolean} defaultValue Default value
* @param {number} timeoutMs Time after that the value will be reset
*/
export const useTimeoutToggle = (defaultValue: boolean, timeoutMs: number) => {
export const useTimeoutToggle = (
defaultValue: boolean,
timeoutMs: number,
): {
value: boolean;
toggle(): void;
} => {
const timeoutId = useRef<number | undefined>();
const [value, setValue] = useState<boolean>(defaultValue);
const toggle = () => {
const toggle = (): void => {
setValue(!defaultValue);
timeoutId.current = window.setTimeout(() => setValue(defaultValue), timeoutMs);
};