-
Notifications
You must be signed in to change notification settings - Fork 291
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
Use named components for type imports in update-react-imports #305
base: master
Are you sure you want to change the base?
Conversation
Reference to types like React.ReactNode will be converted into named imports like ReactNode instead of resulting in a namespace import.
I was looking for this right now. Well if it helps anyone, you can run the updated codemod from this PR before it gets merged (if ever) like this: |
I tried running this (in the same directory where
Any idea where I'm going wrong? @stropho @thespacemanatee @raopg @pmillspaugh @NoMoreViolence @julianguyen Thanks! |
@lainermeister sorry, no idea. I tried to run the command right now and it works fine (Linux,Mac) even if I am in a directory where there is no |
This PR correctly addressed 518 files out of 577 in our codebase that had React specific type imports, so thank you for that ❤️ see: I think it's fair to say that it "fixes" this issue, too. |
thanks ben for this PR, which was used by @amirabbas-gh as the foundation for his fix: #325 (comment) i think we can close this out. |
Fixes #283.
Previously running update-react-imports against
produced the following output:
Note that types are not converted to be named exports like when React.BLAH values are used, usage in types still gets plucked off the namespace object. This PR applies the fix documented here, so now it compiles to: