-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
PropTypes & createClass warnings echo when using import * as React
#10583
Comments
It’s unfortunate. React 16 is really close and it doesn’t have this issue. We could make the getters non-enumerable I think. Not sure if that would be confusing / a breaking change? |
That should fix the issue; I doubt anyone is enumerating over Ideally the warning would only fire if you actually use either of these features; so some interception on PropType fns and |
Both of those packages export a factory function that React calls to create the package. Maybe we could wrap the exported factory result, or update the factory to accept some argument that could apply a warning at the right time? |
I’m not sure the effort to fix it (and potentially introduce other issues) is worth it given that 16 is imminent. |
Why would Flow encourage a syntax that is known to be invalid and that will be broken with real modules? 🤔 But this is perhaps a discussion for another forum. |
I think we'll just leave this unfixed as we already released 16. |
Do you want to request a feature or report a bug?
This is a bug.
What is the current behavior?
This simple script:
throws the following warnings:
What is the expected behavior?
I expect these deprecation warnings not to throw. The
import * as React
syntax is now recommended in FlowType and this is causing issues for end users in several libraries I author. See e.g. this issue.Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
This is in React 15.6.1.
The text was updated successfully, but these errors were encountered: