Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions packages/cli-kit/src/public/node/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export function deepStrict<T>(schema: T): T {
Object.entries(shape).map(([key, value]) => [key, deepStrict(value as ZodTypeAny)]),
)
return z.object(strictShape).strict() as T
} else if (schema instanceof ZodOptional) {
}
if (schema instanceof ZodOptional) {
return deepStrict(schema._def.innerType).optional()
} else {
return schema
}
return schema
}

/**
Expand All @@ -35,14 +35,7 @@ export function deepStrict<T>(schema: T): T {
* @returns The human-readable string.
*/
export function errorsToString(errors: z.ZodIssueBase[]): string {
return errors
.map((error) =>
error.path
.join('.')
.concat(': ')
.concat(error.message ?? 'Unknow error'),
)
.join('\n')
return errors.map((error) => `${error.path.join('.')}: ${error.message ?? 'Unknow error'}`).join('\n')
}

/**
Expand Down
Loading