MCPcopy
hub / github.com/colinhacks/zod / ZodUndefined

Class ZodUndefined

packages/zod/src/v3/types.ts:2044–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2042}
2043
2044export class ZodUndefined extends ZodType<undefined, ZodUndefinedDef, undefined> {
2045 _parse(input: ParseInput): ParseReturnType<this["_output"]> {
2046 const parsedType = this._getType(input);
2047 if (parsedType !== ZodParsedType.undefined) {
2048 const ctx = this._getOrReturnCtx(input);
2049 addIssueToContext(ctx, {
2050 code: ZodIssueCode.invalid_type,
2051 expected: ZodParsedType.undefined,
2052 received: ctx.parsedType,
2053 });
2054 return INVALID;
2055 }
2056 return OK(input.data);
2057 }
2058 params?: RawCreateParams;
2059
2060 static create = (params?: RawCreateParams): ZodUndefined => {
2061 return new ZodUndefined({
2062 typeName: ZodFirstPartyTypeKind.ZodUndefined,
2063 ...processCreateParams(params),
2064 });
2065 };
2066}
2067
2068///////////////////////////////////////
2069///////////////////////////////////////

Callers

nothing calls this directly

Calls 1

processCreateParamsFunction · 0.85

Tested by

no test coverage detected