mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47323 This change adds support for number literals as a type. The codegen already has parsing support for these types ``` +passNumber: (arg: number) => void; +passString: (arg: string) => void; +passStringLiteral: (arg: 'A String Literal') => void; ``` This change now also supports ``` +passNumberLiteral: (arg: 4) => void; ``` On the native side this is treated the same as `number`. It could be strengthened in the future. This is a pre-requisite for number literal unions and enums. Changelog: [Added] Codegen: Added support for Number literals in native module specs Reviewed By: makovkastar Differential Revision: D65249334 fbshipit-source-id: 98b051d2a6bd1ad5cc6473ac88acfcbe82bd5c7d
@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.