Commit 3ffad49
refactor: use .passthrough() instead of looseObject for base types
Using .passthrough() instead of z.looseObject() because:
- looseObject adds [x: string]: unknown index signature to inferred type
- This breaks TypeScript union narrowing (can't check 'prop' in obj)
- .passthrough() allows extra properties at runtime without affecting type
Note: Capability schemas still use looseObject intentionally since they
need the extensibility semantic and don't participate in union narrowing.
The Infer<typeof> type exports are still needed because:
- spec.types.ts has index signatures for extensibility
- sdk.types.ts inherits these from spec
- Only schema-inferred types are clean (no index signatures)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent bf03900 commit 3ffad49
2 files changed
+25
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
520 | 525 | | |
521 | 526 | | |
522 | 527 | | |
| |||
541 | 546 | | |
542 | 547 | | |
543 | 548 | | |
544 | | - | |
| 549 | + | |
| 550 | + | |
545 | 551 | | |
546 | | - | |
| 552 | + | |
547 | 553 | | |
548 | 554 | | |
549 | 555 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
1991 | 1994 | | |
1992 | 1995 | | |
1993 | 1996 | | |
1994 | | - | |
1995 | | - | |
1996 | | - | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
1997 | 2002 | | |
1998 | 2003 | | |
1999 | 2004 | | |
| |||
0 commit comments