Commit 66f4a91
Codegen 123: add parser-primitive function for emitBoolProp (#37488)
Summary:
Part of #34872, Improving Codegen
Reduces code duplication by creating a helper function `emitBoolProp(name: string, optional: boolean)` in `parser-primitives.js`. Refactors the code from [Flow](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/flow/components/events.js#L37-L43) and [TypeScript](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/typescript/components/events.js#L47-L53) to utilize the new function.
bypass-github-export-checks
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[INTERNAL] [CHANGED] - Extract contents of the case `BooleanTypeAnnotation` and `TSBooleanKeyword` into a single `emitBoolProp` function
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: #37488
Test Plan:
Run `yarn jest react-native-codegen`
<img width="392" alt="image" src="https://github.com/facebook/react-native/assets/374022/79dae56d-e12d-4be2-9426-50a72e893dfe">
Reviewed By: dmytrorykun
Differential Revision: D46073996
Pulled By: cipolleschi
fbshipit-source-id: 4af67e7e9c3ee1712159c7a647790cb431cfb17a1 parent af8b03d commit 66f4a91
File tree
4 files changed
+58
-18
lines changed- packages/react-native-codegen/src/parsers
- __tests__
- flow/components
- typescript/components
4 files changed
+58
-18
lines changedLines changed: 36 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
829 | 830 | | |
830 | 831 | | |
831 | 832 | | |
832 | | - | |
| 833 | + | |
833 | 834 | | |
834 | 835 | | |
835 | 836 | | |
| |||
843 | 844 | | |
844 | 845 | | |
845 | 846 | | |
846 | | - | |
| 847 | + | |
847 | 848 | | |
848 | 849 | | |
849 | 850 | | |
| |||
1042 | 1043 | | |
1043 | 1044 | | |
1044 | 1045 | | |
1045 | | - | |
| 1046 | + | |
1046 | 1047 | | |
1047 | 1048 | | |
1048 | 1049 | | |
| |||
1056 | 1057 | | |
1057 | 1058 | | |
1058 | 1059 | | |
1059 | | - | |
| 1060 | + | |
1060 | 1061 | | |
1061 | 1062 | | |
1062 | 1063 | | |
| |||
1506 | 1507 | | |
1507 | 1508 | | |
1508 | 1509 | | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 40 | + | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
577 | 579 | | |
578 | 580 | | |
579 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
580 | 595 | | |
581 | 596 | | |
582 | 597 | | |
| 598 | + | |
583 | 599 | | |
584 | 600 | | |
585 | 601 | | |
| |||
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 50 | + | |
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
| |||
0 commit comments