Resolve TypeScript errors in React 19 (by removing the deprecated propTypes.ts)
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.RequireableandReact.Validator. - Updated docs to not mention the mobx-react specific prop-types anymore.
- Removed the
propTypes.test.tsfile. (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.skipis not sufficient)
Code change checklist
- [X] Added/updated unit tests
- [X] Updated
/docs. For new functionality, at leastAPI.mdshould be updated - [X] Verified that there is no significant performance drop (
yarn mobx test:performance)
🦋 Changeset detected
Latest commit: f5c0fe72b0617903032ee71fc7bfb5498de1a364
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
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.RequireableandReact.Validator, and this was causing TypeScript errors with@types/[email protected].
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.
I've added the second change requested (compatibility table update in readme). [although, I'm not 100% sure it matches what you wanted/expected]
I'm also trying to add the first change requested (adding of react 19 as a peer dependency). But git appears to have a hook that warns me to run "yarn install" prior to pushing. When I do so, it seems to result in a massive set of changes to the lock file, which would not be feasible for maintainers to visually review. So I imagine this step would have to be performed by an existing trusted maintainer (to ensure the lock file is authentic).
Note: It's possible I'm running a different version of yarn? Running "yarn install" resulted in an unexpectedly large set of file changes. (to .yarnrc.yml, yarn.lock, install-state.gz, mobx/package.json, mobx-react/package.json, and mobx-react-lite/package.json)