Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dedol1 opened this issue May 21, 2023 · 13 comments

Comments

@dedol1
Copy link

dedol1 commented May 21, 2023

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 dedol1 changed the title ng-hcaptcha Error: Uncaught (in promise) ng-hcaptcha error TS2344: Type '{ siteKey: { alias: "siteKey"; required: false; } May 21, 2023
@leNicDev
Copy link
Owner

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

@dedol1
Copy link
Author

dedol1 commented May 26, 2023

I am using angular 16.0.2

@NicoBrg-WDG
Copy link

NicoBrg-WDG commented Jun 2, 2023

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.

@PetarBase
Copy link

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

@dedol1
Copy link
Author

dedol1 commented Jun 7, 2023

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

@ArthurIbias
Copy link

same problem...

@alexsukhodolsky
Copy link

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

@leNicDev
Copy link
Owner

@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 👍

@mkumar92
Copy link

@leNicDev have you find any solution for this ?

Thanks

@mkumar92
Copy link

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

@Netskeh
Copy link

Netskeh commented Jun 29, 2023

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?

@johamguilarte
Copy link

johamguilarte commented Jul 19, 2023

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

@jbellionjourdan
Copy link

jbellionjourdan commented Sep 6, 2023

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants