From c8b99b54e0f1161a91cfba9d39bc1b87caad2c85 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 23 Sep 2020 11:00:53 +0100 Subject: [PATCH] Fix TS definitions Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/accessibility/RovingTabIndex.tsx | 2 +- src/hooks/useLocalStorageState.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/accessibility/RovingTabIndex.tsx b/src/accessibility/RovingTabIndex.tsx index b1dbb56a01..bde626a96a 100644 --- a/src/accessibility/RovingTabIndex.tsx +++ b/src/accessibility/RovingTabIndex.tsx @@ -204,7 +204,7 @@ export const RovingTabIndexProvider: React.FC = ({children, handleHomeEn // onFocus should be called when the index gained focus in any manner // isActive should be used to set tabIndex in a manner such as `tabIndex={isActive ? 0 : -1}` // ref should be passed to a DOM node which will be used for DOM compareDocumentPosition -export const useRovingTabIndex = (inputRef: Ref): [FocusHandler, boolean, Ref] => { +export const useRovingTabIndex = (inputRef?: Ref): [FocusHandler, boolean, Ref] => { const context = useContext(RovingTabIndexContext); let ref = useRef(null); diff --git a/src/hooks/useLocalStorageState.ts b/src/hooks/useLocalStorageState.ts index ce3b574f86..943db9ab4e 100644 --- a/src/hooks/useLocalStorageState.ts +++ b/src/hooks/useLocalStorageState.ts @@ -26,7 +26,7 @@ const getValue = (key: string, initialValue: T): T => { }; // Hook behaving like useState but persisting the value to localStorage. Returns same as useState -export const useLocalStorageState = (key: string, initialValue: T) => { +export const useLocalStorageState = (key: string, initialValue: T): [T, Dispatch>] => { const lsKey = "mx_" + key; const [value, setValue] = useState(getValue(lsKey, initialValue));