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

Class ZodSymbol

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

Source from the content-addressed store, hash-verified

2007}
2008
2009export class ZodSymbol extends ZodType<symbol, ZodSymbolDef, symbol> {
2010 _parse(input: ParseInput): ParseReturnType<this["_output"]> {
2011 const parsedType = this._getType(input);
2012 if (parsedType !== ZodParsedType.symbol) {
2013 const ctx = this._getOrReturnCtx(input);
2014 addIssueToContext(ctx, {
2015 code: ZodIssueCode.invalid_type,
2016 expected: ZodParsedType.symbol,
2017 received: ctx.parsedType,
2018 });
2019 return INVALID;
2020 }
2021
2022 return OK(input.data);
2023 }
2024
2025 static create = (params?: RawCreateParams): ZodSymbol => {
2026 return new ZodSymbol({
2027 typeName: ZodFirstPartyTypeKind.ZodSymbol,
2028 ...processCreateParams(params),
2029 });
2030 };
2031}
2032
2033////////////////////////////////////////////
2034////////////////////////////////////////////

Callers

nothing calls this directly

Calls 1

processCreateParamsFunction · 0.85

Tested by

no test coverage detected