-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Codegen]: Extract contents of the case 'BooleanTypeAnnotation' into a single emitBoolean function #34907
[Codegen]: Extract contents of the case 'BooleanTypeAnnotation' into a single emitBoolean function #34907
Conversation
Base commit: 7227bde |
Base commit: 7227bde |
@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this. 👏 That's amazing!
We can improve the quality even further by adding a unit test.
The steps should be:
- add the
__tests__
subfolder in thepackages/react-native-codegen/src/parsers
. - add a
parser-primitives-test.js
where we unit test this fuction:- we test the output when the
nullable
parameter isfalse
- we test the output when the
nullable
parameter istrue
- we test the output when the
An example of unit test can be found here.
Thank you so much! 🙏
@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 @tarunrajput in 7a2e346. When will my fix make it into a release? | Upcoming Releases |
…itBoolean function (facebook#34907) Summary: Part of facebook#34872 This PR extracts the content of the case 'BooleanTypeAnnotation' ([Flow](https://github.com/facebook/react-native/blob/b444f0e44e0d8670139acea5f14c2de32c5e2ddc/packages/react-native-codegen/src/parsers/flow/modules/index.js#L365-L367), [TypeScript](https://github.com/facebook/react-native/blob/00b795642a6562fb52d6df12e367b84674994623/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L400-L402)) into a single emitBoolean function in the parsers-primitives.js file. Use the new function in the parsers. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [Changed] - Extract contents of the case 'BooleanTypeAnnotation' into a single emitBoolean function Pull Request resolved: facebook#34907 Test Plan: Run ```yarn jest react-native-codegen``` <img width="803" alt="image" src="https://user-images.githubusercontent.com/34857453/194751101-3b1a619e-332a-43a9-bfa3-35f5869d7c5f.png"> Reviewed By: cipolleschi Differential Revision: D40212518 Pulled By: cipolleschi fbshipit-source-id: 9c1462c1e51a1836f963866dc4101f081898df00
Summary
Part of #34872
This PR extracts the content of the case 'BooleanTypeAnnotation' (Flow, TypeScript) into a single emitBoolean function in the parsers-primitives.js file. Use the new function in the parsers.
Changelog
[Internal] [Changed] - Extract contents of the case 'BooleanTypeAnnotation' into a single emitBoolean function
Test Plan
Run
yarn jest react-native-codegen