sweetalert2 / ngx-sweetalert2

Declarative, reactive, and template-driven SweetAlert2 integration for Angular
MIT License
652 stars 94 forks source link

Generic type 'ɵɵ*Declaration' requires between x and y type arguments. #232

Open NathanAlcantara opened 1 year ago

NathanAlcantara commented 1 year ago

Hello, i'm getting this error on Angular 14.2.0 for swal and swalPortal both Component and Directive.

This cause a failure to build. Can you help me? I'm doing wrong?

I'm just install latest versions of ngx-sweetalert2 (12.1.0) and sweetalert2 (11.6.16) and import the module.

Stack:

Error: node_modules/@sweetalert2/ngx-sweetalert2/lib/swal-portal.component.d.ts:11:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.

11     static ɵcmp: i0.ɵɵComponentDeclaration<SwalPortalComponent, "swal-portal", never, { "template": "template"; }, {}, never, never, false, never>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@sweetalert2/ngx-sweetalert2/lib/swal-portal.directive.d.ts:88:18 - error TS2707: Generic type 'ɵɵDirectiveDeclaration' requires between 6 and 8 type arguments.

88     static ɵdir: i0.ɵɵDirectiveDeclaration<SwalPortalDirective, "[swalPortal]", never, { "target": "swalPortal"; }, {}, never, never, false, never>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.component.d.ts:269:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.

269     static ɵcmp: i0.ɵɵComponentDeclaration<SwalComponent, "swal", never, { "title": "title"; "titleText": "titleText"; "text": "text"; "html": "html"; "footer": "footer"; "icon": "icon"; "iconColor": "iconColor"; "iconHtml": "iconHtml"; "backdrop": "backdrop"; "toast": "toast"; "target": "target"; "input": "input"; "width": "width"; "padding": "padding"; "background": "background"; "position": "position"; "grow": "grow"; "showClass": "showClass"; "hideClass": "hideClass"; "customClass": "customClass"; "timer": "timer"; "timerProgressBar": "timerProgressBar"; "heightAuto": "heightAuto"; "allowOutsideClick": "allowOutsideClick"; "allowEscapeKey": "allowEscapeKey"; "allowEnterKey": "allowEnterKey"; "stopKeydownPropagation": "stopKeydownPropagation"; "keydownListenerCapture": "keydownListenerCapture"; "showConfirmButton": "showConfirmButton"; "showDenyButton": "showDenyButton"; "showCancelButton": "showCancelButton"; "confirmButtonText": "confirmButtonText"; "denyButtonText": "denyButtonText"; "cancelButtonText": "cancelButtonText"; "confirmButtonColor": "confirmButtonColor"; "denyButtonColor": "denyButtonColor"; "cancelButtonColor": "cancelButtonColor"; "confirmButtonAriaLabel": "confirmButtonAriaLabel"; "denyButtonAriaLabel": "denyButtonAriaLabel"; "cancelButtonAriaLabel": "cancelButtonAriaLabel"; "buttonsStyling": "buttonsStyling"; "reverseButtons": "reverseButtons"; "focusConfirm": "focusConfirm"; "focusDeny": "focusDeny"; "focusCancel": "focusCancel"; "showCloseButton": "showCloseButton"; "closeButtonHtml": "closeButtonHtml"; "closeButtonAriaLabel": "closeButtonAriaLabel"; "loaderHtml": "loaderHtml"; "showLoaderOnConfirm": "showLoaderOnConfirm"; "preConfirm": "preConfirm"; "preDeny": "preDeny"; "imageUrl": "imageUrl"; "imageWidth": "imageWidth"; "imageHeight": "imageHeight"; "imageAlt": "imageAlt"; "inputLabel": "inputLabel"; "inputPlaceholder": "inputPlaceholder"; "inputValue": "inputValue"; "inputOptions": "inputOptions"; "inputAutoTrim": "inputAutoTrim"; "inputAttributes": "inputAttributes"; "inputValidator": "inputValidator"; "returnInputValueOnDeny": "returnInputValueOnDeny"; "validationMessage": "validationMessage"; "progressSteps": "progressSteps"; "currentProgressStep": "currentProgressStep"; "progressStepsDistance": "progressStepsDistance"; "scrollbarPadding": "scrollbarPadding"; "swalOptions": "swalOptions"; "swalFireOnInit": "swalFireOnInit"; "swalDismissOnDestroy": "swalDismissOnDestroy"; "swalVisible": "swalVisible"; }, { "willOpen": "willOpen"; "didOpen": "didOpen"; "didRender": "didRender"; "willClose": "willClose"; "didClose": "didClose"; "didDestroy": "didDestroy"; "confirm": "confirm"; "deny": "deny"; "dismiss": "dismiss"; }, never, never, false, never>;
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@sweetalert2/ngx-sweetalert2/lib/swal.directive.d.ts:106:18 - error TS2707: Generic type 'ɵɵDirectiveDeclaration' requires between 6 and 8 type arguments.

106     static ɵdir: i0.ɵɵDirectiveDeclaration<SwalDirective, "[swal]", never, { "swal": "swal"; }, { "confirm": "confirm"; "deny": "deny"; "dismiss": "dismiss"; }, never, never, false, never>;
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Faycop commented 1 year ago

I'm having the same issue and I have tried every example in the documentation.

Faycop commented 1 year ago

I've managed to resolve this by installing the previous release of ngx-sweetalert2:

npm i sweetalert2 @sweetalert2/ngx-sweetalert2@12.0.1

I still receive this warning at building thogh:

Warning: /.../node_modules/@sweetalert2/ngx-sweetalert2/fesm2015/sweetalert2-ngx-sweetalert2.mjs depends on 'sweetalert2'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

NathanAlcantara commented 1 year ago

I tried the same and worked! tks @Faycop!

In my package.json i just put ~12.0.2, so the error is in 12.1.0!

About the CommonJS warning there is a closed issue about this: #230 :wink:

fsegurai commented 1 year ago

Same issue with ~12.1.0 version

I had to downgrade to ~12.0.2 version and the error stopped appearing.

fsegurai commented 1 year ago

@limonte can you help us on this one?

jdelmerie commented 1 year ago

Same issue but it seem like downgrading to 12.0.2 thanks

vTodorov commented 1 year ago

+1

fsegurai commented 1 year ago

While using Angular v14, only versions <= 12.0.2 worked, now I'm using Angular v15 and the version 12.1.0 works just fine (haven't encountered any issues so far). I think that the README file needs to be updated specifying the versions we are supposed to use based on the project version.

iSeremet-Reloadly commented 2 weeks ago

For me, even downgrading to v12.0.0 its not working.