diff --git a/types/react-outside-click-handler/index.d.ts b/types/react-outside-click-handler/index.d.ts new file mode 100644 index 0000000000..470e2c3657 --- /dev/null +++ b/types/react-outside-click-handler/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for react-outside-click-handler 1.2 +// Project: https://github.com/airbnb/react-outside-click-handler +// Definitions by: Ivan Zub +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +import * as React from "react"; + +export interface DefaultProps { + disabled: boolean; + useCapture: boolean; + display: "block" | "flex" | "inline-block"; +} + +// TODO: Remove partial once DT support TS 3.0, so skipping mandatory listed in default props won't result in compile error +export interface Props extends Partial { + children: React.ReactNode; + onOutsideClick: (e: React.MouseEvent) => void; +} + +export default class OutsideClickHandler extends React.Component { + static defaultProps: DefaultProps; +} diff --git a/types/react-outside-click-handler/test/react-outside-click-handler-tests.tsx b/types/react-outside-click-handler/test/react-outside-click-handler-tests.tsx new file mode 100644 index 0000000000..116cabcf56 --- /dev/null +++ b/types/react-outside-click-handler/test/react-outside-click-handler-tests.tsx @@ -0,0 +1,21 @@ +import * as React from "react"; + +import OutsideClickHandler from "react-outside-click-handler"; + +const onClickOutside: (event: React.MouseEvent) => void = () => {}; + + + Child +; + + + Child +; + + + Child +; + + + Child +; diff --git a/types/react-outside-click-handler/tsconfig.json b/types/react-outside-click-handler/tsconfig.json new file mode 100644 index 0000000000..4121effb03 --- /dev/null +++ b/types/react-outside-click-handler/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "jsx": "react", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/react-outside-click-handler-tests.tsx" + ] +} diff --git a/types/react-outside-click-handler/tslint.json b/types/react-outside-click-handler/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/react-outside-click-handler/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}