.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export type TypeToZod<T> = {
|
||||
[K in keyof T]: // 1. Handle Arrays (including arrays of objects, optional or required)
|
||||
T[K] extends ReadonlyArray<infer E> | undefined
|
||||
[K in keyof T]: T[K] extends ReadonlyArray<infer E> | undefined // 1. Handle Arrays (including arrays of objects, optional or required)
|
||||
? undefined extends T[K]
|
||||
? E extends object
|
||||
? z.ZodOptional<z.ZodArray<z.ZodObject<TypeToZod<E>>>>
|
||||
|
||||
Reference in New Issue
Block a user