Commit 224351e
feat: add discriminatedUnion transform for tagged unions
Add DISCRIMINATED_UNIONS config to convert z.union() to z.discriminatedUnion()
for better performance and error messages in tagged unions:
- ContentBlockSchema -> discriminatedUnion('type')
- SamplingMessageContentBlockSchema -> discriminatedUnion('type')
Re-export SamplingMessageContentBlockSchema from generated (now compatible).
Types.ts reduced from ~1275 to ~1267 lines.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent cc49983 commit 224351e
File tree
3 files changed
+42
-15
lines changed- scripts
- src
- generated
3 files changed
+42
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
103 | 113 | | |
104 | 114 | | |
105 | 115 | | |
| |||
273 | 283 | | |
274 | 284 | | |
275 | 285 | | |
| 286 | + | |
276 | 287 | | |
277 | 288 | | |
278 | 289 | | |
| |||
503 | 514 | | |
504 | 515 | | |
505 | 516 | | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
506 | 541 | | |
507 | 542 | | |
508 | 543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2115 | 2115 | | |
2116 | 2116 | | |
2117 | 2117 | | |
2118 | | - | |
| 2118 | + | |
2119 | 2119 | | |
2120 | 2120 | | |
2121 | 2121 | | |
| |||
2384 | 2384 | | |
2385 | 2385 | | |
2386 | 2386 | | |
2387 | | - | |
| 2387 | + | |
2388 | 2388 | | |
2389 | 2389 | | |
2390 | 2390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| |||
336 | 338 | | |
337 | 339 | | |
338 | 340 | | |
| 341 | + | |
339 | 342 | | |
340 | 343 | | |
341 | 344 | | |
| |||
820 | 823 | | |
821 | 824 | | |
822 | 825 | | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
| 826 | + | |
| 827 | + | |
836 | 828 | | |
837 | 829 | | |
838 | 830 | | |
| |||
0 commit comments