Note that per yarnpkg/yarn #5001, yarn global upgrade foo does not always upgrade a package to the latest version, even with the --latest flag.
For example, if you have foo v12.0.1 installed and v13.0.0 is available, this would not upgrade to v13.0.0 because yarn global upgrade currently does not go past major bumps in semver by default (see discussion in above issue for more).
Running yarn global add foodoes upgrade the currently installed version to the latest even if there is a semver major version bump between the currently installed version and the latest version.
I believe that yarn global upgrade-interactive would allow one to upgrade past major version bumps as well.