Commit 43986e8
chore: Add functionTypeAnnotation to codegen Parser class (#36468)
Summary:
This PR adds a `functionTypeAnnotation` function to the codegen Parser class and implements it in the Flow and TypeScript parsers as requested on #34872, refactoring the `throwIfModuleTypeIsUnsupported` function to accept a `Parser` instead of a `ParserType` and use the newly created function instead of the `if (language)` logic.
## Changelog
[Internal] [Added] - Add `functionTypeAnnotation` to codegen Parser class
Pull Request resolved: #36468
Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: cipolleschi
Differential Revision: D44056853
Pulled By: rshest
fbshipit-source-id: f22b9efe53df16f7916eb1a9cea8b9531f1194f51 parent b893582 commit 43986e8
File tree
7 files changed
+34
-26
lines changed- packages/react-native-codegen/src/parsers
- __tests__
- flow
- typescript
7 files changed
+34
-26
lines changedLines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
557 | 560 | | |
558 | 561 | | |
559 | | - | |
560 | 562 | | |
561 | 563 | | |
562 | 564 | | |
563 | 565 | | |
564 | 566 | | |
565 | 567 | | |
566 | 568 | | |
567 | | - | |
| 569 | + | |
568 | 570 | | |
569 | 571 | | |
570 | 572 | | |
571 | 573 | | |
572 | 574 | | |
573 | | - | |
574 | 575 | | |
575 | 576 | | |
576 | 577 | | |
577 | 578 | | |
578 | 579 | | |
579 | 580 | | |
580 | 581 | | |
581 | | - | |
| 582 | + | |
582 | 583 | | |
583 | 584 | | |
584 | 585 | | |
585 | 586 | | |
586 | 587 | | |
587 | | - | |
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
595 | | - | |
| 595 | + | |
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
601 | | - | |
602 | 601 | | |
603 | 602 | | |
604 | 603 | | |
605 | 604 | | |
606 | 605 | | |
607 | 606 | | |
608 | 607 | | |
609 | | - | |
| 608 | + | |
610 | 609 | | |
611 | 610 | | |
612 | 611 | | |
613 | 612 | | |
614 | 613 | | |
615 | | - | |
616 | 614 | | |
617 | 615 | | |
618 | 616 | | |
619 | 617 | | |
620 | 618 | | |
621 | 619 | | |
622 | 620 | | |
623 | | - | |
| 621 | + | |
624 | 622 | | |
625 | 623 | | |
626 | 624 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 165 | + | |
178 | 166 | | |
179 | 167 | | |
180 | 168 | | |
181 | 169 | | |
182 | 170 | | |
183 | | - | |
| 171 | + | |
184 | 172 | | |
185 | 173 | | |
186 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
294 | 298 | | |
295 | 299 | | |
296 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
207 | 214 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
280 | 287 | | |
281 | 288 | | |
282 | 289 | | |
| |||
0 commit comments