react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Add intersection types in react-native-codegen for TypeScript

Open ZihanChen-MSFT opened this issue 2 years ago • 4 comments

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 https://github.com/facebook/react-native/issues/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

ZihanChen-MSFT avatar Nov 07 '22 20:11 ZihanChen-MSFT

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: cf3747957ab210e31504109bb6b3e34e773a5b9a Branch: main

analysis-bot avatar Nov 07 '22 20:11 analysis-bot

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

Base commit: cf3747957ab210e31504109bb6b3e34e773a5b9a Branch: main

analysis-bot avatar Nov 07 '22 21:11 analysis-bot

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

pull-bot avatar Nov 07 '22 21:11 pull-bot

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

facebook-github-bot avatar Nov 08 '22 00:11 facebook-github-bot

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

pull-bot avatar Nov 08 '22 22:11 pull-bot

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

facebook-github-bot avatar Nov 10 '22 21:11 facebook-github-bot