Repository navigation
Commit 56222cd
authored
feat(instanceof): key the .properties() shape off the instance type (#6600)
The method took any $ZodShape, so a misspelled key or a schema that can't
accept the property's type both compiled. The shape is now a mapped type over
keyof T, which also makes the keys autocomplete.
Methods are excluded from the shape. Every object literal inherits
Object.prototype.toString, so a constraint carrying URL's own toString entry
rejects every shape literal passed to it.
Type-only: the emitted JS is byte-identical, so runtime, memory and bundle
are all unchanged.1 parent de65a5c commit 56222cd
2 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2841 | 2841 | | |
2842 | 2842 | | |
2843 | 2843 | | |
2844 | | - | |
| 2844 | + | |
| 2845 | + | |
2845 | 2846 | | |
2846 | 2847 | | |
2847 | 2848 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
54 | 73 | | |
55 | 74 | | |
56 | 75 | | |
| |||
0 commit comments