fix ref return type in tuple

This commit is contained in:
Bryan Deloeste 2019-04-11 15:38:35 -07:00
parent 01b4d030bd
commit 24092f646f
2 changed files with 4 additions and 3 deletions

View File

@ -3,6 +3,7 @@
// Definitions by: Bryan Deloeste <https://github.com/bdeloeste>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { MutableRefObject } from "react";
export function useClickOutside<T>(): [MutableRefObject<T>, boolean];
type HookReturnTuple = [((node?: Element | null) => void), boolean];
export function useClickOutside(): HookReturnTuple;

View File

@ -4,7 +4,7 @@ import { render } from "react-dom";
import { useClickOutside } from "react-click-outside-hook";
function Component() {
const [ref, hasClickedOutside] = useClickOutside<HTMLDivElement>();
const [ref, hasClickedOutside] = useClickOutside();
return <div ref={ref}>{hasClickedOutside.toString()}</div>;
}