Skip to content

Commit

Permalink
Handle either case
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Sep 6, 2024
1 parent b4e66f7 commit 1da8a34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/starlight/utils/error-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ const errorMap: z.ZodErrorMap = (baseError, ctx) => {
};

const getTypeOrLiteralMsg = (error: TypeOrLiteralErrByPathEntry): string => {
if (typeof error.received === 'undefined') return 'Required';
// received could be `undefined` or the string `'undefined'`
if (typeof error.received === 'undefined' || error.received === 'undefined') return 'Required';
const expectedDeduped = new Set(error.expected);
switch (error.code) {
case 'invalid_type':
Expand Down

0 comments on commit 1da8a34

Please sign in to comment.