-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recognize dictionary type in codegen #37206
Conversation
Base commit: 1be65ba |
@ZihanChen-MSFT thanks for the PR! Could you please address the linter warnings. |
@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ZihanChen-MSFT for doing this.
This is a good first step! It adds dictionary to NativeModules only but it provides a guide guidance on how to add this in components too (props, events and commands)
@dmytrorykun merged this pull request in 4fd8f40. |
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: facebook#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
Summary
Previously we allow
{[key:string]:Something}
in codegen,Something
is type-checked but thrown away, generating aGenericObjectTypeAnnotation
.In this change,
Something
is added toGenericObjectTypeAnnotation
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
Test Plan