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

React 19 PropTypes Deprecation - Future Strategy #80

Open
mqklin opened this issue Dec 9, 2024 · 2 comments
Open

React 19 PropTypes Deprecation - Future Strategy #80

mqklin opened this issue Dec 9, 2024 · 2 comments

Comments

@mqklin
Copy link

mqklin commented Dec 9, 2024

Will this library continue to support PropTypes validation? If yes, in which way?
I'm asking because I don't plan to move to TypeScript, so my only option for now is to write a custom babel-plugin which will call prop-types/checkPropTypes'.

@ljharb
Copy link
Owner

ljharb commented Dec 9, 2024

Given that React >= 19 won't actually run propTypes validators, I'm not sure what continued support here looks like. iow, I'll of course continue to fix bugs, but unless someone comes up with a good approach (perhaps, your babel plugin) to keep using PropTypes with components, I expect usage of packages like this to fade.

@mqklin
Copy link
Author

mqklin commented Dec 9, 2024

I've just faced another issue: latest prop-types relies on old react-is version, which does not support Symbol.for(react.transitional.element) as a $$typeof. Means that using PropTypes.element also needs to be transformed somehow, as prop-types is archived and cannot be upgraded.
I (I mean ChatGPT) wrote a simple plugin that allows to run _checkPropTypes with forbidExtraProps (maybe it's enough for other custom validators too) .
But seems like this $$typeof issue is in another dimension. I think I will write my own utils/reactElementPropType.js prop type, which will just proxy to the latest reactIs.isElement version. Maybe adding this updated element to this lib could be named as a "continued support".

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

No branches or pull requests

2 participants