| 2077 | } |
| 2078 | |
| 2079 | export class ZodNull extends ZodType<null, ZodNullDef, null> { |
| 2080 | _parse(input: ParseInput): ParseReturnType<this["_output"]> { |
| 2081 | const parsedType = this._getType(input); |
| 2082 | if (parsedType !== ZodParsedType.null) { |
| 2083 | const ctx = this._getOrReturnCtx(input); |
| 2084 | addIssueToContext(ctx, { |
| 2085 | code: ZodIssueCode.invalid_type, |
| 2086 | expected: ZodParsedType.null, |
| 2087 | received: ctx.parsedType, |
| 2088 | }); |
| 2089 | return INVALID; |
| 2090 | } |
| 2091 | return OK(input.data); |
| 2092 | } |
| 2093 | static create = (params?: RawCreateParams): ZodNull => { |
| 2094 | return new ZodNull({ |
| 2095 | typeName: ZodFirstPartyTypeKind.ZodNull, |
| 2096 | ...processCreateParams(params), |
| 2097 | }); |
| 2098 | }; |
| 2099 | } |
| 2100 | |
| 2101 | ////////////////////////////////////// |
| 2102 | ////////////////////////////////////// |
nothing calls this directly
no test coverage detected