react-native
react-native copied to clipboard
Add intersection types in react-native-codegen for TypeScript
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
| 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
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| ios | - | universal | n/a | -- |
Base commit: cf3747957ab210e31504109bb6b3e34e773a5b9a Branch: main
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.
@lunaleaps has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
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.
@lunaleaps has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.