-
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 95]: Merge defaultExports.forEach(statement => ...
(Flow, TS) to findNativeComponentType
fn in parser-commons.js
#36466
Conversation
Base commit: 681d7f8 |
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.
Great work here! I left a comment for something that you may have missed.
A part from that, it looks good to me! ;)
(also, it needs a rebase and conflict resolution) ;) |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
1c40c47
to
29c85f1
Compare
@cipolleschi rebased & resolved conflicts but, dk why ci keeps failing these days 🤔 (especially on my PRs 🫠 jk) Edit: the same thing is happening on my another PR |
/rebase |
Not sure why this is the case. Trying to rebase to see if this solves the issue. One of the failure was a transient network issue |
… fn's Add below fn's to `parser` (Flow & TS): - `getTypeArgumentParamsFromDeclaration` : Given a declaration, it returns the typeArgumentParams of the declaration. - `getNativeComponentType` : Given a typeArgumentParams and funcArgumentParams it returns a native component type.
Add below fn which unifies the `defaultExports.forEach(statement => ..` behaviors between Flow & TS: - `findNativeComponentType` : This function is used to find the type of a native component provided the default exports statement from generated AST.
…tiveComponentType` fn in `parser-commons.js`
29c85f1
to
d5089b9
Compare
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi merged this pull request in c0a46c6. |
…tiveComponentType` fn in `parser-commons.js` (facebook#36466) Summary: >[Codegen 95] Extract the `defaultExports.forEach(statement =>` (Flow, TS) function in `parser-commons`, so that it accept a Parser parameter to unify the behaviors between flow and typescript. The Parser object needs to be enriched with all the methods to extract the required information from the Node, if they are not there yet. ### Changes - merged TS & Flow parsers' logic for `defaultExports.forEach(statement =>` of `/components/index.js:findComponentConfig()` into; - `findNativeComponentType` fn to `parsers-commons.js` - add `getTypeArgumentParamsFromDeclaration` & `getNativeComponentType` fn's - add **_tests_** for getTypeArgumentParamsFromDeclaration & `getNativeComponentType` fn's ## Changelog [INTERNAL] [CHANGED] - Merge `defaultExports.forEach(statement => ...` (Flow, TS) to `findNativeComponentType` fn in `parser-commons.js` Pull Request resolved: facebook#36466 Test Plan: - `yarn lint && yarn run flow && yarn jest react-native` ⇒ � Reviewed By: rshest Differential Revision: D44088862 Pulled By: cipolleschi fbshipit-source-id: 91bf0edcd53b2e054160af34d7c128355c178b26
Summary
Changes
defaultExports.forEach(statement =>
of/components/index.js:findComponentConfig()
into;findNativeComponentType
fn toparsers-commons.js
getTypeArgumentParamsFromDeclaration
&getNativeComponentType
fn'sgetNativeComponentType
fn'sChangelog
[INTERNAL] [CHANGED] - Merge
defaultExports.forEach(statement => ...
(Flow, TS) tofindNativeComponentType
fn inparser-commons.js
Test Plan
yarn lint && yarn run flow && yarn jest react-native
⇒ 🟢