From cb475909b047ebb0e8080991a27187ba4219da89 Mon Sep 17 00:00:00 2001 From: Valentin Politov Date: Thu, 13 Oct 2022 12:59:10 +0300 Subject: [PATCH] fix: rename hooks ReturnType to Output --- src/useBoolean/useBoolean.ts | 4 ++-- src/useCounter/useCounter.ts | 4 ++-- src/useLockedBody/useLockedBody.ts | 4 ++-- website/src/components/layout/useSidebar.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/useBoolean/useBoolean.ts b/src/useBoolean/useBoolean.ts index e2041b74..5beff34b 100644 --- a/src/useBoolean/useBoolean.ts +++ b/src/useBoolean/useBoolean.ts @@ -1,6 +1,6 @@ import { Dispatch, SetStateAction, useCallback, useState } from 'react' -interface ReturnType { +interface UseBooleanOutput { value: boolean setValue: Dispatch> setTrue: () => void @@ -8,7 +8,7 @@ interface ReturnType { toggle: () => void } -function useBoolean(defaultValue?: boolean): ReturnType { +function useBoolean(defaultValue?: boolean): UseBooleanOutput { const [value, setValue] = useState(!!defaultValue) const setTrue = useCallback(() => setValue(true), []) diff --git a/src/useCounter/useCounter.ts b/src/useCounter/useCounter.ts index 05a69a59..9f850449 100644 --- a/src/useCounter/useCounter.ts +++ b/src/useCounter/useCounter.ts @@ -1,6 +1,6 @@ import { Dispatch, SetStateAction, useState } from 'react' -interface ReturnType { +interface UseCounterOutput { count: number increment: () => void decrement: () => void @@ -8,7 +8,7 @@ interface ReturnType { setCount: Dispatch> } -function useCounter(initialValue?: number): ReturnType { +function useCounter(initialValue?: number): UseCounterOutput { const [count, setCount] = useState(initialValue || 0) const increment = () => setCount(x => x + 1) diff --git a/src/useLockedBody/useLockedBody.ts b/src/useLockedBody/useLockedBody.ts index ea9af4c8..35ffc24e 100644 --- a/src/useLockedBody/useLockedBody.ts +++ b/src/useLockedBody/useLockedBody.ts @@ -2,9 +2,9 @@ import { useEffect, useState } from 'react' import { useIsomorphicLayoutEffect } from '..' -type ReturnType = [boolean, (locked: boolean) => void] +type UseLockedBodyOutput = [boolean, (locked: boolean) => void] -function useLockedBody(initialLocked = false): ReturnType { +function useLockedBody(initialLocked = false): UseLockedBodyOutput { const [locked, setLocked] = useState(initialLocked) // Do the side effect before render diff --git a/website/src/components/layout/useSidebar.ts b/website/src/components/layout/useSidebar.ts index f3ed424e..938422ae 100644 --- a/website/src/components/layout/useSidebar.ts +++ b/website/src/components/layout/useSidebar.ts @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react' import { useMediaQuery, useTheme } from '@mui/material' -type ReturnType = [ +type UseSidebarOutput = [ boolean, { openSidebar: () => void @@ -10,7 +10,7 @@ type ReturnType = [ }, ] -function useSidebar(): ReturnType { +function useSidebar(): UseSidebarOutput { const { breakpoints } = useTheme() const isMobile = useMediaQuery(breakpoints.down('lg')) const [isOpen, setOpen] = useState(false)