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

Accidentally pulling in @types/node #211

Closed sam-s4s closed 10 months ago

sam-s4s commented 1 year ago

Hi there. First of all, I'd like to say thank you for all your hard work on this project <3

I've just upgraded from Angular 13 to 15, and thus now upgraded to angularx-qrcode 15.

Unfortunately there is a problem with this new version, in that this project uses "@types/qrcode": "1.5.0" as a dependency, which, in turn, uses @types/node, pulling in all those types into our root project that uses angularx-qrcode - which needs to be avoided in a web environment (such as we run angularx-qrcode in).

We get nasty side-effects from the node types being added into the project, such as the return of setTimeout and setInterval being NodeJS.Timer instead of number.

Thanks!

sam-s4s commented 1 year ago

As an update, I found the commit that contains the break:

https://github.com/Cordobo/angularx-qrcode/commit/f16ea7d9af11d5f3c29145ae8516085f17832a75

"@types/qrcode": "1.5.0", was moved from devDependencies to dependencies.

Quite recent, added in version 15.0.1, Dec 15, 2022. Now I understand that version 15.0.0 was broken because it lacked this declaration, but version 14 didn't require it. It used to pull QRCodeErrorCorrectionLevel from types.ts but now it gets it from qrcode.

It would be great if this could be resolved :D Thank you!

Cordobo commented 11 months ago

Thanks to @jamesanderson9182 we have PR and a new release 👍

sam-s4s commented 11 months ago

Ok I have updated to the new version, but I think we missed a spot :(

projects/angularx-qrcode/package.json

  "dependencies": {
    "@types/qrcode": "1.5.0",
    "qrcode": "1.5.1"
  },

@types/qrcode uses @types/node :(

I think we need to move that to devDependencies, too?

sam-s4s commented 11 months ago

Ok I have added a PR for that change, I'm hoping that fixes it!

I think the general pattern is that types should normally be added only to devDependencies.

I am hoping that might stop it from propagating throughout the app that is using angularx-qrcode.

(sometimes @types/node feels like a virus lol)

sam-s4s commented 10 months ago

@Cordobo if you're around, would you mind giving this a look :) https://github.com/Cordobo/angularx-qrcode/pull/222

Cordobo commented 10 months ago

Sorry for the delay, I was on vacation. I'm updating it this weekend right now.

Cordobo commented 10 months ago

Fixed with angularx-qrcode 16.0.2! Thanks for your contributions 👍