mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
4fd8f405be
Summary:
Previously we allow `{[key:string]:Something}` in codegen, `Something` is type-checked but thrown away, generating a `GenericObjectTypeAnnotation`.
In this change, `Something` is added to `GenericObjectTypeAnnotation` as an optional field.
For downstream code such as C++ codegen, this change is **backward compatible**. It allows C++ codegen to produce a more precious type optionally.
## Changelog:
[General] [Added] - Recognize dictionary type in codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/37206
Test Plan:
```
yarn jest react-native-codegen
yarn jest react-native-codegen-typescript-test
```
Reviewed By: cipolleschi
Differential Revision: D45563340
Pulled By: dmytrorykun
fbshipit-source-id: 9a9ce36df6ded6d42d35c3dcb6fb0eaca16c4458
@react-native/codegen
Installation
yarn add --dev @react-native/codegen
Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like
Testing
To run the tests in this package, run the following commands from the React Native root folder:
yarnto install the dependencies. You just need to run this onceyarn jest packages/react-native-codegen.