Skip to content
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

Resolve TypeScript errors in React 19 (by removing the deprecated propTypes.ts) #4534

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Venryx
Copy link
Contributor

@Venryx Venryx commented Mar 9, 2025

Removed the deprecated propTypes.ts, and some remaining references to its exports, in order to make mobx-react compatible with React 19 (without TypeScript compile errors), since React 19 removes its prop-types exports of React.Requireable and React.Validator. (@mweststrate gave a go-ahead for this here)

Changelog:

  • Removed propTypes.ts, as React 19 no longer provides the types React.Requireable and React.Validator.
  • Updated docs to not mention the mobx-react specific prop-types anymore.
  • Removed the propTypes.test.ts file. (not applicable anymore, since the mobx-react specific prop-types no longer exist)
  • Removed the "component with observable propTypes" test, since it's no longer applicable. (and it was referencing typescript types that are no longer importable, so using test.skip is not sufficient)

Code change checklist

  • Added/updated unit tests
  • Updated /docs. For new functionality, at least API.md should be updated
  • Verified that there is no significant performance drop (yarn mobx test:performance)

Venryx added 2 commits March 9, 2025 12:50
…t.Requireable and React.Validator. This should resolve the remaining typescript conflicts that mobx-react had with React 19.

* Removed the "component with observable propTypes" test, since it's no longer applicable. (and it was referencing typescript types that are no longer importable, so using `test.skip` is not sufficient)
Copy link

changeset-bot bot commented Mar 9, 2025

🦋 Changeset detected

Latest commit: ea92a46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mobx-react Major

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

@Venryx Venryx mentioned this pull request Mar 9, 2025
2 tasks
@Venryx
Copy link
Contributor Author

Venryx commented Mar 9, 2025

I added a basic changelog entry for the PR: (to satisfy changeset-bot)

Removed the deprecated PropTypes export, as React 19 no longer provides the types React.Requireable and React.Validator, and this was causing TypeScript errors with @types/react@19.0.10.

I marked it as a major change (assuming even deprecated APIs are considered part of the semver-tracked api-surface), but I can change it to minor if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant