mobxjs / mobx

Simple, scalable state management.
http://mobx.js.org
MIT License
27.46k stars 1.76k forks source link

Updating to 6.13.0 causing error: `Cannot find name 'ReadonlySetLike'. Did you mean 'ReadonlySet'?` #3903

Closed schen-fn closed 1 month ago

schen-fn commented 1 month ago

Intended outcome: Upgrading to the 6.13.0 minor update should not produce any errors, specifically the Cannot find name 'ReadonlySetLike'. Did you mean 'ReadonlySet'? error.

Actual outcome: Upon upgrading to version 6.13.0, the following error occurs: Cannot find name 'ReadonlySetLike'. Did you mean 'ReadonlySet'?.

How to reproduce the issue:

  1. Upgrade to version 6.13.0
  2. Observe the Error: Cannot find name 'ReadonlySetLike'. Did you mean 'ReadonlySet'?

Configuration Details:

Using es2020 in tsconfig.json. This issue mirrors the problem described in this release job on GitHub.

Additional Information The error is resolved by switching the target in tsconfig.json from es2020 to esnext. However, this change is not backward-compatible, which may be problematic for a minor update.

mweststrate commented 1 month ago

The release build was fixed in https://github.com/mobxjs/mobx/commit/32c934bea82feaddff01aad67231ee4a1d64ede9.

In this case you'll indeed have to update the TSLib to ESNext. Like TypeScript itself, we don't follow semantic versioning closely for static types, as otherwise we'll have to fork the package for every different tsconfig / target people are using. (E.g. if we made this a major change, it means that anyone not on esnext would stop receiving any update to MobX! Even though there is no actual functional consequence)

It is not ideal, and generally I avoid this problem (many libs suffer from it) by slamming a skipLibCheck: true in my projects' tsconfig.