-
Notifications
You must be signed in to change notification settings - Fork 24.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
[Codegen] Extract tryParse
(Flow, TypeScript) lambda into parseObjectProperty
fn
#35076
[Codegen] Extract tryParse
(Flow, TypeScript) lambda into parseObjectProperty
fn
#35076
Conversation
@cipolleschi as mentioned in the issue, I've Extracted the content of the
PS: This is first time I'm interacting w/ the |
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.
Thank you so much for engaging with React Native! :D
Let's start with the suggested change.
Then, the other thing you should do is to install Flow and try to run it. It should tell you which errors are there and how to solve them.
Once you did that, the first thing I'll make sure that the command
jest test react-native-codegen
works. You should run it from the react-native
root, after running yarn install
in the root.
If that is green, you can start adding some unit tests.
Let me know if you can make any progress with this hints.
Done suggested changes! @cipolleschi |
With Flow broken, it is normal that the tests are broken as well. Don't worry, we can fix everything! :D Let's start from Flow.
These should make Flow green. can you give it a shot? |
On it. Thanks for brief instructions. Btw, had overviewed the PR you mentioned; earlier today, and was able to get around those :) |
@cipolleschi Flow is now |
packages/react-native-codegen/src/parsers/typescript/modules/index.js
Outdated
Show resolved
Hide resolved
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
packages/react-native-codegen/src/parsers/flow/modules/index.js
Outdated
Show resolved
Hide resolved
packages/react-native-codegen/src/parsers/typescript/modules/index.js
Outdated
Show resolved
Hide resolved
With these two returns, the tests should be green as well! :D |
Base commit: 19d65a2 |
Base commit: 3d9a15d |
PR build artifact for 9885bcd is ready. |
PR build artifact for 9885bcd is ready. |
PR build artifact for 958072d is ready. |
PR build artifact for 958072d is ready. |
Looks great now. It would be awesome if you can uncomment the tests and make them work! :D |
958072d
to
bb9a431
Compare
@cipolleschi added tests for |
PR build artifact for bb9a431 is ready. |
PR build artifact for bb9a431 is ready. |
@cipolleschi pinging you; in case you missed previous comment :) |
Sorry, these days have been a bit full of stuff. I hope to find some time to look into this tomorrow. |
Rebasing again. Resolving conflicts. |
a3e5bc4
to
4197bf4
Compare
PR build artifact for 4197bf4 is ready. |
PR build artifact for 4197bf4 is ready. |
Hey @cipolleschi ! Pinging you just in case you don't forget this hahaha, though there is no hurry, review only when you get time :) |
Hi @Pranav-yadav! Thank you for the ping, and luckily, I hope the Android issue is mitigated now. |
- extract `tryParse` lambda of `translateTypeAnnotation` fn - to `parsers-commons`; for both Flow and TS
- add some tests (currenty commented)
- make _changed_ `@flow strict` - add `$FlowFixMe` incoming args where needed - fix other logical errors
- removed unused import; `UnsupportedUnionTypeAnnotationParserError`
- actions-bot provided wrong import warning :)
- `isObjectProperty` fn and, - `parseObjectProperty` fn
4197bf4
to
b63d1c1
Compare
done! |
PR build artifact for b63d1c1 is ready. |
PR build artifact for b63d1c1 is ready. |
@cipolleschi 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 @Pranav-yadav in 5744b21. When will my fix make it into a release? | Upcoming Releases |
…y` fn (facebook#35076) Summary: This PR is a task of facebook#34872 > Extract the content of the tryParse (Flow, TypeScript)lambda into a proper `parseObjectProperty` function into the parsers-commons.js file. also, - added new helper fn `isObjectProperty` in `parsers-commons.js` file. - added tests for `isObjectProperty` and `parseObjectProperty` fn 's ## Changelog [Internal] [Changed] - Extracted the content of the `tryParse` ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L292-L337), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L306-L351)) lambda into a proper `parseObjectProperty` fn into the `parsers-commons.js` file. Pull Request resolved: facebook#35076 Test Plan: - run ```bash yarn lint && yarn flow && yarn test-ci ``` - and ensure everything is � <img width="720" alt="image" src="https://user-images.githubusercontent.com/55224033/200105151-360b9b5e-52c7-4586-89b0-6860e9725f6e.png"> Reviewed By: cortinico Differential Revision: D40797241 Pulled By: cipolleschi fbshipit-source-id: 48b8900ead70d5eda2496f9ce044c11a9599a177
This PR is a task of #34872
Summary
isObjectProperty
inparsers-commons.js
file.isObjectProperty
andparseObjectProperty
fn 'sChangelog
[Internal] [Changed] - Extracted the content of the
tryParse
(Flow, TypeScript) lambda into a properparseObjectProperty
fn into theparsers-commons.js
file.Test Plan