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 125 forks source link

Could not find a declaration file for module 'qrcode' #236

Closed GoldenDragon0710 closed 2 months ago

GoldenDragon0710 commented 5 months ago

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

psomby commented 5 months ago

same here

fix87 commented 4 months ago

Same here for Angular 17 web app

williamlodewijks commented 4 months ago

same here

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

will fix this issue but should be dependency

Amagarai commented 4 months ago

The same here too

Amagarai commented 4 months ago

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 commented 4 months ago

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 qrcode@1.5.1 2- since I use standalone I have an import in the import of the same component that I use

engabdalb commented 2 months ago

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 .

simonpietsch commented 2 months ago

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

Cordobo commented 2 months ago

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