From 1d763615de79cdd22db8da76de00c31830cdd274 Mon Sep 17 00:00:00 2001 From: Jaden Date: Mon, 5 Aug 2024 16:47:28 +0100 Subject: [PATCH 1/3] Re-add typing overloads for the `execute` method. In this pull request (https://github.com/hCaptcha/react-hcaptcha/pull/233) it seems some nice overloads were removed. I've adjusted it back to how originally was and added rqdata. --- types/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 254382c..a49f92a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -50,7 +50,9 @@ declare class HCaptcha extends React.Component { getResponse(): string; setData(data: object): void; isReady(): boolean; - execute(opts?: { async?: boolean, rqdata?: string }): Promise | void; + execute(opts: { async: true, rqdata?: string }): Promise; + execute(opts?: { async: false, rqdata?: string }): void; + execute(opts?: { async: boolean, rqdata?: string }): Promise | void; } export = HCaptcha; From 4e19dbf72baf0dda1fcf77466648427105a7f5ab Mon Sep 17 00:00:00 2001 From: Jaden Date: Mon, 5 Aug 2024 16:54:08 +0100 Subject: [PATCH 2/3] Adjust typings again This makes more sense to me, since it could only ever be a boolean type when opts is not undefined. --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index a49f92a..5a90e99 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -52,7 +52,7 @@ declare class HCaptcha extends React.Component { isReady(): boolean; execute(opts: { async: true, rqdata?: string }): Promise; execute(opts?: { async: false, rqdata?: string }): void; - execute(opts?: { async: boolean, rqdata?: string }): Promise | void; + execute(opts: { async: boolean, rqdata?: string }): Promise | void; } export = HCaptcha; From 659a57f1196a8e80efa4c19156b1b5788f2da4ab Mon Sep 17 00:00:00 2001 From: Jaden Date: Tue, 6 Aug 2024 16:30:55 +0100 Subject: [PATCH 3/3] Update index.d.ts --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 5a90e99..f105ef4 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -52,7 +52,7 @@ declare class HCaptcha extends React.Component { isReady(): boolean; execute(opts: { async: true, rqdata?: string }): Promise; execute(opts?: { async: false, rqdata?: string }): void; - execute(opts: { async: boolean, rqdata?: string }): Promise | void; + execute(opts?: { async?: boolean, rqdata?: string }): Promise | void; } export = HCaptcha;