mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
a7ae9885ed
Summary: Part of https://github.com/facebook/react-native/issues/34872#issuecomment-1304236257 > [Assigned to youedd] Create a new function [remapUnionTypeAnnotationMemberNames](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L110) in the [parser.js file](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parser.js) and add documentation to it. Implement it properly in the [FlowParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/parser.js#L15) and in the [TypeScriptParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/parser.js#L15). Remove the function [remapUnionTypeAnnotationMemberNames](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L110) and update the [emitUnionTypeAnnotation](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L110) signature to accept a Parser parameter instead of a language one. Use the new Parser function instead of the old one [here](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L139). ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [changed] - move remapUnionTypeAnnotationMemberNames to the parsers implementations Pull Request resolved: https://github.com/facebook/react-native/pull/35314 Test Plan: `yarn jest react-native-codegen`  Reviewed By: christophpurrer Differential Revision: D41247716 Pulled By: cipolleschi fbshipit-source-id: 6f708895392d5bdac5d4edbc67587194321ddb3d
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 react-native-codegen.