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

Add TSMethodSignature to react-native-codegen #35311

Closed
wants to merge 7 commits into from

Conversation

ZihanChen-MSFT
Copy link
Contributor

@ZihanChen-MSFT ZihanChen-MSFT commented Nov 11, 2022

Summary

Refering to "Support function signature along with function type properties in commands" in #34872

Many TypeScript programmers prefer { name(arg:string):void; } to { readonly name:(arg:string)=>void; }.

In this pull request, I updated test cases in both commands and modules to cover it, with missing implementation.

Command arguments are NamedShape<T> but the optional field is missing, it is also fixed.

Changelog

[General] [Changed] - Add TSMethodSignature to react-native-codegen

Test Plan

yarn jest react-native-codegen passed

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Microsoft Partner: Microsoft Partner labels Nov 11, 2022
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.

Nice, I like it. The code read well and it is easy to follow. Thank you for this change.

Just a double check here, flow/modules already support both types of method definitions, right?

Would you mind update one test in the flow/module to keep that checked? The same change for getArray should be enough!

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,101,079 +0
android hermes armeabi-v7a 6,470,786 +0
android hermes x86 7,518,920 +0
android hermes x86_64 7,377,544 +0
android jsc arm64-v8a 8,965,158 +0
android jsc armeabi-v7a 7,696,551 +0
android jsc x86 9,027,654 +0
android jsc x86_64 9,505,792 +0

Base commit: 29caed2
Branch: main

@ZihanChen-MSFT
Copy link
Contributor Author

@cipolleschi Thanks for the comment! I updated test cases for Flow too but it seems the code covers it perfectly!

@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.

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 29caed2
Branch: main

@pull-bot
Copy link

PR build artifact for b6fdd84 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@ZihanChen-MSFT ZihanChen-MSFT deleted the ts-rncodegen14 branch November 14, 2022 21:52
@ZihanChen-MSFT ZihanChen-MSFT restored the ts-rncodegen14 branch November 14, 2022 21:53
@ZihanChen-MSFT ZihanChen-MSFT deleted the ts-rncodegen14 branch November 14, 2022 21:54
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Refering to "Support function signature along with function type properties in commands" in facebook#34872

Many TypeScript programmers prefer `{ name(arg:string):void; }` to `{ readonly name:(arg:string)=>void; }`.

In this pull request, I updated test cases in both commands and modules to cover it, with missing implementation.

Command arguments are `NamedShape<T>` but the `optional` field is missing, it is also fixed.

## Changelog

[General] [Changed] - Add `TSMethodSignature` to react-native-codegen

Pull Request resolved: facebook#35311

Test Plan: `yarn jest react-native-codegen` passed

Reviewed By: rshest

Differential Revision: D41217482

Pulled By: cipolleschi

fbshipit-source-id: 480af118d09b022bae919c5391547fd82c1a7cc9
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. p: Microsoft Partner: Microsoft Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants