-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make mobx-react compatible with TS 4.8+ #3565
Conversation
🦋 Changeset detectedLatest commit: 13815ec The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
37c360b
to
16e3f93
Compare
Regarding the failing tests: It seems to me that these tests have always been broken. TypeScript just didn't realize it until you fixed the types. I've only skimmed the problems, but here are my best guesses: |
@DanielSWolf Thank you for the suggestions 👍 The issue with explicit signature is that we create a BC break. It looks like previously TS could infer the type correctly. But since |
@urugator The PR is ready to review 🙏 |
Resolves: #3532
As @DanielSWolf wrote (thanks for that!): "This error occurs because TypeScript 4.8 is stricter than previous versions regarding unconstrained type parameters (see the blog entry announcing TypeScript 4.8)."
I confirm that adding constraint to the generic fixes the issue. Now the generic constraints are identical to
IStoresToProps
: https://github.com/mobxjs/mobx/blob/a39ce7fbe19f92348470ef71ad60555c37a5d5e9/packages/mobx-react/src/types/IStoresToProps.ts#L2+L6I've chosen
minor
instead ofpatch
because it's kinda BC break but at the same time it's a bugfix.