Commit 9cec0e4
Adding support for unions in Codegen Schema (#54489)
Summary:
Pull Request resolved: #54489
Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.
`StringLiteralUnionTypeAnnotation` already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
type: 'StringLiteralUnionTypeAnnotation',
types: [
{
type: 'StringLiteralTypeAnnotation'
value: 'light'
},
{
type: 'StringLiteralTypeAnnotation'
value: 'dark'
},
],
}
```
NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.
The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`
Changelog: [Internal]
Differential Revision: D865015971 parent 2d6a323 commit 9cec0e4
File tree
38 files changed
+3163
-1687
lines changed- packages
- react-native-codegen/src
- generators
- components
- __test_fixtures__
- modules
- GenerateModuleObjCpp
- header
- __test_fixtures__
- __tests__/__snapshots__
- parsers
- __tests__
- flow
- components
- __tests__/__snapshots__
- modules
- __tests__/__snapshots__
- typescript
- components
- __tests__/__snapshots__
- modules
- __tests__/__snapshots__
- react-native-compatibility-check/src
- __tests__
- __snapshots__
38 files changed
+3163
-1687
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
41 | 74 | | |
42 | 75 | | |
43 | 76 | | |
44 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
45 | 83 | | |
46 | 84 | | |
47 | 85 | | |
| |||
304 | 342 | | |
305 | 343 | | |
306 | 344 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | 345 | | |
312 | 346 | | |
313 | 347 | | |
| |||
369 | 403 | | |
370 | 404 | | |
371 | 405 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
376 | 414 | | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
| 415 | + | |
| 416 | + | |
381 | 417 | | |
382 | 418 | | |
383 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
| |||
68 | 81 | | |
69 | 82 | | |
70 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
71 | 94 | | |
72 | 95 | | |
73 | 96 | | |
| |||
358 | 381 | | |
359 | 382 | | |
360 | 383 | | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
365 | 392 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 393 | + | |
| 394 | + | |
370 | 395 | | |
371 | 396 | | |
372 | 397 | | |
| |||
396 | 421 | | |
397 | 422 | | |
398 | 423 | | |
| 424 | + | |
399 | 425 | | |
400 | 426 | | |
401 | 427 | | |
| |||
Lines changed: 56 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
20 | 32 | | |
21 | 33 | | |
22 | 34 | | |
| |||
61 | 73 | | |
62 | 74 | | |
63 | 75 | | |
64 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
65 | 120 | | |
66 | 121 | | |
67 | 122 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1273 | 1273 | | |
1274 | 1274 | | |
1275 | 1275 | | |
1276 | | - | |
| 1276 | + | |
1277 | 1277 | | |
1278 | 1278 | | |
1279 | 1279 | | |
| |||
1383 | 1383 | | |
1384 | 1384 | | |
1385 | 1385 | | |
1386 | | - | |
| 1386 | + | |
1387 | 1387 | | |
1388 | 1388 | | |
1389 | 1389 | | |
| |||
0 commit comments