Skip to content
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

Parser create getTypeAnnotationName(typeAnnotation) #37580

Conversation

cloudpresser
Copy link

@cloudpresser cloudpresser commented May 26, 2023

Summary:

[Codegen 134 - Assigned to @cloudpresser] Create a function getTypeAnnotationName(typeAnnotation) in the Parser base class. Implement it using this code for Flow and this code for Typescript. Replace the callsites with the new function.

This is part of #34872

Changelog:

[INTERNAL] [ADDED] - getTypeAnnotationName(typeAnnotation) in parser

Test Plan:

yarn jest packages/react-native-codegen > new tests written, as well as coverage from existing tests

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 26, 2023
@Pranav-yadav Pranav-yadav added the Tech: Codegen Related to react-native-codegen label May 26, 2023
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me, but CI is red. Could you try rebase on top of main and see whether the CI passes?

@cloudpresser cloudpresser force-pushed the cloudpresser/parser-get-type-annotation-name branch from 03b99dc to 4792837 Compare May 31, 2023 20:15
@analysis-bot
Copy link

analysis-bot commented May 31, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,744,588 +3
android hermes armeabi-v7a 8,056,431 +3
android hermes x86 9,235,548 +3
android hermes x86_64 9,086,369 +4
android jsc arm64-v8a 9,307,266 +3
android jsc armeabi-v7a 8,496,489 +1
android jsc x86 9,369,139 -2
android jsc x86_64 9,624,077 +5

Base commit: 0191d16
Branch: main

@cloudpresser cloudpresser force-pushed the cloudpresser/parser-get-type-annotation-name branch from d76c730 to b240a29 Compare June 1, 2023 22:03
@cloudpresser
Copy link
Author

@cipolleschi I updated this PR with changes suggested here.
Also, now that upstream is fixed we're now passing CI tests here, :)

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@@ -43,7 +43,8 @@ function getPropertyType(
typeAnnotation: $FlowFixMe,
parser: Parser,
): NamedShape<EventTypeAnnotation> {
const type = parser.extractTypeFromTypeAnnotation(typeAnnotation);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native-codegen/src/parsers/flow/components/events.js line 46 – Delete (prettier/prettier)

@@ -102,7 +103,9 @@ function extractArrayElementType(
name: string,
parser: Parser,
): EventTypeAnnotation {
const type = parser.extractTypeFromTypeAnnotation(typeAnnotation);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native-codegen/src/parsers/flow/components/events.js line 106 – Replace ⏎··const·type·=·extractTypeFromTypeAnnotation(typeAnnotation,·parser);⏎ with ··const·type·=·extractTypeFromTypeAnnotation(typeAnnotation,·parser); (prettier/prettier)

@@ -167,6 +170,16 @@ function prettify(jsonObject: $FlowFixMe): string {
return JSON.stringify(jsonObject, null, 2);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 packages/react-native-codegen/src/parsers/flow/components/events.js line 171 – Delete (prettier/prettier)

@cipolleschi
Copy link
Contributor

@cloudpresser I'm sorry to ask for this, I have been tried to land this change for a while, but meanwhile the state of the repo has changed.
Could you please try to rebase and make sure that the CI is green again? 🙏

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is red, unfortunately. :(

@cipolleschi
Copy link
Contributor

/rebase

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Aug 4, 2023
@facebook-github-bot
Copy link
Contributor

@cipolleschi merged this pull request in e22d1a1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Tech: Codegen Related to react-native-codegen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants