Skip to content

Commit

Permalink
Allowed ZodDefault in parseShape
Browse files Browse the repository at this point in the history
  • Loading branch information
incetarik committed Aug 22, 2022
1 parent 9df50e2 commit f6ca9da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/helpers/parse-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const PARSED_TYPES = [
zod.ZodEnum,
zod.ZodOptional,
zod.ZodObject,
zod.ZodDefault,
] as const

type Options<T extends zod.AnyZodObject>
Expand Down Expand Up @@ -114,7 +115,7 @@ export function parseShape<T extends zod.AnyZodObject>(

const { type: fieldType } = elementType

let defaultValue = generateDefaults(prop)
let defaultValue = elementType.isType ? undefined : generateDefaults(prop)
let nullable: boolean | NullableList = isNullable || isOptional

if (isOfArray) {
Expand Down

0 comments on commit f6ca9da

Please sign in to comment.