summaryrefslogtreecommitdiff
path: root/src/reCAPTCHA.ts
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2021-08-19 12:14:37 -0400
committergumi <git@gumi.ca>2021-08-19 12:21:16 -0400
commit802fb4adaf2e4ffd76b08dc23e29e4c8f4bed543 (patch)
treeeed99a377249bdac523c275614925078e6e02167 /src/reCAPTCHA.ts
parentc3d48e0be54364cf14df4eb1c3ed49d74ae8ab6d (diff)
downloadwebsite-802fb4adaf2e4ffd76b08dc23e29e4c8f4bed543.tar.gz
website-802fb4adaf2e4ffd76b08dc23e29e4c8f4bed543.tar.bz2
website-802fb4adaf2e4ffd76b08dc23e29e4c8f4bed543.tar.xz
website-802fb4adaf2e4ffd76b08dc23e29e4c8f4bed543.zip
fix some typescript warnings
Diffstat (limited to 'src/reCAPTCHA.ts')
-rw-r--r--src/reCAPTCHA.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/reCAPTCHA.ts b/src/reCAPTCHA.ts
index 51a6350..471cc9b 100644
--- a/src/reCAPTCHA.ts
+++ b/src/reCAPTCHA.ts
@@ -3,13 +3,16 @@
const loadHandler = "onRecaptchaLoad";
const script = `https://www.google.com/recaptcha/api.js?onload=${loadHandler}`;
+// @ts-ignore
+type gRecaptchaInstance = any;
+
export default class ReCaptchaLoader {
/**
* asynchronously injects reCAPTCHA and resolves once fully loaded
*
- * @return {Promise<Object>} the grecaptcha inferface
+ * @return {Promise<gRecaptchaInstance>} the grecaptcha inferface
*/
- static load () {
+ static load (): Promise<gRecaptchaInstance> {
return new Promise((resolve, reject) => {
if (Reflect.has(self, "grecaptcha")) {
// we already have it loaded: reset it
@@ -48,11 +51,11 @@ export default class ReCaptchaLoader {
/**
* checks whether reCAPTCHA is ready to use
*/
- static get isReady () {
+ static get isReady (): boolean {
return Reflect.has(self, "grecaptcha");
}
- static get instance () {
+ static get instance (): gRecaptchaInstance {
return this.isReady ? Reflect.get(self, "grecaptcha"): null;
}
}