Skip to content

Add intersection types in react-native-codegen for TypeScript#35247

Closed
ZihanChen-MSFT wants to merge 11 commits into
facebook:mainfrom
ZihanChen-MSFT:ts-rncodegen13
Closed

Add intersection types in react-native-codegen for TypeScript#35247
ZihanChen-MSFT wants to merge 11 commits into
facebook:mainfrom
ZihanChen-MSFT:ts-rncodegen13

Conversation

@ZihanChen-MSFT
Copy link
Copy Markdown
Contributor

Summary

Refer to "Support intersection of object types, {...a, ...b, ...} in Flow is equivalent to a & b & {...} in TypeScript, the order and the form is not important." in #34872

In this change I also extract the common part from getTypeAnnotation and getTypeAnnotationForArray into getCommonTypeAnnotation. Most of the differences are about default in the schema. After a schema is generated from getCommonTypeAnnotation successfully, getTypeAnnotation will fill default if necessary, while getTypeAnnotationForArray does nothing.

Changelog

[General] [Changed] - Add intersection types in react-native-codegen for TypeScript

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 7, 2022
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Nov 7, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,066,177 -3,963
android hermes armeabi-v7a 6,438,561 -3,723
android hermes x86 7,481,495 -3,641
android hermes x86_64 7,340,889 -3,829
android jsc arm64-v8a 8,931,995 -2,844
android jsc armeabi-v7a 7,666,339 -2,609
android jsc x86 8,992,366 -2,520
android jsc x86_64 9,471,121 -2,704

Base commit: cf37479
Branch: main

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Nov 7, 2022

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

Base commit: cf37479
Branch: main

@pull-bot
Copy link
Copy Markdown

pull-bot commented Nov 7, 2022

PR build artifact for df4d3db 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.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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.

Thanks for doing this, it will help many people with the New aArchitecture writing better specs! I left two comments to improve the readability of the code.

@pull-bot
Copy link
Copy Markdown

pull-bot commented Nov 8, 2022

PR build artifact for e897f9c 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.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@ZihanChen-MSFT ZihanChen-MSFT deleted the ts-rncodegen13 branch November 11, 2022 08:48
@ZihanChen-MSFT ZihanChen-MSFT restored the ts-rncodegen13 branch November 11, 2022 08:48
@ZihanChen-MSFT ZihanChen-MSFT deleted the ts-rncodegen13 branch November 11, 2022 08:48
@ZihanChen-MSFT ZihanChen-MSFT restored the ts-rncodegen13 branch November 11, 2022 08:48
@ZihanChen-MSFT ZihanChen-MSFT deleted the ts-rncodegen13 branch November 14, 2022 21:54
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