ng-hcaptcha
ng-hcaptcha copied to clipboard
ng-hcaptcha error TS2344: Type '{ siteKey: { alias: "siteKey"; required: false; }
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>;
Hi @dedol1, thank you for reporting this issue! Which version of Angular do you use?
I am using angular 16.0.2
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.
I am facing the same issue, using Angular 15 and ng-hcaptcha 2.2.0. Did we find any solution ?
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
same problem...
Same problem here. I had to downgrade to version 1.+
@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 have you find any solution for this ?
Thanks
downgrade the ng hcaptcha 2.2.0 to 2.1.0, solution works for me.
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?
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.
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 :)