angularx-qrcode icon indicating copy to clipboard operation
angularx-qrcode copied to clipboard

Could not find a declaration file for module 'qrcode'

Open GoldenDragon0710 opened this issue 1 year ago • 8 comments

Now I am going to generate QR code in ionic/angular app with angular v17, using angularx-qrcode. But I received this error: Could not find a declaration file for module 'qrcode' How to solve this issue? Screenshot 2024-02-03 050142

GoldenDragon0710 avatar Feb 03 '24 10:02 GoldenDragon0710

same here

psomby avatar Feb 05 '24 13:02 psomby

Same here for Angular 17 web app

fix87 avatar Feb 12 '24 13:02 fix87

same here

npm i qrcode npm i --save-dev @types/qrcode

will fix this issue but should be dependency

williamlodewijks avatar Feb 13 '24 17:02 williamlodewijks

The same here too

Amagarai avatar Mar 07 '24 19:03 Amagarai

I noticed that the qrcode dependency installed with angularx-code does not have a build folder unlike the previous version in the node module

Amagarai avatar Mar 08 '24 22:03 Amagarai

For me it finally works. 1- I manually installed version 1.51 of qrcode as it comes directly with the build directory : npm install --save [email protected] 2- since I use standalone I have an import in the import of the same component that I use

Amagarai avatar Mar 08 '24 23:03 Amagarai

I got the same error as @GoldenDragon0710 got.
Follow these steps to solve the problem. Go to this file :
node_modules\angularx-qrcode\lib\angularx-qrcode.component.d.ts Simply change: import { QRCodeErrorCorrectionLevel } from "qrcode";
to import { QRCodeErrorCorrectionLevel } from "angularx-qrcode";

@Cordobo I think there is miss writing .

engabdalb avatar Apr 17 '24 18:04 engabdalb

This appears to be the same issue as https://github.com/Cordobo/angularx-qrcode/issues/227, and the fix made there appears to not fully have resolved the problem. The reference to QRCodeErrorCorrectionLevel was updated in the demo app, but not the actual library component which was causing the problem. The workaround there was adding @types/qrcode as a dev dependency - it appears that this workaround still works to address this problem, and the qrcode package should not need to be directly installed.

I would guess that this should be as simple as changing the import of QRCodeErrorCorrectionLevel in angularx-qrcode.component.ts so that it is imported from ./types (instead of from qrcode).

simonpietsch avatar Apr 24 '24 06:04 simonpietsch

Thanks for your comments and contributions, the bug has been fixed.

Cordobo avatar May 08 '24 22:05 Cordobo