[Codegen] Extract RootTag case of translateTypeAnnotation from the flow and typescript folders in parsers-primitives#34901
Conversation
3b0c364 to
cd52bee
Compare
Base commit: 54fc62c |
cd52bee to
d698e7c
Compare
Base commit: 54fc62c |
d698e7c to
5778fe3
Compare
|
@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
cipolleschi
left a comment
There was a problem hiding this comment.
Thanks for taking this. 👏 That's amazing!
We can improve the quality even further byadding a unit test.
The steps should be:
- add the
__tests__subfolder in thepackages/react-native-codegen/src/parsers. - add a
parser-primitives-test.jswhere we unit test this fuction:- we test the output when the
nullableparameter isfalse - we test the output when the
nullableparameter istrue
- we test the output when the
An example of unit test can be found here.
Thank you so much! 🙏
5778fe3 to
72d26ac
Compare
Thanks for the review! I thought this case was already covered in these files (flow and typescript). But you're right, it's clearer and safer to test It's done if you want to re-review it! |
|
@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@MaeIg Just a heads up - looks like there are some conflicting changes in the new main, have to be resolved before merging. |
ed95539 to
1826b7f
Compare
1826b7f to
5894434
Compare
|
@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @MaeIg in 5f05b07. When will my fix make it into a release? | Upcoming Releases |
Summary
This PR aims to reduce code duplication by extracting
emitRootTaglogic from the flow and typescript folders into a shared parsers-primitives file. It is a task of #34872:Note that #34898 should be merged first. I rebased on it's branch.Changelog
[Internal] [Changed] - Extract RootTag case of translateTypeAnnotation from the flow and typescript folders in parsers-primitives
Test Plan
All tests are passing, with

yarn jest react-native-codegen: