ng-hcaptcha icon indicating copy to clipboard operation
ng-hcaptcha copied to clipboard

ng-hcaptcha error TS2344: Type '{ siteKey: { alias: "siteKey"; required: false; }

Open dedol1 opened this issue 2 years ago • 13 comments
trafficstars

I get the below error when I add : <ng-hcaptcha (verify)="onVerify($event)" (expired)="onExpired($event)" (error)="onError($event)"> to my component.html file.

Error: ../node_modules/ng-hcaptcha/lib/ng-hcaptcha-invisible-button.directive.d.ts:39:118 - error TS2344: Type '{ siteKey: { alias: "siteKey"; required: false; }; languageCode: { alias: "languageCode"; required: false; }; }' does not satisfy the constraint '{ [key: string]: string; }'. Property '"siteKey"' is incompatible with index signature. Type '{ alias: "siteKey"; required: false; }' is not assignable to type 'string'.

39 static ɵdir: i0.ɵɵDirectiveDeclaration<NgHcaptchaInvisibleButtonDirective, "[ngHcaptchaInvisibleButton]", never, { "siteKey": { "alias": "siteKey"; "required": false; }; "languageCode": { "alias": "languageCode"; "required": false; }; }, { "verify": "verify"; "expired": "expired"; "error": "error"; "click": "click"; }, never, never, false, never>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: ../node_modules/ng-hcaptcha/lib/ng-hcaptcha.component.d.ts:48:87 - error TS2344: Type '{ siteKey: { alias: "siteKey"; required: false; }; theme: { alias: "theme"; required: false; }; size: { alias: "size"; required: false; }; tabIndex: { alias: "tabIndex"; required: false; }; languageCode: { ...; }; }' does not satisfy the constraint '{ [key: string]: string; }'. Property '"siteKey"' is incompatible with index signature. Type '{ alias: "siteKey"; required: false; }' is not assignable to type 'string'.

48 static ɵcmp: i0.ɵɵComponentDeclaration<NgHcaptchaComponent, "ng-hcaptcha", never, { "siteKey": { "alias": "siteKey"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "size": { "alias": "size"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "languageCode": { "alias": "languageCode"; "required": false; }; }, { "verify": "verify"; "expired": "expired"; "error": "error"; }, never, never, false, never>;

dedol1 avatar May 21 '23 00:05 dedol1

Hi @dedol1, thank you for reporting this issue! Which version of Angular do you use?

leNicDev avatar May 26 '23 13:05 leNicDev

I am using angular 16.0.2

dedol1 avatar May 26 '23 15:05 dedol1

I just ran into the same error with angular 15 and hcaptcha 2.1.0. It came out of nowhere as I only made some small and completely unrelated changes. I tried to delete my node_modules and downloading them back, upgrading hcpatcha to 2.2.0, but the error was still there. Finally I tried to checkout an older commit in my project and then the error disappeared. Checked out my last changes and it kept working. Not sure what happened.

NicoBrg-WDG avatar Jun 02 '23 15:06 NicoBrg-WDG

I am facing the same issue, using Angular 15 and ng-hcaptcha 2.2.0. Did we find any solution ?

PetarBase avatar Jun 05 '23 10:06 PetarBase

I still haven't been able to identify what the issue is, kindly post your findings here in case you do come across any. I will also do same

dedol1 avatar Jun 07 '23 14:06 dedol1

same problem...

ArthurIbias avatar Jun 09 '23 18:06 ArthurIbias

Same problem here. I had to downgrade to version 1.+

alexsukhodolsky avatar Jun 11 '23 17:06 alexsukhodolsky

@dedol1 @NicoBrg-WDG @PetarBase @ArthurIbias @alexsukhodolsky Thank you for reporting this issue! I haven't been able to find the root cause yet but I'm going to take some time for it tomorrow 👍

leNicDev avatar Jun 11 '23 21:06 leNicDev

@leNicDev have you find any solution for this ?

Thanks

mkumar92 avatar Jun 14 '23 10:06 mkumar92

downgrade the ng hcaptcha 2.2.0 to 2.1.0, solution works for me.

mkumar92 avatar Jun 14 '23 12:06 mkumar92

dropping some info here: I feel like it is related to the version of node you are using to compile. Unfortunately I do not have much time to run additional tests. I got 2.1.0 not working with node 16.14, but with 16.20 Then 2.2.0 failing with both previous versions, but I expect (NOT TESTED) it to be working with a recent 18.x version?

Netskeh avatar Jun 29 '23 11:06 Netskeh

the version of node 16.15.0 failed, so I changed to the version of node that you mention 18.X specifically 18.10, 18.15 and the error persists.

Screenshot from 2023-07-19 16-32-27

johamguilarte avatar Jul 19 '23 20:07 johamguilarte

Hi there,

i had this issue with the following configuration : angular 15.2.9 ng-hcaptcha 2.2.0 Node 18.17.1 npm 9.6.7

Downgrading ng-hcaptcha to 2.1.0 fixed the issue for me. I guess 2.2.0 is just simply incompatible with angular 15 ? If so, it would be nice to state it in the README :)

jbellionjourdan avatar Sep 06 '23 18:09 jbellionjourdan