Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor in turbo module TypeScript codegen: process
(T)
, T|U
, `T…
…|undefined` and related stuff in a central place (#34814) Summary: `TSParenthesizedType`, `TSUnionType`, `TSNullKeyword`, `TSUndefinedKeyword`, `TSVoidKeyword` etc are repeatly processed in so many places. In this change I put them in a new file `parseTopLevelType.js`, and everyone call that file, all repeat implementation are deleted. The `parseTopLevelType` function will look into a type consisted by the above types in any possible combination (but still very easy to do), and tell you if a type is nullable, or if there is a default value, and what is the real type with all noises removed. Array types and union types are processed in component twice, for property of array, and property of nested arrays (`componentsUtils.js`). They are extracted into single functions. ## Changelog [General] [Changed] - Refactor in turbo module TypeScript codegen: process `(T)`, `T|U`, `T|undefined` and related stuff in a central place Pull Request resolved: #34814 Test Plan: `yarn jest react-native-codegen` passed Reviewed By: yungsters, sammy-SC Differential Revision: D40094373 fbshipit-source-id: f28e145bc4e7734be9036815ea425d820eadb8f0
- Loading branch information