MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / unwrap

Function unwrap

src/cli/schema-to-yargs.ts:69–90  ·  view source on GitHub ↗

* Unwrap Zod wrapper types to get the underlying type.

(t: z.ZodType)

Source from the content-addressed store, hash-verified

67 * Unwrap Zod wrapper types to get the underlying type.
68 */
69function unwrap(t: z.ZodType): z.ZodType {
70 const typeName = getZodTypeName(t);
71
72 // Wrapper types that should be unwrapped
73 const wrapperTypes = [
74 'optional',
75 'nullable',
76 'default',
77 'transform',
78 'pipe',
79 'prefault',
80 'catch',
81 'readonly',
82 ];
83
84 if (typeName && wrapperTypes.includes(typeName)) {
85 const inner = getInnerType(t);
86 if (inner) return unwrap(inner);
87 }
88
89 return t;
90}
91
92/**
93 * Check if a Zod type is optional/nullable/has default.

Callers 1

zodToYargsOptionFunction · 0.85

Calls 2

getZodTypeNameFunction · 0.85
getInnerTypeFunction · 0.85

Tested by

no test coverage detected