mifi / react-lottie-player

Fully declarative React Lottie player
MIT License
495 stars 52 forks source link

update lottie-web to fix typescript type #52

Closed yusifsalam closed 2 years ago

yusifsalam commented 2 years ago

This commit updates lottie-web to the latest version. Reason: audioFactory type defs were added in version 5.7.9 (merged commit preceding the release https://github.com/airbnb/lottie-web/commit/66ce9e1c147b9ee4dff3ef3b4576e60cafd5cd93). Currently the included version of lottie-web 5.7.6 is missing those types and thus typescript complains about missing prop audioFactory when creating a new Lottie object.

mifi commented 2 years ago

Thanks for your PR! I'm not sure however whether your change will make any difference, because semver ^5.7.6 will also resolve to 5.7.14. I can confirm this by

yarn init
yarn add react-lottie-player
yarn why lottie-web
=> Found "lottie-web@5.7.14"

or am I missing something?

yusifsalam commented 2 years ago

Ok, I did some digging and seems like it's because of yarn upgrade-interactive that my lottie-web package wasn't updated. When upgrading react-lottie-player in an existing project:

yarn list
  react-lottie-player@1.3.1
  │  ├─ fast-deep-equal@^3.1.3
  │  └─ lottie-web@^5.7.6

cat yarn.lock | grep lottie-web
  lottie-web@^5.7.6:
    resolved "https://registry.yarnpkg.com/lottie-web/-/lottie-web-5.7.8.tgz#c7a2e42983bcb42093590a03ccdde8741d3f960e"
      lottie-web "^5.7.6"

You can see that I had react-lottie-player 1.3.1 installed with lottie-web 5.7.8.

yarn upgrade-interactive --latest
  yarn upgrade-interactive v1.22.17
  success Saved lockfile.
  success Saved 2 new dependencies.
  info Direct dependencies
  └─ react-lottie-player@1.4.1
  info All dependencies
  ├─ lodash.clonedeep@4.5.0
  └─ react-lottie-player@1.4.1

After that, I check the installed version of lottie-web from the lock file again:

cat yarn.lock | grep lottie-web
  lottie-web@^5.7.6:
    resolved "https://registry.yarnpkg.com/lottie-web/-/lottie-web-5.7.8.tgz#c7a2e42983bcb42093590a03ccdde8741d3f960e"
      lottie-web "^5.7.6"

Running yarn upgrade directly:

yarn upgrade react-lottie-player
  yarn upgrade v1.22.17
  success Saved lockfile.
  success Saved 4 new dependencies.
  info Direct dependencies
  └─ react-lottie-player@1.4.1
  info All dependencies
  ├─ fast-deep-equal@3.1.3
  ├─ lodash.clonedeep@4.5.0
  ├─ lottie-web@5.7.14
  └─ react-lottie-player@1.4.1

I guess this is just a yarn bug, so feel free to close this PR. Thanks for maintaining this project btw :)

yusifsalam commented 2 years ago

Whoops I accidentally closed it myself.