mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
1fc27c4cba
Summary: This PR aims to reduce code duplication by extracting `typeAliasResolution` logic from the flow and typescript folders into a shared parsers-primitives file. It is a task of https://github.com/facebook/react-native/issues/34872: > Wrap the TypeAlias resolution lines ([Flow](https://github.com/facebook/react-native/blob/b444f0e44e0d8670139acea5f14c2de32c5e2ddc/packages/react-native-codegen/src/parsers/flow/modules/index.js#L321-L362), [TypeScript](https://github.com/facebook/react-native/blob/00b795642a6562fb52d6df12e367b84674994623/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L356-L397)) in a proper typeAliasResolution function in the parsers-primitives.js files and replace those lines with the new function. ## 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] - Extract TypeAlias logic of translateTypeAnnotation from the flow and typescript folders in parsers-primitives Pull Request resolved: https://github.com/facebook/react-native/pull/34918 Test Plan: All tests are passing, with `yarn jest react-native-codegen`: <img width="930" alt="image" src="https://user-images.githubusercontent.com/40902940/194835192-49478b1c-3e04-40f9-b6f3-e26491f272ab.png"> Reviewed By: rshest Differential Revision: D40223495 Pulled By: rshest fbshipit-source-id: c74b68385e59497b6a8eaa56b96a001ef447a2cd
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.