angularx-qrcode
angularx-qrcode copied to clipboard
Could not find a declaration file for module 'qrcode'
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?
same here
Same here for Angular 17 web app
same here
npm i qrcode
npm i --save-dev @types/qrcode
will fix this issue but should be dependency
The same here too
I noticed that the qrcode dependency installed with angularx-code does not have a build folder unlike the previous version in the node module
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
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 .
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
).
Thanks for your comments and contributions, the bug has been fixed.