Commit f7d1c76
docs: fix root type in types.mdx wildcard-vs-literal example
The example declared the root as Record<string, number> but the path
was three levels deep and the sample data was nested two more levels —
{ a: { "*": { b: 1 }, x: { b: 2 } } }. Type-checked but lied about
the leaf type.
- Introduce explicit type aliases (Data, Bag) so the root shape is
visible and matches the path / data.
- unsafePath now takes <Bag, number> so .get() returns number | undefined
rather than unknown.
- Switch the template example to the lambda form path((d: Data) => d.items)
since path<T>() returns a Path<T,T> with no proxy access; the old
path<T>().items.each() didn't actually compile.
- Drop the unused DEEP_WILDCARD import.
Verified by spinning up a tmp spec that runs both snippets and passes
under --typecheck.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 99b453e commit f7d1c76
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | | - | |
| 117 | + | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| |||
0 commit comments