From d780ae59e1432b56e2928bf10a595a3ecf99efcc Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Sun, 6 Oct 2019 13:03:08 +0200 Subject: [PATCH] Added typescript types --- dist/index.d.ts | 14 ++++++++++++++ package.json | 5 +++-- src/index.d.ts | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 dist/index.d.ts create mode 100644 src/index.d.ts diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..20ce174 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,14 @@ +import React from "react"; + +export default class GoogleRecaptcha extends React.Component<{ + sitekey: string; + locale?: string; + onResolved?: () => void; + badge?: "bottomright" | "bottomleft" | "inline"; + nonce?: string; + onExpired?: () => void; + onError?: () => void; + onLoaded?: () => void; + style?: CSSStyleDeclaration; + tabindex?: number; +}>{} diff --git a/package.json b/package.json index 1a24025..b27d4ff 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "prebuild:example": "rm -rf docs && mkdir docs", "build:example": "webpack --config ./example/webpack.config.js", "prebuild": "rm -rf dist && mkdir dist ", - "build": "babel ./src --out-dir ./dist", + "build": "babel ./src --out-dir ./dist; cp src/index.d.ts dist/", "test": "echo \"No test specified\" && exit 0" }, "dependencies": { @@ -62,5 +62,6 @@ "directories": { "doc": "docs", "example": "example" - } + }, + "types": "dist/index.d.ts" } diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..20ce174 --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,14 @@ +import React from "react"; + +export default class GoogleRecaptcha extends React.Component<{ + sitekey: string; + locale?: string; + onResolved?: () => void; + badge?: "bottomright" | "bottomleft" | "inline"; + nonce?: string; + onExpired?: () => void; + onError?: () => void; + onLoaded?: () => void; + style?: CSSStyleDeclaration; + tabindex?: number; +}>{}