MCPcopy Index your code
hub / github.com/microsoft/TypeChat / appendTupleType

Function appendTupleType

typescript/src/zod/validate.ts:228–251  ·  view source on GitHub ↗
(tupleType: z.ZodType)

Source from the content-addressed store, hash-verified

226 }
227
228 function appendTupleType(tupleType: z.ZodType) {
229 append("[");
230 let first = true;
231 const tupleDef = tupleType._zod.def as z.core.$ZodTupleDef;
232 for (let type of tupleDef.items as z.ZodType[]) {
233 if (!first) append(", ");
234 if (getTypeKind(type) === "optional") {
235 appendType((type._zod.def as z.core.$ZodOptionalDef).innerType as z.ZodType, TypePrecedence.Object);
236 append("?");
237 }
238 else {
239 appendType(type);
240 }
241 first = false;
242 }
243 const rest = tupleDef.rest;
244 if (rest) {
245 if (!first) append(", ");
246 append("...");
247 appendType(rest as z.ZodType, TypePrecedence.Object);
248 append("[]");
249 }
250 append("]");
251 }
252
253 function appendRecordType(recordType: z.ZodType) {
254 append("Record<");

Callers 1

appendTypeDefinitionFunction · 0.85

Calls 3

appendFunction · 0.85
getTypeKindFunction · 0.85
appendTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…