MCPcopy Create free account
hub / github.com/microsoft/TypeChat / getTypePrecedence

Function getTypePrecedence

typescript/src/zod/validate.ts:60–69  ·  view source on GitHub ↗
(type: z.ZodType)

Source from the content-addressed store, hash-verified

58}
59
60function 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

Callers 1

appendTypeFunction · 0.85

Calls 1

getTypeKindFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…