Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cau777 committed Jul 11, 2024
1 parent c15255f commit 9861245
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/zod-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ export const zodDeepPartial = (schema: ZodTypeAny): ZodTypeAny => {
return [type, newType] as const
})
const typeMap = new Map<any, any>(newTypeEntries)
// ZodDiscriminatedUnion uses instanceof indirectly, so we avoid it
return new ZodDiscriminatedUnion({
...schema._def,
options: Array.from(typeMap.values()),
// Keep the same map values, but swap the objects
optionsMap: new Map(
Array.from(schema.optionsMap.entries(), ([key, oldVal]) => [
key,
Expand Down

0 comments on commit 9861245

Please sign in to comment.