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
import * as React from 'react'
causes deprecation warnings
#4673
Comments
import * as React from 'react'
causes deprecation warnings (react-test-renderer only)import * as React from 'react'
causes deprecation warnings
Ah, interesting. Looks like the I can't think of a good way around this on any level. The require wildcard is needed to know to import the namespace with |
Thanks asolove. Because we want to keep our tests free of warnings, I'd like to find a workaround. Options:
|
Have the same issue after implementing flow in my project. Explicitly importing the needed types like @dgcoffman did in Option 1 got rid of the warnings. |
Ran into the same issue. At least we should fix the React docs section, which directly suggests import * as React from 'react'; |
I think the thing is, that really is the way we want people to do the import in order to be able to use the React types. So maybe docs should warn you about this message, but I don't think the advice itself should change. /cc @calebmer would love to know if FB folks have a way to fix this either on the React or Flow side. |
@asolove explanation in [here](facebook#4673)
I tried mucking with imports, but A much simple solution was to just delete those two deprecated properties when running in Jest, so they're never imported: https://gist.github.com/turadg/9bcf08a7279e82a030a645250639fe6e |
I hit this issue with the Something somewhat interesting which may clue in a different kind of fix - Node's console was able to inspect the
|
This probably can be closed. |
With dependencies:
Given a test file:
Running the test file with Jest writes the following to the console:
Changing
import * as React from 'react';
toimport React from 'react';
causes these warnings to disappear.The documentation at https://flow.org/en/docs/react/types/ recommends
import * as React from 'react';
The text was updated successfully, but these errors were encountered: