mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
177bf4d043
Summary: This PR adds support for negative values in enums. Currently when we try to use an enum with negative value: ```ts enum MyEnum { ZERO = 0, POSITIVE = 1, NEGATIVE = -1, } export interface Spec extends TurboModule { useArg(arg: MyEnum): void; } export default TurboModuleRegistry.get<Spec>('Foo'); ``` It will fail: ``` Enum values can not be mixed. They all must be either blank, number, or string values. ``` This is because negative values are parsed as `UnaryExpressions` which have `-` operator in front and value as argument. With the new approach codegen properly generates enums with negative values. ## Changelog: [GENERAL] [ADDED] - Codegen: Support negative values in enums Pull Request resolved: https://github.com/facebook/react-native/pull/47452 Test Plan: I've added tests to see if everything is working properly Reviewed By: vzaidman Differential Revision: D65887888 Pulled By: elicwhite fbshipit-source-id: edb25f663dc58afa68c69cb84a47cfc67fc1f7e7 |
||
---|---|---|
.. | ||
assets | ||
babel-plugin-codegen | ||
community-cli-plugin | ||
core-cli-utils | ||
debugger-frontend | ||
dev-middleware | ||
eslint-config-react-native | ||
eslint-plugin-react-native | ||
eslint-plugin-specs | ||
gradle-plugin | ||
helloworld | ||
hermes-inspector-msggen | ||
metro-config | ||
normalize-color | ||
polyfills | ||
react-native | ||
react-native-babel-preset | ||
react-native-babel-transformer | ||
react-native-bots | ||
react-native-codegen | ||
react-native-codegen-typescript-test | ||
react-native-info | ||
react-native-popup-menu-android | ||
react-native-test-library | ||
react-native-test-renderer | ||
rn-tester | ||
typescript-config | ||
virtualized-lists |