(type: z.ZodType)
| 58 | } |
| 59 | |
| 60 | function getTypePrecedence(type: z.ZodType): TypePrecedence { |
| 61 | switch (getTypeKind(type)) { |
| 62 | case "enum": |
| 63 | case "union": // covers both z.union() and z.discriminatedUnion() — Zod v4 merged discriminated unions into the regular union type kind ("ZodDiscriminatedUnion" in v3) |
| 64 | return TypePrecedence.Union; |
| 65 | case "intersection": |
| 66 | return TypePrecedence.Intersection; |
| 67 | } |
| 68 | return TypePrecedence.Object; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Returns the TypeScript source code corresponding to a Zod schema. The schema is supplied as an object where each |
no test coverage detected
searching dependent graphs…