Cordobo / angularx-qrcode

A fast and easy-to-use Angular QR Code Generator library with Ivy support
https://cordobo.github.io/angularx-qrcode/
MIT License
459 stars 127 forks source link

Usage with Angular 15 not working (version: "angularx-qrcode": "^15.0.0") #197

Closed gocarlos closed 1 year ago

gocarlos commented 1 year ago
Warning: /Users/gocarlos/git/intuitivo1/huuper/huuper/ui/node_modules/angularx-qrcode/fesm2015/angularx-qrcode.mjs depends on 'qrcode'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Error: node_modules/angularx-qrcode/lib/angularx-qrcode.component.d.ts:40:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.

40     static ɵcmp: i0.ɵɵComponentDeclaration<QRCodeComponent, "qrcode", never, { "allowEmptyString": "allowEmptyString"; "colorDark": "colorDark"; "colorLight": "colorLight"; "cssClass": "cssClass"; "elementType": "elementType"; "errorCorrectionLevel": "errorCorrectionLevel"; "imageSrc": "imageSrc"; "imageHeight": "imageHeight"; "imageWidth": "imageWidth"; "margin": "margin"; "qrdata": "qrdata"; "scale": "scale"; "version": "version"; "width": "width"; "alt": "alt"; "ariaLabel": "ariaLabel"; "title": "title"; }, { "qrCodeURL": "qrCodeURL"; }, never, never, false, never>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

✖ Failed to compile.

with:

<div class="qrcodeImage">
      <qrcode [qrdata]="'Your data string'" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>
</div>
BenRacicot commented 1 year ago

Hope it's ok to tag mine here as well. Had to add new typings I guess.

Error: node_modules/angularx-qrcode/lib/angularx-qrcode.component.d.ts:3:44 - error TS7016: Could not find a declaration file for module 'qrcode'. '/Users/bracicot/dev/wallethack/node_modules/angularx-qrcode/node_modules/qrcode/lib/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/qrcode` if it exists or add a new declaration (.d.ts) file containing `declare module 'qrcode';`

3 import { QRCodeErrorCorrectionLevel } from "qrcode";
                                             ~~~~~~~~

Error: node_modules/angularx-qrcode/lib/types.d.ts:1:44 - error TS7016: Could not find a declaration file for module 'qrcode'. '/Users/bracicot/dev/wallethack/node_modules/angularx-qrcode/node_modules/qrcode/lib/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/qrcode` if it exists or add a new declaration (.d.ts) file containing `declare module 'qrcode';`

1 import { QRCodeErrorCorrectionLevel } from "qrcode";
                                             ~~~~~~~~
Cordobo commented 1 year ago

Hi,

thank you for your feedback!

For those looking for a quick workaround, the solution is to stop your server, run

npm i --save-dev @types/qrcode

and restart.

I will release a new version with the fix integrated.

Cordobo commented 1 year ago

The newly released version 15.0.1 with the fix has been published on npm.

Thanks again for your feedback 👍

gocarlos commented 1 year ago

great, thanks 👍