Skip to content

Fix interface support in turbo module TypeScript codegen (component only)#34778

Closed
ZihanChen-MSFT wants to merge 12 commits into
facebook:mainfrom
ZihanChen-MSFT:ts-rncodegen9
Closed

Fix interface support in turbo module TypeScript codegen (component only)#34778
ZihanChen-MSFT wants to merge 12 commits into
facebook:mainfrom
ZihanChen-MSFT:ts-rncodegen9

Conversation

@ZihanChen-MSFT
Copy link
Copy Markdown
Contributor

@ZihanChen-MSFT ZihanChen-MSFT commented Sep 24, 2022

Summary

Interface was supported in component, but it only allows interfaces in limited cases.

In this change, I extended interface support to all places where object literal type is supported.

I also refactor the code so that properties and events are able to share the same implementation.

In order not to mess up the diff, I noticed that implementations are repeated in processing array properties and non-array properties. But I leave it without refactoring. I will do it in future PRs.

I also commented potential problems I found in the code.

Changelog

[General] [Changed] - Fix interface support in turbo module TypeScript codegen (component only)

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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Sep 24, 2022
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Sep 24, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,727,567 +129
android hermes armeabi-v7a 7,130,453 +130
android hermes x86 8,034,128 +141
android hermes x86_64 8,007,407 +133
android jsc arm64-v8a 9,596,918 +367
android jsc armeabi-v7a 8,363,229 +365
android jsc x86 9,541,151 +376
android jsc x86_64 10,133,547 +358

Base commit: f85e2ec
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@cipolleschi
Copy link
Copy Markdown
Contributor

Hi @ZihanChen-MSFT, there are some errors in the CI for some JS files. For example, the Flow check fails with this error:

Error ----------------------------------- packages/react-native-codegen/src/parsers/typescript/components/props.js:665:2

Cannot build a typed interface for this module. You should annotate the exports of this module with types. Missing type
annotation at function return: [signature-verification-failure]

Could you have a look and fix these, please?

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

Comment thread Libraries/vendor/core/ErrorUtils.d.ts Outdated
Comment thread Libraries/vendor/emitter/EventEmitter.d.ts Outdated
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@analysis-bot
Copy link
Copy Markdown

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

Base commit: f85e2ec
Branch: main

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @ZihanChen-MSFT in 8dc6bec.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 27, 2022
@ZihanChen-MSFT ZihanChen-MSFT deleted the ts-rncodegen9 branch September 27, 2022 20:35
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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants