Skip to content

Commit 46da957

Browse files
committed
docs: match the error-message examples to what the parsers emit
The "Handling errors" examples dropped the ", received X" suffix that invalid_type messages have always carried; the strings were never correct. The Zod Mini tab needed a different value: @zod/mini ships without the en locale, so its messages stay at a bare "Invalid input" until the consumer calls z.config(z.locales.en()). Closes #6589
1 parent e359f73 commit 46da957

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎packages/docs/content/basics.mdx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ try {
7171
expected: 'string',
7272
code: 'invalid_type',
7373
path: [ 'username' ],
74-
message: 'Invalid input: expected string'
74+
message: 'Invalid input: expected string, received number'
7575
},
7676
{
7777
expected: 'number',
7878
code: 'invalid_type',
7979
path: [ 'xp' ],
80-
message: 'Invalid input: expected number'
80+
message: 'Invalid input: expected number, received string'
8181
}
8282
] */
8383
}
@@ -96,13 +96,13 @@ try {
9696
expected: 'string',
9797
code: 'invalid_type',
9898
path: [ 'username' ],
99-
message: 'Invalid input: expected string'
99+
message: 'Invalid input'
100100
},
101101
{
102102
expected: 'number',
103103
code: 'invalid_type',
104104
path: [ 'xp' ],
105-
message: 'Invalid input: expected number'
105+
message: 'Invalid input'
106106
}
107107
] */
108108
}

‎packages/zod/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ try {
155155
expected: 'string',
156156
code: 'invalid_type',
157157
path: [ 'username' ],
158-
message: 'Invalid input: expected string'
158+
message: 'Invalid input: expected string, received number'
159159
},
160160
{
161161
expected: 'number',
162162
code: 'invalid_type',
163163
path: [ 'xp' ],
164-
message: 'Invalid input: expected number'
164+
message: 'Invalid input: expected number, received string'
165165
}
166166
] */
167167
}

0 commit comments

Comments
 (0)