diff --git a/types/react-click-outside-hook/index.d.ts b/types/react-click-outside-hook/index.d.ts new file mode 100644 index 0000000000..3e4d845753 --- /dev/null +++ b/types/react-click-outside-hook/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for react-click-outside-hook 1.0 +// Project: https://github.com/bdeloeste/react-click-outside-hook#readme +// Definitions by: Bryan Deloeste +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { MutableRefObject } from "react"; + +export function useClickOutside(): [MutableRefObject, boolean]; diff --git a/types/react-click-outside-hook/react-click-outside-hook-tests.tsx b/types/react-click-outside-hook/react-click-outside-hook-tests.tsx new file mode 100644 index 0000000000..b5ce2ad7a6 --- /dev/null +++ b/types/react-click-outside-hook/react-click-outside-hook-tests.tsx @@ -0,0 +1,11 @@ +import * as React from "react"; +import { render } from "react-dom"; + +import { useClickOutside } from "react-click-outside-hook"; + +function Component() { + const [ref, hasClickedOutside] = useClickOutside(); + return
{hasClickedOutside.toString()}
; +} + +render(, document.getElementById("test")); diff --git a/types/react-click-outside-hook/tsconfig.json b/types/react-click-outside-hook/tsconfig.json new file mode 100644 index 0000000000..4d9fefbdc4 --- /dev/null +++ b/types/react-click-outside-hook/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "jsx": "react", + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-click-outside-hook-tests.tsx"] +} diff --git a/types/react-click-outside-hook/tslint.json b/types/react-click-outside-hook/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-click-outside-hook/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }