From 3a13a0d0244cf92cec2e11eefdbd90264d8108c5 Mon Sep 17 00:00:00 2001 From: Alessandro Rabitti Date: Fri, 17 Jan 2020 17:38:46 +0100 Subject: [PATCH] [@types/react-recaptcha-v3] Add react-recaptcha-v3 definitions (#41585) * Add react-recaptcha-v3 definitions * Fix react-recaptcha-v3 type definition comment in index.d.ts * Fix react-recaptcha-v3 type definition comment in index.d.ts * Fix import ReCaptcha for tests --- types/react-recaptcha-v3/index.d.ts | 25 +++++++++++++++++++ .../react-recaptcha-v3-tests.tsx | 11 ++++++++ types/react-recaptcha-v3/tsconfig.json | 25 +++++++++++++++++++ types/react-recaptcha-v3/tslint.json | 1 + 4 files changed, 62 insertions(+) create mode 100644 types/react-recaptcha-v3/index.d.ts create mode 100644 types/react-recaptcha-v3/react-recaptcha-v3-tests.tsx create mode 100644 types/react-recaptcha-v3/tsconfig.json create mode 100644 types/react-recaptcha-v3/tslint.json diff --git a/types/react-recaptcha-v3/index.d.ts b/types/react-recaptcha-v3/index.d.ts new file mode 100644 index 0000000000..7ff10a704a --- /dev/null +++ b/types/react-recaptcha-v3/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for react-recaptcha-v3 1.1 +// Project: https://github.com/codeep/react-recaptcha-v3 +// Definitions by: Alessandro Rabitti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Component } from "react"; + +export = ReCaptcha; + +declare namespace ReCaptcha { + interface ReCaptchaProps { + elementID?: string; + sitekey: string; + action: string; + verifyCallback?(response: string): any; + verifyCallbackName?: string; + } +} + +declare class ReCaptcha extends Component { + static propTypes: any; + static defaultProps: ReCaptcha.ReCaptchaProps; + execute(): void; +} diff --git a/types/react-recaptcha-v3/react-recaptcha-v3-tests.tsx b/types/react-recaptcha-v3/react-recaptcha-v3-tests.tsx new file mode 100644 index 0000000000..0e6310a922 --- /dev/null +++ b/types/react-recaptcha-v3/react-recaptcha-v3-tests.tsx @@ -0,0 +1,11 @@ +import * as ReCaptcha from "react-recaptcha-v3"; +import * as ReactDOM from "react-dom"; +import * as React from "react"; + +ReactDOM.render( + , + document.getElementById('form-recaptcha') +); diff --git a/types/react-recaptcha-v3/tsconfig.json b/types/react-recaptcha-v3/tsconfig.json new file mode 100644 index 0000000000..5ff6344893 --- /dev/null +++ b/types/react-recaptcha-v3/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "jsx": "react", + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-recaptcha-v3-tests.tsx" + ] +} diff --git a/types/react-recaptcha-v3/tslint.json b/types/react-recaptcha-v3/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-recaptcha-v3/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }